// JavaScript Document

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function initButtons (idName, btnName)
{
	var x = document.getElementById(idName);
	if (!x) return;
	var y = x.getElementsByTagName('li');
	for (var i=0;i<y.length;i++)
	y[i].setAttribute("id", btnName + (i+1));
}
window.onload = function() 
{
	initButtons("mainmenu", "mainbutton");
	initButtons("submenu", "subbutton");
}

function clearSearch()
{
  var theForm = document.srch;
  var searchText = theForm.searchText.value;
  if (searchText == "Enter Search")
  {
	theForm.searchText.value="";
  }
}

function resetSearch()
{
  var theForm = document.srch;
  var searchText = theForm.searchText.value;
  if (searchText == "")
  {
	theForm.searchText.value="Enter Search";
  }
}

function Submit()
{    
    if (document.srch.searchText.value==""||document.srch.searchText.value=="Enter Search")
    {
        alert("Enter Part Number or Keyword.");
        return false;
    }    

    window.open("/smartcat/sc_app/default.asp?pagetype=search&prtno=" + document.srch.searchText.value + "&srchtype=prtNo&code=wlinear")
}

function onEnter(ev)
{
	if(ev.keyCode==13)
	{
		Submit()
		return false;
	}
	else
	{
		return true;
	}
}
