/***************************************************
 Drop down Selector Script
****************************************************/
function quickLinks(){
var slct = document.quickLinksForm.qLinks.options[document.quickLinksForm.qLinks.selectedIndex].value;

if (slct == ""){
	}
else {
	location.href=slct;
	}
}



/***************************************************
 determine the x position for each pulldown
 menu based on browser type and width
****************************************************/




// determine width of browser in px
function base_x(){
	var x;
	if(document.all){
		x = document.body.clientWidth;
	} else {
		x = window.innerWidth;
	}
	return x;
}








// determine width of browser in px
function base_y(){
	var y;
	if(document.all){
		y = document.body.clientHeight;
	} else {
		y = window.innerHeigth;
	}
	return y;
}







function bswPopUp(url, name, width, height, scroll) {
	var properties = "scrollbars=" + scroll + ",width=" + width + ",height=" + height;
	var bswPopUpWin = window.open(url, name, properties);
	bswPopUpWin.focus();
}

function clearSearch(ele){

	if(ele.value == "Enter Keyword or Product #"){
		ele.value = "";
	}
	ele.style.color = "#000000";


}

//functions for polls and quizes

function bswOpenQuizResults(f){

	var quiz = null;

	for(var a = 0; a < f.quiz.length;a++){
		if(f.quiz[a].checked){

			quiz = f.quiz[a].value;
		}
	}

	if(quiz != null){

		var w = f.action + "&quiz=" + quiz;
		bswPopUp(w,"quiz",350,350,"no");

	} else {

		alert("Please set an answer and try again.");

	}

	return false;

}

function bswOpenPollResults(f){

	var selected = false;
	var w = f.action;

	for(var a = 0; a < f.poll.length;a++){
		if(f.poll[a].checked){

			w += "&poll=" + f.poll[a].value;
			selected = true;

		}
	}

	if(selected){

		bswPopUp(w,"poll",350,350,"no");

	} else {

		alert("Please set an answer and try again.");

	}

	return false;

}



//functions for search box

// determine width of browser in px
function base_x(){
	var x;
	if(document.all){
		x = document.body.clientWidth;
	} else {
		//if(scrollbars are visible){
			x = window.innerWidth - 20;
		//} else {
		//	x = window.innerWidth;
		//}
	}
	return x;
}

//repositionSearchBox();

function showSearchBox(){
	if (document.getElementById("searchBoxOpen")){
		document.getElementById("searchBtn").src = site_root + "/images/searchbox/seachbox_top_open.gif";
		document.getElementById("searchBoxOpen").style.visibility = "visible";
	}
}
function hideSearchBox(){
	if (document.getElementById("searchBoxOpen")){
		document.getElementById("searchBtn").src = site_root + "/images/searchbox/seachbox_top_closed.gif";
		document.getElementById("searchBoxOpen").style.visibility = "hidden";
	}
}
// position searchbox
function repositionSearchBox(){
	if (document.getElementById("searchBox")){
		document.getElementById("searchBox").style.left=((base_x() - 751)/ 2) + 509;
	}
}




// advanced search


var currentCatID = "0";
function updatePulldown(catID){

	if(currentCatID != null){

		document.getElementById("cat"+currentCatID).style.display = "none";

	}

	document.getElementById("cat"+catID).style.display = "block";
	currentCatID = catID;

}