window.onload = function() {
  if (!document.getElementsByTagName) return false;
  var lnks = document.getElementsByTagName("a"); //parse every link using DOM
  for (var i=0; i<lnks.length; i++) {
      lnks[i].onclick = function() {
		//first, get href value
		href = this.getAttribute("href");
		protocol = href.substring(0,7);
		action = this.getAttribute("action");
		var injectTag="YES";
        if (protocol=="mailto:") injectTag="NO";
		if (protocol=="http://"){
			//check for ie6 quirk
			if ((href.substring(0,21)!="http://strikeitlucky.") && (href.substring(0,31)!="http://www.strikeitluckycasino.")) injectTag="NO";
		}	
		if (href.indexOf("#") > -1) injectTag="NO";    
		
		//only for debug
		//alert("INJECT TAG: " + injectTag);
      
        if (injectTag=="YES") {
	       if (action) { //any action parameter?
		       thisURL = href +"?aff_id="+aff_id+"&act="+action;
		   } else {
		       thisURL = href +"?aff_id="+aff_id; 
		   }
	    } else {
		   thisURL = href;
		}      
        this.href=thisURL;//let's go to this URI
        }    
  }
  
    if ( $(".jprog").length > 0 ) {
		$.ajax({ type: "GET", url: "http://www.tickerassist.co.uk/ProgressiveTickers/WebServiceProgressiveTickerScript.asmx/renderScript?form=json", 
			success: function(){ 
					setTimeout(function(){ try { ScrollTotals("USD"); ShowCounters("USD"); } catch(err) {} },1000); },
			dataType: "script", cache: false});
	}
  
  return true;
}

function Check() {
	if (aff_id) {
	   return true;
	} else {
	   return false;
	}
}
