<!-- //hide from ancient browsers.

/*
	For some reason the original developer(s) wrote the site so that every
	form submit uses JavaScript and each one has a different name so I put
	all of the form submit functions into this centralized file to get the
	JavaScript off of each page since it doesn't belong there.
	At some point in time this needs to be changed so that NONE of the forms
	use JavaScript to submit. They will be commented out as they are
	replaced with standard form buttons (and/or links). Some of the forms
	are nothing more than text links which should be treated as such.
*/

// ==================================================================
// Login
// ==================================================================
//function doLoginSubmit()
//{
//	document.loginForm.submit();
//}

// ==================================================================
// Login Help
// ==================================================================

function doLoginHelpSubmit()
{
	document.loginHelpForm.submit();
}

// ==================================================================
// Request Access
// ==================================================================
function doAccessSubmit()
{
	document.accessForm.submit();
}



// ==================================================================
// Existing Customers
// ==================================================================
var submitted=false;
function doSelectCustSubmit()
{
	if (!submitted) {
		document.selectCustForm.submit();
		submitted = true;
	}
}



// ==================================================================
// Product Search box
// ==================================================================
function doLeftNavSearchSubmit()
{
	document.leftNavSearchForm.oemPart.value=document.leftNavSearchForm.text.value;
	document.leftNavSearchForm.submit();
}

function submitenter(myfield,e)
{
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;

	if (keycode == 13)
		{
			doLeftNavSearchSubmit();
			return false;
		}
	else
	return true;
}

// ==================================================================
// partSearchOptions
// ==================================================================

function doAlphaSearchSubmit(letter)
{
	document.alphaSearchForm.selectedLetter.value=letter;
	document.alphaSearchForm.submit();
}

function doTextSearchSubmit()
{
  	 document.textSearchForm.selectedSystem.value=document.textSearchForm.systemTypes.options[document.textSearchForm.systemTypes.selectedIndex].text;
	 document.textSearchForm.submit();
}

function doOEMSearchSubmit()
{
	document.oemSearchForm.submit();
}


// ==================================================================
// Shopping home
// ==================================================================
function doPartTypeSearchSubmit(pType,pTypeDesc)
{
	document.partTypeSearchForm.partType.value=pType;
	document.partTypeSearchForm.partTypeName.value=pTypeDesc;
	document.partTypeSearchForm.submit();
}

function doAccessorySearchSubmit(aType, aTypeID)
{
	document.accessorySearchForm.accessoryType.value=aType;
	document.accessorySearchForm.accessoryTypeID.value=aTypeID;
	document.accessorySearchForm.submit();
}

// ==================================================================
// partsLanding.jsp
// ==================================================================


function doPartCatSubmit(catName,descName)
{
	document.partTypeSearchForm.partType.value=catName;
	document.partTypeSearchForm.partDesc.value=descName;
	document.partTypeSearchForm.submit();
}


// ==================================================================
// partProductDetail.jsp
// ==================================================================

function doAddPartToCart()
{
	document.partDetailForm.action="addCurrentItemToCart.htm";
	document.partDetailForm.submit();
}


// ==================================================================
// partTypeResultSet.jsp
// ==================================================================

function doMoreDetail(pIndex)
{
	document.resultSetForm.selectedPart.value=pIndex;
	document.resultSetForm.action="viewMoreDetail.htm";
	document.resultSetForm.submit();
}

function doAddToCart(pIndex)
{
	document.resultSetForm.selectedPart.value=pIndex;
	document.resultSetForm.action="addToCart.htm";
	document.resultSetForm.submit();
}

function doSelectRelatedPart(pIndex)
{
	document.relatedPartForm.selectedPart.value=pIndex;
	document.relatedPartForm.action="viewRelatedPartCategory.htm";
	document.relatedPartForm.submit();
}

function doViewQuestion1Submit()
{
	document.question1Form.submit();
}

function doViewQuestion2Submit()
{
	document.question2Form.submit();
}

function doViewQuestion3Submit()
{
	document.question3Form.submit();
}

function doViewQuestion4Submit()
{
	document.question4Form.submit();
}

function doViewQuestion5Submit()
{
	document.question5Form.submit();
}

// ==================================================================
// partTypeResultSetQuestions.jsp
// ==================================================================
function doQuestion1Submit(index)
{
	document.question1Form.answer1Index.value=index;
	document.question1Form.submit();
}

// ==================================================================
// partTypeResultSetQuestions2.jsp
// ==================================================================
function doQuestion2Submit(index)
{
	document.question2Form.answer2Index.value=index;
	document.question2Form.submit();
}

// ==================================================================
// partTypeResultSetQuestions3.jsp
// ==================================================================
function doQuestion3Submit(index)
{
	document.question3Form.answer3Index.value=index;
	document.question3Form.submit();
}

// ==================================================================
// partTypeResultSetQuestions4.jsp
// ==================================================================
function doQuestion4Submit(index)
{
	document.question4Form.answer4Index.value=index;
	document.question4Form.submit();
}

// ==================================================================
// partTypeResultSetQuestions5.jsp
// ==================================================================
function doQuestion5Submit(index)
{
	document.question5Form.answer5Index.value=index;
	document.question5Form.submit();
}

// ==================================================================
// relatedPartsResultSet.jsp
// ==================================================================
function doMoreDetailForRelatedPart(pIndex)
{
	document.resultSetForm.selectedPart.value=pIndex;
	document.resultSetForm.action="viewMoreDetailForRelatedPart.htm";
	document.resultSetForm.submit();
}

function doAddRelatedPartToCart(pIndex)
{
	document.resultSetForm.selectedPart.value=pIndex;
	document.resultSetForm.action="addRelatedPartToCart.htm";
	document.resultSetForm.submit();
}

// ==================================================================
// text_search.jsp
// ==================================================================
function doTextPartSubmit(pType, pCode)
{
	document.textPartForm.textPart.value=pType;
	document.textPartForm.partCode.value=pCode;
	document.textPartForm.submit();
}

function doTextAccessorySubmit(aType)
{
	document.textAccessoryForm.textAccessory.value=aType;
	document.textAccessoryForm.submit();
}

function doTextPageChangeSubmit(pageNum)
{
	document.textPageChangeForm.pageNumber.value=pageNum;
	document.textPageChangeForm.submit();
}

// ==================================================================
// alpha_search.jsp
// ==================================================================

function doAlphaPartSubmit(pType, pCode)
{
	document.alphaPartForm.alphaPart.value=pType;
	document.alphaPartForm.partCode.value=pCode;
	document.alphaPartForm.submit();
}

function doAlphaAccessorySubmit(aType)
{
	document.alphaAccessoryForm.alphaAccessory.value=aType;
	document.alphaAccessoryForm.submit();
}

function doAlphaPageChangeSubmit(pageNum)
{
	document.alphaPageChangeForm.pageNumber.value=pageNum;
	document.alphaPageChangeForm.submit();
}

// ==================================================================
// oem_search.jsp
// ==================================================================


function doOEMPartSubmit(pType, pCode, psku)
{
	document.oemPartForm.oemPart.value=pType;
	document.oemPartForm.partCode.value=pCode;
	document.oemPartForm.sku.value=psku;
	document.oemPartForm.submit();
}

function doOEMAccessorySubmit(aIndex)
{
	document.oemAccessoryForm.oemAccessory.value=aIndex;
	document.oemAccessoryForm.submit();
}

function doOEMPageChangeSubmit(pageNum)
{
	document.oemPageChangeForm.pageNumber.value=pageNum;
	document.oemPageChangeForm.submit();
}






// ==================================================================
// vehiclesManage.jsp
// ==================================================================

function doVehicleDeleteSubmit(vIndex)
{
	document.vehicleDeleteForm.vehicleIndex.value=vIndex;
	document.vehicleDeleteForm.submit();
}
// ==================================================================
// accessoriesQuestions1.jsp
// ==================================================================

function doAccessorySubmit(aType)
{
	document.accessoryLinkQuestionsForm.answerIndex.value=aType;
	document.accessoryLinkQuestionsForm.submit();
}


// ==================================================================
// accessoriesResults.jsp
// ==================================================================

function doMoreDetailAccessory(pIndex)
{
	document.accessoryResultSetForm.selectedPart.value=pIndex;
	document.accessoryResultSetForm.action="viewMoreDetailForAccessory.htm";
	document.accessoryResultSetForm.submit();
}

function doAddAccessoryToCart(pIndex)
{
	document.accessoryResultSetForm.selectedPart.value=pIndex;
	document.accessoryResultSetForm.action="addAccessoryToCart.htm";
	document.accessoryResultSetForm.submit();
}

// ==================================================================
// accessoryProductDetail.jsp
// ==================================================================

function doAddAccessoryToCart2()
{
	document.accessoryDetailForm.action="addCurrentItemToCart.htm";
	document.accessoryDetailForm.submit();
}

// ==================================================================
// header.jsp
// ==================================================================
if (readCookie("showYourPriceCookie") == "" || readCookie("showYourPriceCookie") == "true") {
	createCookie("showYourPriceCookie", "true", 30)
	showYourPrice = true;
} else {
	createCookie("showYourPriceCookie", "false", 30)
	showYourPrice = false;
}

function doShowYourPrice() {
	var yourPriceDivName = "yourPriceDiv";
	var listPriceDivName = "listPriceDiv";
	var yourPriceDivElements = getElementsByName_iefix("div", yourPriceDivName);
	var listPriceDivElements = getElementsByName_iefix("div", listPriceDivName);
	var state = "";

	// Check for true or empty values from hidden input populated with cookie value, assign new
	// DIV display, hidden value and command link accordingly
	if (showYourPrice) {
		yourPriceDivState = "none";
		listPriceDivState = "block";
		showYourPrice = false;
		document.getElementById("yourPriceLink").innerHTML = "Show Your Price";
	} else {
		yourPriceDivState = "block";
		listPriceDivState = "none";
		showYourPrice = true;
		document.getElementById("yourPriceLink").innerHTML = "Hide Your Price";
	}

	// Change DHTML display value in all DIVs
	for (i = 0; i < yourPriceDivElements.length; i++) {
		yourPriceDivElements[i].style.display = yourPriceDivState;
	}
	for (i = 0; i < listPriceDivElements.length; i++) {
		listPriceDivElements[i].style.display = listPriceDivState;
	}

	// Cookies Code
	createCookie("showYourPriceCookie", showYourPrice, 30);

}

function createCookie(name, value, days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
		var expires = "; expires="+date.toGMTString();
	}
	else {
		var expires = "";
	}
	document.cookie = name + "=" + value + expires + "; path=/";
}

function readCookie(name) {
	if (document.cookie.length > 0) {
		start = document.cookie.indexOf(name + "=");
  		if (start != -1) {
    		start = start + name.length + 1;
    		end = document.cookie.indexOf(";", start);
    		if (end == -1) {
    			end = document.cookie.length;
    		}
    		return unescape(document.cookie.substring(start, end));
    	}
  	}
	return "";
}

function getElementsByName_iefix(tag, name) {

     var elements = document.getElementsByTagName(tag);
     var myArray = new Array();
     for(i = 0,iarr = 0; i < elements.length; i++) {
          att = elements[i].getAttribute("name");
          if(att == name) {
               myArray[iarr] = elements[i];
               iarr++;
          }
     }
     return myArray;
}


// ==================================================================
// shopping_cart.jsp
// ==================================================================
function doMoreDetailFromCart(pIndex)
{
	document.shoppingCartForm.selectedPart.value=pIndex;
	document.shoppingCartForm.action="viewMoreDetailInCart.htm";
	document.shoppingCartForm.submit();
}

function doChangeQuantity(pIndex, qty)
{
	<!-- alert(qty); -->
	document.shoppingCartForm.selectedPart.value=pIndex;
	document.shoppingCartForm.quantity.value=qty;
	document.shoppingCartForm.action="changeQuantity.htm";
	document.shoppingCartForm.submit();
}

function doRemoveItem(pIndex)
{
	document.shoppingCartForm.selectedPart.value=pIndex;
	document.shoppingCartForm.action="removeItem.htm";
	document.shoppingCartForm.submit();
}

function doRelatedParts(pIndex)
{
	document.shoppingCartForm.selectedPart.value=pIndex;
	document.shoppingCartForm.action="viewRelatedParts.htm";
	document.shoppingCartForm.submit();
}







// ==================================================================
// how_to_buy.jsp
// ==================================================================
function doZipSend()
{
	document.form1.submit();
}

function doCountrySend()
{
	document.form2.submit();
}

// ==================================================================
// contact_us.jsp
// ==================================================================
function doContactUsSubmit()
{
	document.contactUsForm.submit();
}

// ==================================================================
// order_summary.jsp
// ==================================================================

function doProcessOrderSubmit()
{
	document.processOrderForm.submit();
}

// ==================================================================
// order_status_history.jsp
// ==================================================================

function doViewOrderDetail(ordIndex)
{
	document.selectOrderForm.selectedOrder.value=ordIndex;
	document.selectOrderForm.action="viewOrderHistoryDetail.htm";
	document.selectOrderForm.submit();
}
// ==================================================================
// user_administration.jsp
// ==================================================================

function doEditUser()
{
	document.selectCustForm.action="viewEditUser.htm";
	document.selectCustForm.submit();
}


function confirmation() {
	var answer = confirm("Leave tizag.com?")
	if (answer){
		alert("Bye bye!")
		window.location = "http://www.google.com/";
	}
	else{
		alert("Thanks for sticking around!")
	}
}


function doDeleteUser()
{
	var radioSelected = false;

	for (counter = 0; counter < document.selectCustForm.currentUser.length; counter++)
	{
		if (document.selectCustForm.currentUser[counter].checked)
		radioSelected = true;
	}

	if (!radioSelected)
	{
		alert("Hang on quickdraw, first you need to select a user to delete.")
		return (false);
	}

	var answer = confirm('Are you sure you want to delete the selected user?');

	if (answer)
	{
		document.selectCustForm.action="deleteUser.htm";
		document.selectCustForm.submit();
	} else {
		return false;
	}
	return (true);
}












// ==================================================================
// link_user.jsp
// ==================================================================

//function doLinkUserSubmit()
//{
//	document.linkUserForm.submit();
//}


// ==================================================================
// add_user.jsp
// ==================================================================
//function doAddUserSubmit()
//{
//	document.addUserForm.submit();
//}

// ==================================================================
// change_shop.jsp
// ==================================================================

function doDeleteShop()
{
	document.selectShopForm.action='deleteShop.htm';
	document.selectShopForm.submit();
}

function doChangeShop()
{
	document.selectShopForm.action='changeShop.htm';
	document.selectShopForm.submit();
}


// ==================================================================
// Terms & Conditions
// ==================================================================
	function openTCWin(page)
	{
		var path="http://www.autozone.com/terms_conditions/";

		var newWindow = '';

			if (!newWindow.closed && newWindow.location)
			{
				newWindow.location.href = path + page + ".htm";
			} else {
				newWindow = window.open(path + page + ".htm", "TCWin", 'width=800,height=500,left=100,top=100,toolbar=no,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
				if (!newWindow.opener) newWindow.opener = self;
			}

			if (window.focus) {newWindow.focus()}
	}




// ==================================================================
// This one is used by Verisign (secure site seal validation)
// ==================================================================
function popUp(url)
{
	sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=450');
	self.name = "mainWin";
}

// ==================================================================
// This was on every page on the site - I doubt this code is actually
// used for anything on the site but I shall leave it just in case.
// ==================================================================
/* Browser sensing */
/* Set up boolean variables to record the browser type */
var isNS4 = 0;
var isIE4 = 0;
var isNew = 0;

/* Determines the browser name and browser version */
var brow = ((navigator.appName) + (parseInt(navigator.appVersion)));

/* reassign variable depending on the browser */
if (parseInt(navigator.appVersion >= 5)) {isNew = 1}
	else if (brow == "Netscape4")
	{isNS4 = 1;}
		else if (brow == "Microsoft Internet Explorer4")
		{isIE4 = 1;}

//-->