function makeRemote(url, w, h, scrollbar){
	if  (w == null) w = 760;
	if (h == null) h = 580;
	if (scrollbar == null) scrollbar = "yes";

var popWidth = (window.screen.width) - (eval(w) + 40); 
	var popHeight = (window.screen.height) - (eval(h) + 90);  // Doesn't set the width as the name would suggest, but the screen position based on the users screen size and the width/height of the window  

	remote = window.open(url,"remotewin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+scrollbar+",resizable=yes,width="+w+",height="+h+",left=" + popWidth + ",top=" + popHeight + ",screenX=" + popWidth + ",screenY=" + popHeight + "");
	if(remote.opener  == null) remote.opener = window;
	remote.opener.name = "opener";
	remote.focus();  // Puts the focus on the window each time the script runs (no more popups behind the main window)
}

function makeRemote2(url, w, h, scrollbar){
	if  (w == null) w = 750;
	if (h == null) h = 570;
	if (scrollbar == null) scrollbar = "yes";

var popWidth = (window.screen.width) - (eval(w) + 40); 
	var popHeight = (window.screen.height) - (eval(h) + 90);  // Doesn't set the width as the name would suggest, but the screen position based on the users screen size and the width/height of the window  

	remote2 = window.open(url,"remotewin2","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width="+w+",height="+h+",left=" + popWidth + ",top=" + popHeight + ",screenX=" + popWidth + ",screenY=" + popHeight + "");
	if(remote2.opener  == null) remote.opener = window;
	remote2.opener.name = "opener";
	remote2.focus();  // Puts the focus on the window each time the script runs (no more popups behind the main window)
}

function popWindow(url,w,h, scrollbar){
	if  (w == null) w = 760;
	if (h == null) h = 580;
	if (scrollbar == null) scrollbar = "yes";
	
 window.open(url,"remotewin2","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+scrollbar+",resizable=yes,width="+w+",height="+h);

}


function updParent (url) {
 opener.document.location= url
  opener.focus();
 }
 
 // JavaScript Cookie Code
// Coding by Ammon Johns
// www.webmarketingplus.co.uk

var cDomain = self.location.hostname;
if(cDomain.indexOf(".") < cDomain.lastIndexOf(".")){
  var domainOffset = cDomain.indexOf(".")+1
  cDomain = cDomain.substr(domainOffset);
}

if(document.referrer.indexOf(cDomain)==-1 && document.referrer!="" && document.cookie.indexOf("referrer=")==-1){
var expDays = 90;
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
var d = new Date();
var year = (d.getFullYear());
var month = (d.getMonth() + 1);
var day = (d.getDate());
var hours = (d.getHours());
var minutes = (d.getMinutes());
var seconds = (d.getSeconds());
if(year<1000) year+=1900;
if(month<10) month= "0" + month;
if(day<10) day = "0" + day;
if(hours<10) hours = "0" + hours;
if(minutes<10) minutes = "0" + minutes;
if(seconds<10) seconds = "0" + seconds;
  

var refdate =  ("" + year + "" + month + "" + day + "" + hours + "" + minutes + "" + seconds + "");



document.cookie = "referrer=" + escape(document.referrer + "&&&" + refdate) + "; expires=" + exp.toGMTString() + "; path=/" + "; domain=" + cDomain;
}

var allCookies = document.cookie;
var cPos = allCookies.indexOf("referrer=");
if(cPos != -1){
var cdstart = cPos + 9;
var cdend = allCookies.indexOf(";", cdstart);
if(cdend == -1) cdend = allCookies.length;
var cookieContent = allCookies.substring(cdstart,cdend);
cookieContent = unescape(cookieContent);
var cdatestart = cookieContent.indexOf("&&&", 0);
var cdateend = cookieContent.length;
var cRefer = cookieContent.substring(0,cdatestart);
var cDateRef = cookieContent.substring(cdatestart +3,cdateend)
}
else{
var cRefer = "No cookie";
var cDateRef = "No cookie";
}


