/* Main JS FIle */

/* JQuery for the Product Tabs*/
$(document).ready(function() {
	$("div.tabpage").hide();
	$("a.tab").click(function() {
		$("a.tab").removeClass("selected");
		$(this).addClass("selected");
		$("div.tabpage").hide();
		var page = $("body").find("div.tabpage."+$(this).attr("id"));
		page.fadeIn('slow');
		return(false);
	});
	$("a.tab:first").trigger("click");
});

/* Used to Submit the search form from the label href */
function submitsearch() {
	document.search_form.submit();

}

function clearsearch() {
	var sbox = document.getElementById("q");
	
	if (sbox)
		if (sbox.value == "Search") {
			sbox.value = "";
		}
}

/* Main MENU */ 
function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
window.onload = externalLinks;

/* Menu hover hack for IE <=6 */
sfHover = function() {
	var sfEls = document.getElementById("root").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);



/* TOP MENU */
topHover = function() {
	var topEls = document.getElementById("toproot").getElementsByTagName("LI");
	for (var i=0; i<topEls.length; i++) {
		topEls[i].onmouseover=function() {
			this.className+=" tophover";
		}
		topEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" tophover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", topHover);

