
function dwSearchCatalog()
{
 var url;
 var theSearchText = document.getElementById("dwSearchBox");
 if ((theSearchText.value.length < 2) || (theSearchText.value == "Search"))
 {
  alert('Please enter at least two characters.');
  theSearchText.focus();
 }
 else
 {
// Version 2.7 release
// 1. using default Domain, like "orientalmotor.thomasnet.com" in our sample
// 2. using root category shortName, like "all-categories" in our sample
//  url= "http://craftsmens.stage.thomasnet.com/keyword/all-categories?&key=all&keycateg=100&keyprod=&SchType=2&keyword="
 var iIndex =document.getElementById("ddlSearchType").selectedIndex;    
 var sSearchType = document.getElementById("ddlSearchType").options[iIndex].value;  
  url = "http://custompackaging.orlandoproductsinc.com/keyword/all-categories?&plpver=10";
  url = url + "&SchType=" + sSearchType; 
  url = url + "&keyword=" + encodeURI(theSearchText.value);
  url = url + "&refer=" + encodeURI("http://" + document.location.hostname);

  document.location.href = url;
  ddlSearchType
 }
}

//function dwSearchCatalog()  
//{ var url;  
// var theform = document.dwSearchBox;  
//   
//if (theform.keyword.value.length < 2)  
// { alert('Please enter at least two characters.');  
// theform.keyword.focus();   
//}   
//
//else   
//{ var iIndex = theform.ddlSearchType.selectedIndex;   
//var sSearchType = theform.ddlSearchType.options[iIndex].value;   
//
//// Version 2.7 release //   
////1. using default Domain, like "orientalmotor.thomasnet.com" in our sample   
//// 2. using root category shortName, like "all-categories" in our sample   
//
//url = "http://custompackaging.orlandoproductsinc.com/item/all-categories/keyword/?&plpver=10&key=all&keycateg=100"  ; 
//url = url + "&SchType=" + sSearchType;   
//url = url + "&keyword=" + encodeURI(theform.keyword.value);   
//url = url + "&refer=" + encodeURI("http://" + document.location.hostname);   
//
//document.location.href = url;   
//}   
//alert (url);   
//}  
function checkEnter(e){ //e is event object passed from function invocation
 var characterCode;
 
 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)
//  alert('eureka'); //submit the form
  dwSearchCatalog();
  return false;
 }
 else{
  return true;
 }
}
