var cookiesEnabled = false;
var strDNS = document.location.hostname;

var message = "Cookies have been DISABLED on your Web browser. \n The application will not work properly. \n Please follow these steps to enable your browser cookies: \n\n";

var IE5message = "Go to Tools, Internet Options, the Security Tab, click the Custom button and scroll about 1/3 of the way down to see the options for Cookies, and make sure both of the options have 'Enabled' checked.";
var IE6message = "Go to Tools, Internet Options, and click on the Privacy Tab. Click on button 'Default'.";
var Mmessage = "Go to Tools, then Options, and click on the Privacy Tab. In the middle of the screen Click on tab 'Cookies'. Check 'Allow sites to set Cookies.'";
var Nmessage = "Click Edit, then Preferences, then expand the Privacy and Security button by clicking on the arrow to the left, click Cookies and make sure \'Enable all cookies\' is selected.";
var Omessage = "Press 'F12' and Enable Cookies.";

//***********************************************************************
browser=navigator.appName;
details=navigator.userAgent;

//Check for Mozilla browsers
if (browser == "Netscape" && (details.indexOf("Gecko")!=-1) && (details.indexOf("Netscape")==-1)) {browser="Mozilla"};

//Check for Opera 5 browsers
if (details.indexOf("Opera") !=-1) {browser="Opera"};

//Version
if (details.indexOf("Opera") !=-1) {var a=details.indexOf("Opera") + 6; var b=a+4;}
else if (browser.substring(0,4) == "Micr")      {var a=details.indexOf("MSIE") +5 ; var b=a+3;}		//ie
else if (details.indexOf("Mozilla/4.77") !=-1) {var a=8; var b=a+4;}								//mozilla 4
else if (details.indexOf("Netscape6/") !=-1) {var a=details.indexOf("Netscape6") + 8; var b=a+5;}	//netscape 6
//else if (browser.substring(0,4) == "Mozi") {var a=details.indexOf(")") - 3; var b=a+3;}				//ie
			
//create the proper message base on browser type.
if (browser =="Mozilla") {message = message + Mmessage;}
else if (browser =="Opera") {message = message + Omessage;}
else if (browser =="Netscape") {message = message + Nmessage;}
else if (browser.substring(0,4) == "Micr") {
	//document.write("details: " + details + "<br>");
	//document.write("sub: " + details.substring(a,b-2)+ "<br>");
	if (details.substring(a,b-2) == "6"){
		message = message + IE6message;
	}else{
		message = message + IE5message;
	}
}


message = message + "\n\n Your firewall, if any, may also be blocking cookies independently of your browser settings. Check with your system administrator."


//***************************************************************
//***************************************************************
//***************************************************************
function SetCookie(name,value,expires,path,secure) {
	    	document.cookie = name + "=" +escape(value) +
	        ( (expires) ? ";expires=" + expires.toGMTString() + 1000*60*20 : "") +
        	( (path) ? ";path=" + path : "") +
        	( (strDNS) ? ";domain=" + strDNS : "") +
	        ( (secure) ? ";secure" : "");
		    return true
}

function DeleteCookie( name, path ) {
	//if ( GetCookie( name ) ) 
		document.cookie = name + "=" + 
						( ( path ) ? ";path=" + path : "") + 
						( ( strDNS ) ? ";domain=" + strDNS : "" ) + 
						";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}


function GetCookie(strName) {
		if (document.cookie.indexOf(strName) == -1)
		{
   			//alert(message);
			//history.go(-1);
			window.location ="/error.asp?ErrorParam=cookie";
   			return false;
		}else{
			cookieStart = document.cookie.indexOf(strName);
			cookieValStart = (document.cookie.indexOf("=", cookieStart) + 1);
			cookieValEnd = document.cookie.indexOf(";", cookieStart);
			if (cookieValEnd == -1)
				{
				cookieValEnd = document.cookie.length;
				}
			cookieValue = document.cookie.substring(cookieValStart, cookieValEnd);
		}
		if (cookieValue = "True")
		{
			return ("True");
		}
}

//SetCookie('teri','True','','/','');
//GetCookie('teri');
//DeleteCookie('mishka', '/' );


//if (GetCookie('teri'))
//else