var forward = '';
var host = 'www.pagefix.co.uk';

function leadingZero(nr)
{
	if (nr < 10) nr = "0" + nr;
	return nr;
}

var d = new Date();

var t_date = d.getDate();    
    

var t_mon = leadingZero(d.getMonth()+1);


var t_year = d.getFullYear();  
var t_hour = d.getHours();     
var t_min = d.getMinutes();    
var t_sec = d.getSeconds();  
var t_mil = d.getMilliseconds;  
var ts = + t_year + "-" + t_mon + "-" + t_date + " " + t_hour + ":" + t_min + ":" + t_sec;


function ai_inf() {

	vi = new Image();
	vi.src = 'http://www.pagefix.co.uk/ref.php?ref=' + escape(document.referrer) + '&user_agent=' + escape(navigator.userAgent) + '&camp_id=' + ai_camp + '&pfvis=' + pfvis + '&pfsess=' + pfsess + '&url=' + escape(document.location) + '&p=' + escape(location.pathname) + '&h=' + escape(location.hostname) + '&host=' + host  + '&ts=' + ts  + '&forward=' + forward + '&q=' + escape(document.location.search);
}
function Get_Cookie(name) { 
   var start = document.cookie.indexOf(name+"="); 
   var len = start+name.length+1; 
   if ((!start) && (name != document.cookie.substring(0,name.length))) return null; 
   if (start == -1) return null; 
   var end = document.cookie.indexOf(";",len); 
   if (end == -1) end = document.cookie.length; 
   return unescape(document.cookie.substring(len,end)); 
} 





function Set_Cookie(name,value,expires,path,domain,secure) { 
    var cookieString = name + "=" +escape(value) + 
       ( (expires) ? ";expires=" + expires.toGMTString() : "") + 
       ( (path) ? ";path=" + path : "") + 
       ( (domain) ? ";domain=" + domain : "") + 
       ( (secure) ? ";secure" : ""); 
    document.cookie = cookieString; 
	
} 

var expDays = 730; // number of days the cookie should last
var cookie_expire_date = new Date();
cookie_expire_date.setTime(cookie_expire_date.getTime() +  (24 * 60 * 60 * 1000 * expDays)); 



function setVisitorID() { 
   if (Get_Cookie('pfvis')) { 
       var pfvis = Get_Cookie('pfvis');
	   Set_Cookie('pfvis',pfvis,cookie_expire_date);
	   return pfvis;
   }else{ 
       Set_Cookie('pfvis',Math.random(),cookie_expire_date); 
	   var pfvis = Get_Cookie('pfvis');
	   return pfvis;
   } 
} 

function setSessionID() { 
   if (Get_Cookie('pfsess')) {
   
   var pfsess = Get_Cookie('pfsess'); 
	   return pfsess;
	   }
	else{
       Set_Cookie('pfsess',Math.random()); 
	   var pfsess = Get_Cookie('pfsess');
	   return pfsess;
		}
	
	}

pfvis = setVisitorID(); 
pfsess = setSessionID();
ai_inf();

