function Go2Order(url){
//Pass the URL of the orderpage to the PHP script
window.location="orderpage2.php?p=" + url;
}

function CheckOrderLinks(){
//Loop trough all links in the page
for(i=0;i<document.links.length;i++){
//Check the payment processor domain to detect the order page
if(document.links[i].href.indexOf("net-harbor.net")!=-1){
//Replace the URL of the link to a javascript function that will open first the PHP script that will increment the order page counter, and then redirect to the order page
document.links[i].href="javascript:Go2Order('" + escape(escape(document.links[i].href)) + "');";
}
 }
  }

window.onload=CheckOrderLinks;