path = "arrowchem/web.nsf"
function srch(fieldtouse){
//alert("a")
var searchstring = document.getElementById(fieldtouse).value
if(fieldtouse == "freesearch" || fieldtouse == "freesearch2"){
view = "$searchview"
}
else
{
view = "msdssearchview"
}
if ( searchstring !="") 
{
location.href=("\/"+path+"/"+view+"?SearchView&Query=*"+searchstring+"*&SearchOrder=4");
return false;
}
else{ 
alert("Please enter a search value"); 
searchstring.focus;
//return false;
}
}
  function doClick(buttonName,fld,e)
    {
//the purpose of this function is to allow the enter key to 
//point to the correct button to click.
        var key;
         if(window.event)
              key = window.event.keyCode;     //IE
         else
              key = e.which;     //firefox
    
        if (key == 13)
        {
            //Get the button the user wants to have clicked
            var btn = document.getElementById(buttonName);
            if (btn != null)
            { //If we find the button click it
                srch(fld);
            //    event.keyCode = 0
            }
        }
   }
function lookupdrown(fld)
{
var selindex = document.getElementById(fld).options.selectedIndex;
if ( document.getElementById(fld).options[selindex].text =="Select a Product") 
	{
	alert ("Please Select a Product.");
	document.getElementById(fld).focus();
	}
else{
value = document.getElementById(fld).options[selindex].value;
	if(fld=="prodDD"){
	location.replace("/"+path+"/LPCC/"+value) ;
	}
	else{	
	location.replace("/"+path+"/msdsrequest!openform&name="+document.getElementById(fld).options[selindex].text) ;
//window.open( "/"+path+"/0/"+strRight(value, '|')+"/$file/"+strLeft(value, '|')+"!openelement") ;
	}
}
}
//@Left equivalent
function strLeft(sourceStr, keyStr){
return (sourceStr.indexOf(keyStr) == -1 | keyStr=='') ? '' : sourceStr.split(keyStr)[0];
}
//@Right equivalent
function strRight(sourceStr, keyStr){
idx = sourceStr.indexOf(keyStr);
return (idx == -1 | keyStr=='') ? '' : sourceStr.substr(idx+ keyStr.length);
}
