var newWindow = null;

//Accessibility: open url in new window
function closeWin()
{
 if (newWindow != null)
 {
  if(!newWindow.closed)
  newWindow.close();
 }
}

function popUpWin(url, type, strWidth, strHeight)
{
 closeWin();

 if (type == "fullScreen")
 {
  strWidth = screen.availWidth - 10;
  strHeight = screen.availHeight - 160;
 }

 var tools="";
 if (type == "standard" || type == "fullScreen") 
  tools = " resizable,toolbar=yes,location=yes,scrollbars=yes,menubar=yes,width="+strWidth+",height="+strHeight+",top=0,left=0";
 if (type == "console") 
  tools = " resizable,toolbar=no,location=no,scrollbars=no,width="+strWidth+",height="+strHeight+",left=0,top=0";

 newWindow = window.open(url, 'newWin', tools);
 newWindow.focus();
}

var today = new Date();
var minutes = today.getMinutes();

today.setMinutes(minutes + 1);

//alert(today.toGMTString())

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 document.cookie;
  return unescape(document.cookie.substring(len,end));
  
}

function Set_Cookie(name, value, expires, path, domain, secure)
{
  //alert(expires.toLocaleString());
  
  var cookie_string = name + "=" + escape(value) +
  
    ((expires) ? "; expires=" + expires.toUTCString() : "") +
	((path) ? "; path=" + path : "") +
	((domain) ? "; " + domain : "") +
  	((secure) ? "; secure" : "");
	
    //alert(cookie_string);
	document.cookie = cookie_string;
	
}

function setSessionID() {
 
  if(!Get_Cookie('SessionID'))
    //Setting the path to '/' sets the same cookie for each page; otherwise, each page would have its own cookie

   Set_Cookie('SessionID', Math.random(), today,'/','140.254.74.31',false);
     
}

function Delete_Cookie(name)
{
  var past = new Date();
  //var day = past.getDate();
  document.cookie = name + "=Deleted; expires=" + past.toUTCString();
 
}

function Learn_Cookie(name)
{
  var start = document.cookie.indexOf(name+"=");
  alert(document.cookie);
}