

function setCookie2(js_cookie_name, js_cookie_value) {
  var js_the_cookie = js_cookie_name + "=" + js_cookie_value + ";path=/;domain=.napaonline.com";
  document.cookie = js_the_cookie;
}

function getCookieValue(js_name)
{
  var js_firstChar, js_lastChar;
  var js_theBigCookie = document.cookie;
  js_firstChar = js_theBigCookie.indexOf(js_name + "=");
  if (js_firstChar != -1) {
    js_firstChar += js_name.length + 1;
    js_lastChar = js_theBigCookie.indexOf(';', js_firstChar);
    if (js_lastChar == js_firstChar)
	return false;
    if (js_lastChar == -1)
	js_lastChar = js_theBigCookie.length;
    return js_theBigCookie.substring(js_firstChar, js_lastChar);
  } 
  else {
    return false;
  }
}

function readCookie(js_name) {
  if (document.cookie == '')
    return false;
  else
    return unescape(getCookieValue(js_name));
}

function clearCookie(js_cookie_name) {
  var js_the_date = new Date("January 01, 1970");
  var js_the_cookie_date = js_the_date.toGMTString();
  var js_the_cookie = js_cookie_name + "=clear;path=/;domain=.napaonline.com;expires=" + js_the_cookie_date;
  document.cookie = js_the_cookie;
  
}

function clearCookie2(js_cookie_name) {
  var js_the_date = new Date("January 01, 1970");
  var js_the_cookie_date = js_the_date.toGMTString();
  var js_the_cookie = js_cookie_name + "=clear;path=/;expires=" + js_the_cookie_date;
  document.cookie = js_the_cookie;
  
}

function notUser() {
	//added by danny lentz for Wrenchead
	var dest;
	if (getCookieValue("PARTNERSHIP_ID") == "3") {
		dest = "http://" + server_name + "/cgi-bin/ncommerce3/WHEnterCmd?partner_id=3&dest=not_user";
	}
	else {
		dest = "http://" + server_name + "/cgi-bin/ncommerce3/ExecMacro/NAPAonline/homepage.d2w/report";
	}
  
	//added by Cory for 1.3
	clearCookie("use_vehicle");
	clearCookie("last_collection_page");

	clearCookie("SESSION_ID"); 
	clearCookie2("NAPAonline_LOGON");
	clearCookie2("HPG_POPUP");
	clearCookie("NAPAonline_AddressID"); 
	clearCookie("NAPAonline_PaymentID"); 
	clearCookie("NAPAonline_MAKE"); 
	clearCookie("NAPAonline_MODEL"); 
	clearCookie("NAPAonline_YEAR"); 
	clearCookie("NAPAonline_ENGINE"); 
	clearCookie("NAPAonline_MakeID"); 
	clearCookie("NAPAonline_ModelID"); 
	clearCookie("NAPAonline_YearID"); 
	clearCookie("NAPAonline_EngineID"); 
	clearCookie("LOGGED_IN");
	clearCookie2("LOGGED_IN");
	clearCookie("NAPAonline_KEYWORD"); 
	clearCookie("NAPAonline_Catalog"); 
	clearCookie("CATEGORY_ID"); 
	clearCookie("SUBCAT_ID"); 
	clearCookie("method"); 
	clearCookie("lastsearch"); 
	clearCookie("PARTNERSHIP_ID");
	clearCookie("PTNR_SESSION");
	clearCookie("nick");
	clearCookie("ship_nick");
	clearCookie("NAPAonline_BillAddressID");
	clearCookie("SC_NAME");
	newUrl = "/cgi-bin/ncommerce3/Logoff?url=" + escape(dest);
	document.location.href = newUrl;
}



function logoff3() {
	/*
	Author: LaDonna Nettles 
	   Date: 08/07/2001
	Comment: This function is identical to the logoff() function except this one
           redirects to the logout.d2w page.
	*/


	//added by LaDonna for 2.0 
	clearCookie("use_vehicle");
	clearCookie("last_collection_page");

	clearCookie("SESSION_ID"); 
	clearCookie("NAPAonline_AddressID"); 
	clearCookie("NAPAonline_PaymentID"); 
	clearCookie("NAPAonline_MakeID"); 
	clearCookie("NAPAonline_ModelID"); 
	clearCookie("NAPAonline_YearID"); 
	clearCookie("NAPAonline_EngineID"); 
	clearCookie("LOGGED_IN");
	clearCookie2("LOGGED_IN");
	clearCookie("STYPE"); 
	clearCookie("NAPAonline_KEYWORD"); 
	clearCookie("NAPAonline_Catalog"); 
	clearCookie("CATEGORY_ID"); 
	clearCookie("SUBCAT_ID"); 
	clearCookie("method"); 
	clearCookie("lastsearch"); 
	clearCookie("PARTNERSHIP_ID");
	clearCookie("PTNR_SESSION");
	clearCookie("nick");
	clearCookie("ship_nick");
	clearCookie("NAPAonline_BillAddressID");
	clearCookie("SC_NAME");
	newUrl = "/cgi-bin/ncommerce3/Logoff?url=" + escape("http://" + server_name + "/cgi-bin/ncommerce3/ExecMacro/NAPAonline/logout.d2w/report");
	document.location.href = newUrl;
}

var nonNum = new Array(81);
nonNum[0] = "a"; nonNum[1] = "b"; nonNum[2] = "c"; nonNum[3] = "d"; nonNum[4] = "e"; nonNum[5] = "f"; nonNum[6] = "g"; nonNum[7] = "h"; nonNum[8] = "i"; nonNum[9] = "j"; nonNum[10] = "k"; nonNum[11] = "l"; nonNum[12] = "m"; nonNum[13] = "n"; nonNum[14] = "o"; nonNum[15] = "p"; nonNum[16] = "q"; nonNum[17] = "r"; nonNum[18] = "s"; nonNum[19] = "t"; nonNum[20] = "u"; nonNum[21] = "v"; nonNum[22] = "w"; nonNum[23] = "x"; nonNum[24] = "y"; nonNum[25] = "z"; nonNum[26] = "A"; nonNum[27] = "B"; nonNum[28] = "C"; nonNum[29] = "D"; nonNum[30] = "E"; nonNum[31] = "F"; nonNum[32] = "G"; nonNum[33] = "H"; nonNum[34] = "I"; nonNum[35] = "J"; nonNum[36] = "K"; nonNum[37] = "L"; nonNum[38] = "M"; nonNum[39] = "N"; nonNum[40] = "O"; nonNum[41] = "P"; nonNum[42] = "Q"; nonNum[43] = "R"; nonNum[44] = "S"; nonNum[45] = "T"; nonNum[46] = "U"; nonNum[47] = "V"; nonNum[48] = "W"; nonNum[49] = "X"; nonNum[50] = "Y"; nonNum[51] = "Z"; nonNum[52] = "!"; nonNum[53] = "@"; nonNum[54] = "#"; nonNum[55] = "$"; nonNum[56] = "%"; nonNum[57] = "^"; nonNum[58] = "&"; nonNum[59] = "*"; nonNum[60] = "("; nonNum[61] = ")"; nonNum[62] = "-"; nonNum[63] = "_"; nonNum[64] = "+"; nonNum[65] = "="; nonNum[66] = "["; nonNum[67] = "]"; nonNum[68] = "{"; nonNum[69] = "}"; nonNum[70] = "\\"; nonNum[71] = "|"; nonNum[72] = ";"; nonNum[73] = "'"; nonNum[74] = "<"; nonNum[75] = ">"; nonNum[76] = ","; nonNum[77] = "?"; nonNum[78] = "/"; nonNum[79] = "\""; nonNum[80] = ":";
	
browser="update_browser";
        bName = navigator.appName;
        bPlatform = navigator.platform;
bVer = navigator.appVersion.substring(0,4); 


for (var i=0; i < nonNum.length; i++)
{
	if (bVer.indexOf(nonNum[i]) != "-1")
		{
		bVer = bVer.substring(0,3);
		}
		}
	if (bName == "Netscape" && bVer >= 4.06 && (navigator.appVersion.toLowerCase().indexOf("macintosh") == -1)) {browser='pc_nn';}

if (bName == "Microsoft Internet Explorer" && bVer >= 4 && (navigator.appVersion.toLowerCase().indexOf("macintosh") == -1)) {browser='pc_ie';}

if (bName == "Netscape" && bVer >= 4.06 && navigator.appVersion.toLowerCase().indexOf("macintosh") != -1){browser='mac_nn';}

if (bName == "Microsoft Internet Explorer" && bVer >= 4 && navigator.appVersion.toLowerCase().indexOf("macintosh") != -1){browser='mac_ie';}

if (browser=='update_browser'){
	window.location.href="http://" + server_name + "/cgi-bin/ncommerce3/ExecMacro/NAPAonline/homepage.d2w/report";
}
if (browser=="pc_ie"){
document.writeln("<LINK REL=\"STYLESHEET\" TYPE=\"text/css\" HREF=\"/css/napa_global_style_pc_ie.css\">");
}
if (browser=="pc_nn"){
document.writeln("<LINK REL=\"STYLESHEET\" TYPE=\"text/css\" HREF=\"/css/napa_global_style_pc_nn.css\">");
}
if (browser=="mac_ie"){
document.writeln("<LINK REL=\"STYLESHEET\" TYPE=\"text/css\" HREF=\"/css/napa_global_style_mac_ie.css\">");
}
if (browser=="mac_nn"){
document.writeln("<LINK REL=\"STYLESHEET\" TYPE=\"text/css\" HREF=\"/css/napa_global_style_mac_nn.css\">");
}


