//Javascript for assigning cookies to deactivate repeated pop up windows.  There are three functions included, a set cookie, get cookie and pass cookie info(inspectBox).

//Authored by Rick Petrino
//Date:  10/02/2001

//This function fires on the click of the user either checking or unchecking the checkbox on the pop up page.  If the user the does not make any attempt to check the checkbox, then no cookie is established.

function inspectBox(assess) {
		//check the status of the checkbox, either checked or unchecked.....
		if(assess.cbox.checked) {	
		//if checked, set the "value" attribute of the name/value pair to "on" by passing it to the
		//set_popup_status function..... 		
			set_popup_status("on");
		//delay the closing of the window by 1 second so that the user can visually see that they
		//have checked off the checkbox.....
			window.setTimeout("self.close()", 1000);
		}
		else {		
		//if the checkbox is unchecked, set the "value" attribute of the name/value pair to "on" by
		//passing it to the set_popup_status function.....	
			set_popup_status("off");
		}
}


//Function to set the cookie variables.....
function set_popup_status(cval) {

//Establish the current time and move it forward 24 hours, assign it to the variable 'nextday'
	var nextday = new Date();
	nextday.setTime (nextday.getTime() + (1000 * 60 * 60 * 24));
	
//Set the cookie here.....	
	document.cookie = "setting=" + cval + "; expires=" + nextday.toGMTString(); + "path='/'; domain='hmco.com'";
}

//Function to read the value of the "settings" cookie.....
function check_popup_status() {

//Read the cookie file on the users machine.....
	var allcookies = document.cookie;
	
//Extract the value of the cookie named "setting".....	
	var popcookie = allcookies.indexOf("setting=");
	
	if  (popcookie != -1) {
		var start = popcookie + 8;
		var end = allcookies.indexOf(";", start);
		if (end == -1) end = allcookies.length;
		var value = allcookies.substring(start, end);		
	}
	
//If the value is equal to 'on', do nothing, otherwise open the pop up window.....	
	if (value == "on") {/*do nothing*/}
	else {
		ow("/notification.html",0);	
	}	
}