
	
	//===================================================================================
	// Pre-load images if any
	// The image objects aren't actually used anywhere, but it forces the image to preload

	var imgs = new Array();
	imgs[0] = new Image();
	imgs[0].src = "res/new/img/tab2_1_on.gif";
	imgs[1] = new Image();
	imgs[1].src = "res/new/img/popular_searches_off.gif";

	//===================================================================================

	// If tab is an image instead of text
	function tab_hover(obj) {
		var cn = false;
		if(obj.className.match(/_off/)) {
			cn = obj.className.replace(/_off/g, "_hover");
		} else if(obj.className.match(/_hover/)) {
			cn = obj.className.replace(/_hover/g, "_off");
		}
		if(cn) obj.className = cn;
	}

	function tab_select(tabset, tabnum, obj, additional) {
		var x = 1;
		var onoff, tab;

		x = 1;
		while(tab = document.getElementById("tab" + tabset + "_" + x)) {
			onoff = x == tabnum ? "on" : "off";
			tab.className = printf("tab%s_%s tab%s_%s_%s", [tabset, onoff, tabset, x, onoff]);
			document.getElementById("tabcontent" + tabset + "_" + x).className = x == tabnum ? "tab_vis" : "tab_hid";
			x++; 
		}

		if(obj) obj.blur(); // Remove focus from the link

		return false;
	}


	function printf(S, L) { 
		var nS = "";
		var tS = S.split("%s");
		for(var i=0; i<L.length; i++) nS += tS[i] + L[i];
		return nS + tS[tS.length-1]; 
	} 


	// =================== FOR JCP GLOBAL (Close / Open Popular Searches)
	function popularSearches_Toggle() {
		var o = document.getElementById("popular_searches");
		if(o.style.display == "inline") {
			o.style.display = "none";
			document.images['popular_searches_img'].src = "res/new/img/popular_searches_off.gif";
		} else {
			o.style.display = "inline";
			document.images['popular_searches_img'].src = "res/new/img/popular_searches_on.gif";
		}
	}

	function promoToggle(num, obj) {
		var o = document.getElementById("promo" + num);
		if(o.className == "tab_vis") {
			obj.src = obj.src.replace(/_on/, "_off");
			o.className = "tab_hid";
		} else {
			obj.src = obj.src.replace(/_off/, "_on");
			o.className = "tab_vis";
		}

		if(obj) obj.blur();
		return false;
	}


	function arrow(num) {
		var o = document.getElementById("arrow" + num);
		//alert(o.style.background);
		if(!o.style.background || o.style.background.match(/none/)) {
			o.style.background = 'url(res/new/img/arrow2.gif) no-repeat';
		} else {
			o.style.background = "none";
		}
	}