<!--
var GB_ROOT_DIR = "/includes/images/";

function MM_goToURL() { //v3.0
	var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
	for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

function switchMenu(obj,obj2) {
	var el = document.getElementById(obj);
	var txt = document.getElementById(obj2);
	//alert (el.style.display);
	if ( el.style.display != 'none' ) {
		el.style.display = 'none' ;
		txt.innerHTML = "More >>" ;
	}
	else {
		el.style.display = '';
		txt.innerHTML = "Less >>";
	}
}
function switchMenu1(obj, a) {
	var el = document.getElementById(obj);
	//alert (el.style.display);
	if ( el.style.display != 'none' ) {
		el.style.display = 'none' ;
		a.innerHTML = '[view]';
	}
	else {
		el.style.display = '';
		a.innerHTML = '[hide]'
	}
}
function switchProdView(obj1,obj2,obj3) {
	var list = document.getElementById(obj1);
	var grid = document.getElementById(obj2);
	var text = document.getElementById(obj3);
	if ( list.style.display != 'none' ) {
		list.style.display = 'none';
		grid.style.display = '';
		text.innerHTML = "Switch to List View";
	}
	else {
		list.style.display = '';
		grid.style.display = 'none';
		text.innerHTML = "Switch to Grid View";
	}
}
function switchProdNavView(obj1,obj2,obj3) {
	var list = document.getElementById(obj1);
	var grid = document.getElementById(obj2);
	var text = document.getElementById(obj3);
	if ( list.style.display != 'none' ) {
		list.style.display = 'none';
		grid.style.display = '';
		text.innerHTML = "Less >>";
	}
	else {
		list.style.display = '';
		grid.style.display = 'none';
		text.innerHTML = "More >>";
	}
}

function getPageTag() {
	var aPageTags = {
		"index.asp": "H", //home page
		"product.asp": "P",
		"prodlist.asp": "L",
		"skulist.asp": "K",
		"cat.asp": "C",
		"subcat.asp": "S",
		"brands.asp": "B",
		"clearance.asp": "C",
		"new_arrivals.asp": "N",
		"top_sellers.asp": "T",
		"overstock.asp": "O"
	};
	
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	
	if (sPage == "") {
		return "H"; //home page
	}
	else {
		return (sPage in aPageTags) ? aPageTags[sPage] : "U"; //U = undefined/unknown
	}
}

function submitSearch() {
	var form = document.searchForm;
	var searchFor = form.search.value;
	var searchMethod = "";
	if (form.search_method) {
		searchMethod = form.search_method.value;
	}
	if (searchMethod == "keyword") {
		searchFor = applySearhValueFilters(searchFor);
		if (searchFor == false) {
			return false;
		}
	}
	
	var qs;
	var postAddress = "/prodlist.asp?RequestData=CA_Search"; 
	
	qs = "&q=" + escape(searchFor);
	if (form.search_method) {
		qs += "&search_method=" + escape(searchMethod)
	}
	qs += "&tag=ST" + escape(getPageTag());
	
	window.location = postAddress + qs;
	//form.action = postAddress + qs
	//form.submit();
}

function applySearhValueFilters(val) {
	var itemNumPattern= /^\d{8}$/;
	if (itemNumPattern.test(val)) {
		//if (confirm('Is the 8-digit numeric search term you entered a Travers Item #?')) {
		//	val = val.substring(0,2) + '-' + val.substring(2,5) + '-' + val.substring(5,8);
		//}
		if (modalWin('pop_search_itemid.asp', 350, 150)) {
			val = val.substring(0,2) + '-' + val.substring(2,5) + '-' + val.substring(5,8);
		}
	}
	return val;
}

function modalWin(url, width, height) {	
	if (window.showModalDialog) {
		return window.showModalDialog(url, 'popModal', 'dialogWidth:'+width+'px;dialogHeight:'+height+'px');
	} else {
		//window.open(url, 'popModal', 'height='+height+',width='+width+',toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,location=no,modal=yes');
		return false;
	}
} 

function goSS(x,y) {
	var form= document.prod_search_sort;
	var val; 
	if (y == "search") {	
		val = form.sSearch.value;
	} else {
		val = form.sSort.value;	
	}
	alert(x+val);
	form.action = x + escape(val);
	form.submit();
}

function goSearch(x) {
	var f = document.prod_search;
	var val = f.sSearch.value;
	
	val = applySearhValueFilters(val);
	
	f.action = x + escape(val) + "&tag=SC" + escape(getPageTag());
	f.submit();
}

function goSort(x) {
	var f = document.prod_sort;
	var val = f.sSort.value;	
	f.action = x + escape(val);
	f.submit();
}

function changePageSize(x, size) {
	$$('input').invoke('disable');
	document.location = x + size;
}

function remAtt() {
	var form = document.sel_att;
	var sAction = form.action;
	if (form.att.length == undefined) {
		if (form.att.checked) {
			sAction = sAction.replace("%2F%2F%2F%2F"+form.att.value,"");
		}
	}
	else {
		for (var i=0; i < form.att.length; i++) {
			if (form.att[i].checked) {
				sAction = sAction.replace("%2F%2F%2F%2F"+form.att[i].value,"");
			}
		}
	}
	form.action = sAction;
	form.submit();
}

function remAtt_Old() {
	var form = document.sel_att;
	var c_value = "";
	for (var i=0; i < form.att.length; i++) {
		if (!form.att[i].checked) {
			c_value = c_value + "&Attribsel=" + form.att[i].value;
		}
	}
	 
	if (c_value.length>0) {
		form.action = form.action +  c_value;
	} 
	form.submit();
}

function addToCart() {
	
	var form = document.shop_cart;
	var prod_id = form.prod_id.value;
	var qty = form.qty.value;
	
	form.action = "/add_to_cart.asp?prod=" + prod_id + "&qty=" + qty
	if (form.prod_descrip && form.prod_price) {
		form.action += "&descrip=" + escape(form.prod_descrip.value) + "&price=" + escape(form.prod_price.value);
	}
	form.submit();
	//var cart = window.open(postTo + prod + strQty, 'AddToCart', 'width=200, height=77');
	//cart.close(); 
	 return true;
}

function addToCartList(pid) {
	var fName;
	var form = document.getElementById('shop_cart'+pid); 
	var prod_id = form.prod_id.value;
	var qty = form.qty.value;

	form.action = "/add_to_cart.asp?prod=" + prod_id + "&qty=" + qty
	if (form.prod_descrip && form.prod_price) {
		form.action += "&descrip=" + escape(form.prod_descrip.value) + "&price=" + escape(form.prod_price.value);
	}
	form.submit();
	//var cart = window.open(postTo + prod + strQty, 'AddToCart', 'width=200, height=77');
	//cart.close(); 
	 return true;
}

function addToList(pid){
	var form = document.shop_list;
	var selectedListIndex = 0;
	var listname = '';
	var listid = '';
	var newlistname = '';
	
	if (form.shoplistid) {
		selectedListIndex = form.shoplistid.selectedIndex;
		listname = form.shoplistid.options[selectedListIndex].text;
		listid = form.shoplistid.options[selectedListIndex].value;
	}
	newlistname = form.newShopList.value;
	if (selectedListIndex == 0 && newlistname == '') {
			alert("A list must be selected or new list name entered.");
			form.shoplistid.focus();
			return;
	}
	document.location = "/add_to_list.asp?prod=" + escape(pid) +
		"&listname=" + escape(listname) +
		"&listid=" + escape(listid) +
		"&newlistname=" + escape(newlistname);
	//form.submit();
	return false;
}

function getPriceBreakHTML(item_id) {
	var sHTML = '';
	if (priceBreaks.get(item_id)) {
		data = priceBreaks.get(item_id);
		arrData = data.split('^');
		arrData.each(function(pair) {
			arrPair = pair.split('|');
			qbreak = arrPair[0];
			pbreak = arrPair[1];
			sHTML += '<div><span style="font-weight:bold;">Qty ('+qbreak+'+):</span> '+pbreak+'</div>';
		});
	}
	
	return sHTML;
}

function priceBreakTip(item_id) {
	var content = getPriceBreakHTML(item_id);
	new Tip(
		'qbreak_'+item_id,
		content,
		{ title: 'Quantity Breaks for '+item_id,
			//ajax: {url: '/includes/ajax_price_breaks.asp?item='+escape(item_id)},
			//showOn: 'click',
			//closeButton: true,
			//hideOn: { element: 'closeButton', event: 'click'},
			style: 'protoblue',
			stem: 'bottomLeft',
			hook: { tip: 'bottomLeft' }
		}
	);
}

function getYourPriceHTML(item_id) {
	var sHTML = '';
	if (yourPriceBreaks.get(item_id)) {
		data = yourPriceBreaks.get(item_id);
		arrData = data.split('^');
		arrData.each(function(pair) {
			arrPair = pair.split('|');
			qbreak = arrPair[0];
			pbreak = arrPair[1];
			sHTML += '<div><span style="font-weight:bold;">Qty ('+qbreak+'+):</span> '+pbreak+'</div>';
		});
	}
	
	return sHTML;
}

function yourPriceTip(item_id) {
	var content = getYourPriceHTML(item_id);
	new Tip(
		'yourprice_'+item_id,
		content,
		{ title: 'Web Price for '+item_id,
			//ajax: {url: '/includes/ajax_price_breaks.asp?item='+escape(item_id)},
			//showOn: 'click',
			//closeButton: true,
			//hideOn: { element: 'closeButton', event: 'click'},
			style: 'protoblue',
			stem: 'bottomLeft',
			hook: { tip: 'bottomLeft' }
		}
	);
}

function yourPriceTip_AJAX(item_id) {
	new Tip(
		'yourprice_'+item_id,
		{ title: 'Web price for '+item_id,
			ajax: {url: '/includes/ajax_your_price.asp?item='+escape(item_id)},
			style: 'protoblue',
			stem: 'bottomLeft',
			showOn: 'click',
			closeButton: true,
			hideOn: { element: 'closeButton', event: 'click'},
			hook: { tip: 'bottomLeft' }
		}
	);
}

function roundToNext(oFld, roundTo) {
	var num = oFld.value;
	var rounded = '';
	if (num != '' && !isNaN(num)) {
		if (num % roundTo == 0) {
			rounded = num;
		}
		else {
			rounded = (Math.floor(num / roundTo) * roundTo) + roundTo;
		}
	}
	oFld.value = rounded;		
}

function openSendToFriend(sURL) {
	oSendToFriendWin = window.open("/send_page.asp?pageURL="+escape(sURL), "TraversSendToFriend", "width=600,height=550");
	oSendToFriendWin.focus();
}
//-->