function helppop(url, content) {
  helpContent = content;
  remote = window.open(url,"HelpWindow","width=400,height=245,screenX=0,screenY=0,top=0,left=0,scrollbars=yes, modal=yes", true);
  if (remote != null) {
    remote.focus();
	window.onunload = function(){
    	if (!remote.closed) {remote.close();}
    }
  }
}

function ihshelppop(mode) {
  var ihsWin = window.open ('','ihs_window' ,'resizable=yes,scrollbars=yes,width=395,height=283');
  ihsWin.focus();
        if (mode != "") {
            document.helpForm.pageId.value=mode + "." + document.helpForm.gameId.value;
        }
  document.forms['helpForm'].target='ihs_window';
        document.forms['helpForm'].submit();
}

function ihshelppopNoSys(url) {
  remote = window.open(url,"IHSHelpWindow","width=420,height=225,screenX=50,screenY=50,top=50,left=50,scrollbars=no");
  if (remote != null) {
    remote.focus();
	window.onunload = function(){
    	if (!remote.closed) {remote.close();}
    }
  }
}

function popNotification(url, width, height) {
    var optionListing = "width="+width+",height="+height+",innerHeight="+height+",innerWidth="+width+",left=50,top=50,channelmode=0,dependent=no,directories=no,fullscreen=0,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no,screenX=10,screenY=20";
    now = new Date();
    url = url + "?timestamp=" + now.getTime();
    remote = window.open(url,"Popup",optionListing, true);
    popUpExisted = wasWindowOpen(remote);
    if(popUpExisted){
        if (!remote.closed) {remote.close();}
        remote = window.open(url,"Popup",optionListing, true);
    }
    if (remote != null) {
      remote.focus();
      popNum = "1";
      }
    }

function wasWindowOpen(popUp){
    var popUpCookies = popUp.document.cookie;
    var mainCookies = document.cookie;
    var popSessionPos = popUpCookies.indexOf("JSESSIONID=");
    var mainSessionPos = mainCookies.indexOf("JSESSIONID=");
    if(popSessionPos != -1){
        var popStart = popSessionPos + 11;        
        var mainStart = mainSessionPos + 11;      
        var popEnd = popUpCookies.indexOf(";", popStart);  
        var mainEnd = mainCookies.indexOf(";", mainStart);        
        if(popEnd == -1){
            popEnd = popUpCookies.length;
        }
        if(mainEnd == -1){
            mainEnd = mainCookies.length;    
        }
       var popSessionIdValue = popUpCookies.substring(popStart, popEnd);    
       var mainSessionIdValue =  mainCookies.substring(mainStart, mainEnd); 
       if(popSessionIdValue != mainSessionIdValue){ 
         return true;  
       }
    }
    return false;
    
}

