function showPopup()  {	
	//If popup is up and running state = "Y"
	//If popup is down set state = "N"
	//If popup is on a schedule then set state ="M" and fill in the start and end times
	myDate = new Date();
	today = new Date(myDate.getFullYear(), myDate.getMonth(), myDate.getDate(), myDate.getHours(), myDate.getMinutes());
	//set the start and end times using this method (Time is in Military format, Months start at 0, range 0-11
	//startTime = new Date(<YEAR>,<MONTH>,<DAY>,<HOUR>,<MINUTES>); 
	startTime = new Date(2005, 8, 21, 12, 00);
	endTime = new Date(2005, 8, 21, 21, 00);
	//var state = "Y" popup is up
	//var state = "N" popup is down
	//var state = "M" popup is time stamped, start and end times must be set
	
	var state = 'N';
	
	if(state.toUpperCase() == "Y")  {
		display();
	}  else  if(state.toUpperCase() == "M")  {
		if(today >= startTime && today <= endTime)  {
			display();
		} 	
	} 
}

function display()  {
	//if(id != getCookie(id))  {
		//setCookie(id, id);
		wid = 440;
		hg = 350;
		var newwindow;
		var x = (screen.availWidth - wid)/2;
		var y = (screen.availHeight - hg)/2;
		// var title = "";
		if (newwindow && !newwindow.closed)  {
			newwindow.focus(); 
			newwindow.document.clear();			
		}  else  { 
			//newwindow=window.open('http://vega.oit.state.nj.us/DOC_Inmate/escapeAlert.jsp?z='+ id,id,'width=' + wid + ', height=' + hg + ',resizable=0, scrollbars=1');
			//Below is a local test location
			//newwindow=window.open('http://10.15.14.116/DOC_Inmate/escapeAlert.jsp?z='+ id,id,'width=' + wid + ', height=' + hg + ',resizable=0, scrollbars=1');
			newwindow=window.open("http://www.njdoc.gov/message.html", "Important","width=" + wid + ",height=" + hg + ",status=no,resizeable=no");
			
			//newwindow=window.open('http://highpoint.state.nj.us/corrections/message.html');  //+ id,id,'width=' + wid + ', height=' + hg + ',resizable=0, scrollbars=1');
			//newwindow=window.menubar.visible = false;
			//newwindow.scrollbars.visible = false;
			//newwindow.toolbar.visible = false;
			//newwindow.personalbar.visible = false;
			newwindow.moveTo(x,y);
			newwindow.document.close();
		}
	//}
}

//            *********************

function getCookie(name) {
    var c = document.cookie;
    var index = c.indexOf(name + "=");
    if (index == -1) {
		return null;
	}  else  {
    	index = c.indexOf("=", index) + 1;
    	var endstr = c.indexOf(";", index);
    	if (endstr == -1) endstr = c.length;
    	return unescape(c.substring(index, endstr));
	}
}

function setCookie(name, value) {
	document.cookie=name + "=" + escape(value);
}

//         **************************

function EscapeMessage()  {
	opener.location = "https://www4.state.nj.us/NASApp/DOC_InmateSearchEngine/inmatefinder?i=E";
	window.close();
}