var newWin;

function doneNewCookie(Name) {
  var search = Name + "="
  if (document.cookie.length > 0) { 
    // if there are any cookies
    offset = document.cookie.indexOf(search)
    if (offset != -1) return true;
    else return false;
  }else return false;
}

function Kiosk(page){

return(false);
}

function Message(page,wintype){
  if (wintype != null && wintype == "print") newWin=window.open(page,"window",'scrollbars=no,location=no,menubar=no,toolbar=no,hotkeys=no,resizable=no,status=no,width=575,height=256');
  else newWin=window.open(page,"Message",'location=no,menubar=no,toolbar=no,hotkeys=no,resizable=yes,titlebar=no,scrollbars=yes,status=no,width=550,height=450');
  if (newWin != null) newWin.focus();
  return;
}

function SetCookie (name, value, expire, path, domain) { 
	var argv = SetCookie.arguments; 
	var argc = SetCookie.arguments.length; 
	var expires = null;
	var expire = (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; 
	if(expire != null) expires = new Date(expire);
	document.cookie = name + "=" + value + 
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
	((path == null) ? "" : ("; path=" + path)) + 
	((domain == null) ? "" : ("; domain=" + domain)) + 
	((secure == true) ? "; secure" : ""); 
} 

function CheckMessage(URL, cookiename, cookievalue, expire, path, domain, wintype) {
  if (document.domain != "www.google.com") {
	  if (doneNewCookie("pop") != true) {
			SetCookie("pop","done",null,path,domain);
			if (doneNewCookie("pop") == true)	{	
			  if (doneNewCookie(cookiename) != true) {
			    var expires = new Date(expire);
					SetCookie(cookiename,cookievalue,expires,path,domain);
			    //document.cookie = cookiename + "=" + cookievalue + "; expires=" + expires.toGMTString() + ";path=/";
			    if (doneNewCookie(cookiename) == true) Message(URL,wintype);
			  } else { /*Message(URL,wintype);*/ }
			}
		}
  }
}
