  // Used to store the part number for the mfg hit count report.
  function capturePart(strPart, strMfg, strDisty, strURL, strPopup, strSessionId) {
    var strHref = new String();

    strHref = "stockcheckhitcount.asp?Part=" + escape(strPart) +
                           "&Mfg=" + escape(strMfg) + "&Disty=" + escape(strDisty) +
                           "&URL=" + escape(strURL) + "&Popup=" + strPopup + "&sessionid=" + escape(strSessionId);
    //alert(strHref);
    // if strPopup == true then call the popup function to open
    //  the url in a new window.
    if (strPopup == "true") {
      popup(strHref,'newwindow');
    }
    else {
      window.location.href = strHref;
    }  
    return false;
  }

  function popup(mylink, windowname) {
    if (! window.focus) {
      return true;
    }
    var href;
    if (typeof(mylink) == 'string') {
      href=mylink;
    }
    else {
      href=mylink.href;
    }
    window.open(href, windowname, "top=100,left=100,scrollbars=yes,toolbar=yes,buttons=yes,scrollbars=yes,location=yes,menubar=yes,resizable=yes,status=yes");
    return false;
  }

	function JStrim(inputString) {
		 // Removes leading and trailing spaces from the passed string. Also removes
		 // consecutive spaces and replaces it with one space. If something besides
		 // a string is passed in (null, custom object, etc.) then return the input.
		 if (typeof inputString != "string") { return inputString; }
		 var retValue = inputString;
		 var ch = retValue.substring(0, 1);
		 while (ch == " ") { // Check for spaces at the beginning of the string
				retValue = retValue.substring(1, retValue.length);
				ch = retValue.substring(0, 1);
		 }
		 ch = retValue.substring(retValue.length-1, retValue.length);
		 while (ch == " ") { // Check for spaces at the end of the string
				retValue = retValue.substring(0, retValue.length-1);
				ch = retValue.substring(retValue.length-1, retValue.length);
		 }
		 while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
				retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
		 }
		 return retValue; // Return the trimmed string back to the user
	} // Ends the "trim" function

	function verifyPart(strPart) {
		// Alerts the user to enter a part number if they click the submit button with a blank search box.
		strPart = JStrim(strPart);
		if (strPart=="") {
			alert("Please enter a complete or partial part number.");
			return false;
		} else if (checkForAlphaNumericChar(strPart) == false) {
			alert("The part number must contain alphanumeric characters.");
			return false;
		} else {
			return true;
		}
	}

	function checkForAlphaNumericChar(inputString) {
		if (typeof inputString != "string") { return inputString; }
		var strTest = /^[a-zA-Z0-9]+$/;
		for (i=0; i<inputString.length; i++) {
			if (strTest.test(inputString.substring(i, i+1))) {
				return true;
			}
		} 
		return false;
	}
	
	function test1(strMsg) {
		alert('test message is: ' + strMsg);
		return true;
	}
	