//------------------------------------------------------------------
// Detect for non-W3C compliants, if found, set cookie and redirect
//------------------------------------------------------------------

if (!document.getElementById) {
	var existingCookie = GetCookie('netscapeBrow');
	if (existingCookie == null) {
		var expDate = new Date();
		expDate.setTime(expDate.getTime() +  (24 * 60 * 60 * 1000)); 
		SetCookieForPage("netscapeBrow", "1", expDate, "/");
		window.location.href = "non-compliant.shtml";
	}
}

//--------------------------------------------------------------
// getCookieVal and GetCookie purpose make sure we're looking
// at the proper cookie.  Basically, allows for multiple cookies
//--------------------------------------------------------------

function getCookieVal (offset) {  
	var endstr = document.cookie.indexOf (";", offset);  
	if (endstr == -1)    
	endstr = document.cookie.length;  
	return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
	var arg = name + "=";   						//arg = "netscapeBrow="
	var alen = arg.length;  						//alen = length of arg (13)
	var clen = document.cookie.length;  			// clen set to the length of the cookie (16; 'netscapeBrow=yes')
	var i = 0;  
	while (i < clen) {    							//while i < 16
		var j = i + alen;    						// set j = to i + 13
		if (document.cookie.substring(i, j) == arg) // if substring of current cookie (0-13) is equal to the name passed     
		return getCookieVal (j);    				//passes j as 13
		i = document.cookie.indexOf(" ", i) + 1;    
		if (i == 0) break;   
	}  
	return null;
}

//------------------------------------------------------
// Sets the proper values for the cookie.  Allows those
// values to be passed to the function
//------------------------------------------------------

function SetCookieForPage(name, value) { 
	var argValues = SetCookieForPage.arguments;  
	var argNumber = SetCookieForPage.arguments.length;  
	var expires = (argNumber > 2) ? argValues[2] : null;  
	var path = (argNumber > 3) ? argValues[3] : null;  
	var domain = (argNumber > 4) ? argValues[4] : null;  
	var secure = (argNumber > 5) ? argValues[5] : false;  
	var the_cookie = name + "=" + escape (value) + 
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
	((path == null) ? "" : ("; path=" + path)) +  
	((domain == null) ? "" : ("; domain=" + domain)) +    
	((secure == true) ? "; secure" : "");
	document.cookie = the_cookie;
	return null;
}