// eCommerce JavaScript

/* function used in the product pages to pull the content from cnet */

var menuItems = new Array("shortSpecs","overview","extendedSpecs");
var menuContent = new Array("shortSpecsContent","overviewContent","specsContent");




function resetMenu(){
	for (i=0; i<menuItems.length; i++){
		if(menuItems[i]){
			document.getElementById(menuItems[i]).className = "productInfo";
		}
		else {
			document.getElementById(menuItems[i]).className = "productInfo";
			document.getElementById(menuItems[i]).style.display = "none";
		}
		document.getElementById(menuContent[i]).style.display = "none";
		document.getElementById(menuContent[i]).style.visibility= "hidden";
	}
}
	
	
function defineContent(thisContent)	{
	 resetMenu();
	for (j=0; j<menuItems.length; j++){
		if(thisContent == menuItems[j]){
			document.getElementById(menuItems[j]).className = "productInfoInactive";
			document.getElementById(menuContent[j]).style.display = "block";
			document.getElementById(menuContent[j]).style.visibility = "visible";
		} else if (menuItems[j]) {
			document.getElementById(menuItems[j]).className = "productInfo";
			document.getElementById(menuContent[j]).style.display = "none";
			document.getElementById(menuContent[j]).style.visibility= "hidden";
		} else {
			document.getElementById(menuItems[j]).style.display = "none";
		}
	}
}
	
	
	
/* function used for the search */

function findString(value){
	document.partDescSearch.sp_q.value = value;
}

function whichSite(){
	var whichSearch = document.partDescSearch.searchSelect;
    var thisSearch = whichSearch.options[whichSearch.selectedIndex].value;
	
	if(thisSearch == "ecommerce"){
		document.partDescSearch.action = "/exec/partDescSearch.tsb";
		document.partDescSearch.method = "post";
		}
		
	if(thisSearch == "corporate"){
		document.partDescSearch.action = "http://www.bellmicro.com/bellmicro/search.asp";
		document.partDescSearch.method = "get";
		}
}

function checkEnter(e,formName){ //e is event object passed from function invocation
var characterCode // literal character code will be stored in this variable

if(e && e.which){ //if which property of event object is supported (NN4)
e = e;
characterCode = e.which; //character code is contained in NN4's which property
}
else{
e = event;
characterCode = e.keyCode; //character code is contained in IE's keyCode property
}

if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
var currentForm = eval("document."+ formName);
currentForm.submit(); //submit the form
return false;
}
else{
return true;
}

}


function resetSelectBoxes(){
	document.partDescSearch.searchSelect.value = "ecommerce";
}

function resetForm() {
	document.onload = resetSelectBoxes();
}


// for pop up windows

function popUp(URL) {
window.open(URL, "toolbar=0 ,scrollbars=1, location=0, status=0, menubar=0, resizable=1, width=300, height=300, left = 490, top = 362");
}

//popup window for ccv on add credit card
function showCCV() {
	ccv = window.open("/velo/ccv/ccv.html", "ccvInfo", "toolbar=0,locationbar=0,statusbar=0,menubar=0,scrollbars=1,resizable=1,width=430,height=550,left=25,top=25,titlebar=1")
	ccv.focus()
}

function numsPopUp(URL) {
	numsDetail = window.open(URL, "orderDetails", "toolbar=0,locationbar=0,statusbar=0,menubar=0,scrollbars=1,resizable=1,width=330,height=700,left=25,top=25,titlebar=1")
	numsDetail.focus()
}