<!--
function middle() {
    if (document.layers) {
        document.layers['zipSelectInstructions'].pageX = document.layers['zipSelectInstructions'].document.width/2;
        document.layers['zipSelectInstructions'].pageY = document.layers['zipSelectInstructions'].document.height/2;
    }
    else if (document.all) {
       document.all('zipSelectInstructions').style.posLeft = document.all('zipSelectInstructions').style.width/2;
       document.all('zipSelectInstructions').style.posTop = document.all('zipSelectInstructions').style.height/2;
    }
}

function Set_Cookie( name, value, expires, path, domain, secure ) 
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct 
expires time, the current script below will set 
it for x number of days, to make it for hours, 
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
( ( path ) ? ";path=" + path : "" ) + 
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}

// this function gets the cookie, if it exists
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 unescape( document.cookie.substring( len, end ) );
}

// this deletes the cookie when called
function Delete_Cookie( name, path, domain ) {
if ( Get_Cookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}



function open_window(url, scrollbars, width, height, name, toolbar)	{
	m_lscroll_top = document.body.scrollTop;

	var aChildWin = new Array();
	var iLeft = ((screen.availWidth - parseInt(width)) / 2);
	var iTop = ((screen.availHeight - parseInt(height)) /2);
	
	if (!toolbar) {
		toolbar = "no";
	}
	
	var sProperties = "width=" + width 
							   + ", height=" + height 
							   + ", resizable=no, scrollbars=" + scrollbars 
							   + ", left=" + iLeft + "px, top= " + iTop + "px" 
							   + ", toolbar=" + toolbar 
							   + ", center=yes, status=no";
	
	var iWindex = aChildWin.length;
	var sWinName;
	
	if (name) {
		sWinName = name;
	} else {
		sWinName = "win" + iWindex.toString();
	}
	
	aChildWin[iWindex] = window.open(url, sWinName, sProperties);
	aChildWin[iWindex].opener = window.self;
	
	return aChildWin[iWindex];
}

function getJsDate(USDateString) {
	var arrDtParts = USDateString.split("/");
	var dt = null;
	
	try {
		dt =  new Date(arrDtParts[2], (arrDtParts[0] - 1), arrDtParts[1]);
	} catch(e) {
		return null;
	}
	
	return dt;
}

function validateDate(dateString) {
	var oRE = /^\d\d\/\d\d\/\d\d\d\d$/;
	
	if (oRE.test(dateString)) {
		var dt = getJsDate(dateString);
		return (dt != null);
	}
	
	return false;
}

function calculateAge(Birthday) {
	var dtNow = new Date();
	var iYears = dtNow.getFullYear() - Birthday.getFullYear();
	var iBirthMonth = Birthday.getMonth();
	var iBirthDay = Birthday.getDay();
	var iNowMonth = dtNow.getMonth();
	var iNowDay = dtNow.getDay();
	
	if (iNowMonth > iBirthMonth) {
		return iYears;
	} else {
		if (iNowDay > iBirthDay) {
			return iYears;
		} else {
			return iYears - 1;
		}
	}
}

function findPosition(item) {
	if (item.offsetParent) {
		
		for( var posX = 0, posY = 0; item.offsetParent; item = item.offsetParent ) {
			posX += item.offsetLeft;
			posY += item.offsetTop;
		}
		
		return [ posX, posY ];
		
	} else {
		
		return [ item.x, item.y ];
		
	}
}

function findBrowserDimensions() {
	var width = 0;
	var height = 0;
	
	if (typeof(window.innerWidth) == 'number') {
		//Non-IE
		width = window.innerWidth;
		height = window.innerHeight;
	} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
		//IE 6+ in 'standards compliant mode'
		width = document.documentElement.clientWidth;
		height = document.documentElement.clientHeight;
	} else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
		//IE 4 compatible
		width = document.body.clientWidth;
		height = document.body.clientHeight;
	}
	
	return [ width, height ];
}

function findBrowserOffset() {
	var width = 0;
	var height = 0;
	
	if (typeof(window.pageYOffset) == 'number') {
		//Netscape compliant
		width = window.pageXOffset;
		height = window.pageYOffset;
	} else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) {
		//DOM compliant
		width = document.body.scrollLeft;
		height = document.body.scrollTop;
	} else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
		//IE6 standards compliant mode
		width = document.documentElement.scrollLeft;
		height = document.documentElement.scrollTop;
	}
	
	return [ width, height ];
}

	function closeAndRefreshParent()
	{
		window.opener.page_form.mode.value="refresh";
		window.opener.page_form.onsubmit();
		window.opener.page_form.submit();
		window.opener.focus();
		window.close();
	}

	
	function parentPageJump(path)
	{
		window.opener.location=path;
		window.opener.focus();
		window.close();
	}
	
	function replaceIt(sString, sReplaceThis, sWithThis) { 
		if (sReplaceThis != "" && sReplaceThis != sWithThis) { 
			var counter = 0; 
			var start = 0; 
			var before = ""; 
			var after = ""; 
			while (counter<sString.length) { 
				start = sString.indexOf(sReplaceThis, counter); 
				if (start == -1) { 
					break; 
				} else { 
					before = sString.substr(0, start); 
					after = sString.substr(start + sReplaceThis.length, sString.length); 
					sString = before + sWithThis + after; 
					counter = before.length + sWithThis.length; 
				} 
			} 
		} 
		return sString; 
	} 
//-->

<!--
	var keyTimer = null;
	
	function keyMouseOut() {
		keyTimeout(1000);
	}
	
	function keyMouseOver() {
		clearTimeout(keyTimer);
	}
	
	function keyTimeout(time) {
		keyTimer = setTimeout("keyHideAll()", time);
	}
	
	function keyHideAll() {
		var key = document.getElementById("key");
		var child = key.firstChild;
		while ( child != null ) {
			if ( child.nodeType == 1 ) {
				if (child.getAttribute("id") != null) {
					switch(child.getAttribute("id")) {
						case "iconKey":
						case "ratingKey":
							child.className = "isHidden";
							break;
					}
				}
			}
			child = child.nextSibling;
		}
	}
	
    function keyShow(icon, legend) {
		keyMouseOver();
		keyHideAll();
		keyTimeout(4000);
		
		// Get key and icon
		var key = document.getElementById(legend);
		
		// Get Browser Height and Width
		var browserDimensions = findBrowserDimensions();
		var browserOffset = findBrowserOffset();
		
		// Set up positioning
		var position = findPosition(icon);
		var intOffsetTop = 15 + position[1];
		var intOffsetBottom = position[1] - key.offsetHeight - 10;
		var intOffsetLeft = 15 + position[0];
		var intOffsetRight = position[0] - key.offsetWidth;

		if (position[1] + key.offsetHeight >= (browserDimensions[1] * 1.15) + browserOffset[1]) {
			key.style.top = intOffsetBottom + "px";
		} else {
			key.style.top = intOffsetTop + "px";
		}
		if (position[0] >= (browserDimensions[0] / 2)) {
			key.style.left = intOffsetRight + "px";
		} else {
			key.style.left = intOffsetLeft + "px";
		}

		// Make visibile
		key.className = "isVisible";
	}

	function closeBoxOver(item) {
		item.className = "closeBoxHover";
	}
	
	function closeBoxOut(item) {
		item.className = "closeBox";
	}
//-->