<!-- Popup script on exit supplied by hypergurl.com. -->
<!-- http://www.hypergurl.com -->

<!-- Begin
var expDays = 1; // number of days the cookie should last
//var page = "comment.asp";
//var windowprops = "width=300,height=360,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=no";

function GetCookie (name) {  
	var arg = name + "=";  
	var alen = arg.length;  
	var clen = document.cookie.length;  
	var i = 0;  
	while (i < clen) {    
		var j = i + alen;    
		if (document.cookie.substring(i, j) == arg)      
		return getCookieVal (j);    
		i = document.cookie.indexOf(" ", i) + 1;    
		if (i == 0) break;   
}  
return null;
}
function SetCookie (name, value) {  
	var argv = SetCookie.arguments;  
	var argc = SetCookie.arguments.length;  
	var expires = (argc > 2) ? argv[2] : null;  
	var path = (argc > 3) ? argv[3] : null;  
	var domain = (argc > 4) ? argv[4] : null;  
	var secure = (argc > 5) ? argv[5] : false;  
	document.cookie = name + "=" + escape (value) + 
		((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
		((path == null) ? "" : ("; path=" + path)) +  
		((domain == null) ? "" : ("; domain=" + domain)) +    
		((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {  
	var exp = new Date();  
	exp.setTime (exp.getTime() - 1); 
	var cval = GetCookie (name);  
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function amt(){
	var count = GetCookie('count')
	if(count == null) {
	SetCookie('count','1')
	return 1
	}
else {
	var newcount = parseInt(count) + 1;
	DeleteCookie('count')
	SetCookie('count',newcount,exp)
	return count
   }
}
function getCookieVal(offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
	endstr = document.cookie.length;
	//alert('endstr=' + endstr);
	return unescape(document.cookie.substring(offset, endstr));
}
function checkCount(pagefrom) {
if (pagefrom == 0){
	var page = "comment.asp";
	var windowprops = "width=300,height=360,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=no";
}
if (pagefrom == 1){
	var page = "frenchcomment.asp";
	var windowprops = "width=335,height=440,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=no";
}
if (pagefrom == 2){
	var page = "germancomment.asp";
	var windowprops = "width=307,height=429,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=no";
}
if (pagefrom == 3){
	var page = "japanesecomment.asp";
	var windowprops = "width=307,height=399,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=no";
}
if (pagefrom == 4){
	var page = "spanishcomment.asp";
	var windowprops = "width=307,height=429,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=no";
}
var count = GetCookie('count');
//if the page not wrapped in a frame
	if (self == top) {
		if (count == null) {
		count=1;
		SetCookie('count', count, exp);
			
		var count1 = GetCookie('count');
		if (count1 != null) {	
			myWindowHandle = window.open("/" + page, "", windowprops);
			if (pagefrom == 0){
				if (myWindowHandle != null) myWindowHandle.blur();
				}
			}	
		}
		else {
			count++;
			SetCookie('count', count, exp);
		   }
	}
	else {
		top.location = self.location
	}	   
}
function checkCountNew(PageToDisplay, CookieName,Widthin,Heightin,PageName,Shouldblur) {

var count = GetCookie(CookieName);
var page = PageToDisplay;
var page = "/" + page;
var windowprops = "width=" + Widthin + ",height=" + Heightin + ",location=no,toolbar=no,menubar=no,scrollbars=no,resizable=no";
	//if the page not wrapped in a frame
	if (self == top) {
		
		if (count == null) {
		count=1;
		SetCookie(CookieName, count, exp);
			
			var count1 = GetCookie(CookieName);
			
			var countAuto = GetCookie('countAuto');
			var countFood = GetCookie('countFood');
			var countRet = GetCookie('countRet');
			var countServ = GetCookie('countServ');
			
			//check if allow cookie
			if (count1 != null) {
				if (CookieName == "countNew" || CookieName == "count") {
					myWindowHandle = window.open(PageToDisplay, PageName, windowprops);
					if (Shouldblur == 1){
						if (myWindowHandle != null) {	
							myWindowHandle.blur()
						}	
					}
				}
				if ((CookieName == "countAuto") && (countFood!=0) && (countServ!=0) && (countRet!=0)){
					myWindowHandle = window.open(PageToDisplay, PageName, windowprops);
					if (Shouldblur == 1){
						if (myWindowHandle != null) {	
							myWindowHandle.blur()
						}
					}
				}
				if ((CookieName == "countFood") && (countAuto!=0) && (countServ!=0) && (countRet!=0)) {
					myWindowHandle = window.open(PageToDisplay, PageName, windowprops);
					if (Shouldblur == 1){
						if (myWindowHandle != null) {	
							myWindowHandle.blur()
						}
					}
				}
				if ((CookieName == "countRet")  && (countFood!=0) && (countServ!=0) && (countAuto!=0)) {
					myWindowHandle = window.open(PageToDisplay, PageName, windowprops);
					if (Shouldblur == 1){
						if (myWindowHandle != null) {	
							myWindowHandle.blur()
						}
					}
				}
				if ((CookieName == "countServ")  && (countFood!=0) && (countAuto!=0) && (countRet!=0)) {
					myWindowHandle = window.open(PageToDisplay, PageName, windowprops);
					if (Shouldblur == 1){
						if (myWindowHandle != null) {	
							myWindowHandle.blur()
						}
					}
				}
			}	
		}
		else {
			/*if (CookieName == 'countNew') {
				myWindowHandle = window.open(PageToDisplay, PageName, windowprops);
				if (Shouldblur == 1){
					if (myWindowHandle != null) {	
						myWindowHandle.blur()
					}
				}
			}*/
			if ((!(count>=1)) && (CookieName == "count")) {
				count++;
				SetCookie(CookieName, count, exp);		
			}		
		}
	}
	else {
		top.location = self.location
		}	   
}
function decrementcookie(Cookiename){
	
	var count = GetCookie(Cookiename);
	count= count-1;
	SetCookie(Cookiename,count, exp);
	
}
function newwindow(pagetodisplay,pagename){

  //var screenwidth  = screen.width-10;
  //var screenheight = screen.height;
	var screenwidth  = screen.width-10;
	var screenheight = (screen.Height/2)+200;
	
	var winprop=" width= " + screenwidth + ",height=" + screenheight + ",top=0,left=0,location=yes,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes";
	//var winprop=" width=1000,height=600,location=yes,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes";
	
	window.open(pagetodisplay,pagename,winprop);
}
//---------------------------
// -s  popLink func
//---------------------------
var pgName = "/popLink.asp";
var wdwSetting = "location=no,directories=no,status=no,menubar=no,toolbar=no,scrollbars=no,resizable=no,width=735,height=355";

//calc today - midnight 
var dexp = new Date();
dexp.setUTCHours(23);
dexp.setUTCMinutes(59);
dexp.setUTCSeconds(01);

function Cookiedown(cookie) {
	document.cookie = cookie;
}

function PopWin (cName, cValue) {
	//.... increament the FOWinnbr

	var icount = GetCookie(cName);
	if (icount == null)	  icount=1;
	else{
		if (cValue==null)	icount++;
			else			icount= cValue;
	}	
	SetCookie(cName, icount, dexp);
}
function popLink() {
	var icount = GetCookie('FOnbr');
	var iWin = GetCookie('FOWinnbr');		//increamented only when pop-leads clicked-on by user
	
	if (self == top && self.name == 'new_PopLink') return;
	else{
	 if (self == top && self.name != 'new_PopLink') {
	 	//... dont popup another if window is a pop-lead clicked-on window
		if (icount == null)	icount=1;
		 else				icount++;
		SetCookie('FOnbr',icount, dexp);

		//-- fOSess Cookie found then popup already opened, so exit
		icount = GetCookie('FOSess');
		if  (icount != null)  return;
		SetCookie('FOSess');			//-- FOSess cookie expires when browser session closes

		var icount1 = GetCookie('FOnbr');
		if (icount1 != null) {	
			//alert ('iWin=' +iWin);
			if (iWin == null || iWin < 3) {	
				//...if 3 pops-leads clicked-on by user then stop, no more popups for today
				theWin = window.open(pgName,'popLink', wdwSetting);			
				if (theWin != null)	theWin.blur();
			}
		}	
	}else{
	top.location = self.location;
	}
   }
}

var uswin=null;
var uspage= "/pop800.asp";
var usname= "800pop";
var w= "365";
var h= "325";
var pos= "top";
var infocus= "back";
function popus() {
if (self == top && self.name == 'new_800') return;
	 else{
	 if (self == top && self.name != 'new_800') {	 
	
		if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
		if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}
		else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=20}
		settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";
		my_window=window.open(uspage,usname,settings);
		if (my_window != null)	my_window.blur(); 
		}else{
		top.location = self.location
		}
	}
} 
//  End -->
