
	
// JavaScript Document

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;
	}

}


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="
  url = "http://catalog.precisionfinishinginc.com/keyword/?&plpver=10&key=all&keycateg=100"
  url = url + "&SchType=2";
  url = url + "&keyword=" + encodeURI(theSearchText.value);
  url = url + "&refer=" + encodeURI("http://" + document.location.hostname);

  document.location.href = url;
 }
}

function emptyField(thisField) {
	if (thisField.defaultValue == thisField.value) thisField.value = "";
}
function fillField(thisField) {
	if (thisField.value == "") thisField.value = thisField.defaultValue;
}	


sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

