/***************************************************
 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 prepShareThis(title,url,icon)
{
  var cleanupvar = "%26";
  var cleanURL = url.replace(/&/g,cleanupvar);
  
  SHARETHIS.addEntry({title:title,url:cleanURL,icon:icon}, {button:true, offsetTop:5, offsetLEFT:5});
}


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 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;

}