var trackingUrl = "/idlogger/WriteToLog.php?";
var ref ;
if (self != top)
{    // page is framed
    framed="yes";                                       
    ref = self.document.referrer;

}
else
{
    // page is not framed
    framed="no";
    ref = parent.document.referrer ;
}

var amp = /\&/g;

var IDlocation = document.location.href;
// handling location prefix
var location1 = IDlocation.indexOf('://');
// now prefix is http or https
var IDlocationPrefix = IDlocation.substr(0,location1);
// and the rest is what after the ://
var IDlocation= IDlocation.substr((location1+3));

var IDref = ref.replace(amp,"AMP;");

// checking if referrer is empty
if ((IDref==null)||(IDref==""))
{
	var IDrefPrefix = "";
	var IDref = "";	
}
else
{
	// handling ref prefix
	var ref1 = IDref.indexOf('://');
	// now prefix is http or https
	var IDrefPrefix = IDref.substr(0,ref1);
	// and the rest is what after the ://
	var IDref= IDref.substr((ref1+3));
}


trackingUrl += "refprefix=" + IDrefPrefix;
trackingUrl += "&ref=" + IDref;
trackingUrl += "&locprefix=" + IDlocationPrefix;
trackingUrl += "&loc=" + IDlocation;
trackingUrl += "&bwidth=" + screen.width;	
trackingUrl += "&bheight=" + screen.height;	
//trackingUrl += "ref=" + ref.replace(amp,"AMP;");
//trackingUrl += "&location=" + document.location.href ;	
//trackingUrl += "&bwidth=" + screen.width;	
//trackingUrl += "&bheight=" + screen.height;	


document.write("<script src='" + trackingUrl + "'></script><noscript><IMG src='" + trackingUrl + "' width='1' height='1'></noscript>");