function goToFindProduct(theform,thePageId) {
  var theName = theform.criteria_name.value;
  var theDepartment = theform.criteria_dep.value;
	
  lochref = 'index.php?pageid='+thePageId+'&filter=Search&criteria=set';

	if (theName != '') {	lochref += '&name=' + theName; }
	if (theDepartment != '') {	lochref += '&dep=' + theDepartment; }

	location = lochref;
}

function ClearFieldValue(theForm) {
	var theFieldValue = theForm.refno.value;
	if (theFieldValue == 'Ref. No.') {
		theForm.refno.value = '';
	}
}

function Populate_ComboBox(theMasterField, theDivId, theLang){
	var ajaxRequest;  // The variable that makes Ajax possible!

	try {
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try {
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Something is wrong with your browser!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById(theDivId);
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
	}
	var cbx_id = document.getElementById(theMasterField).value;
	var queryString = "?cbxid=" +cbx_id+'&lang='+theLang;
	//alert(queryString);
	ajaxRequest.open("GET", "tools/searchproduct/includes/populate_combobox.php" + queryString, true);
	ajaxRequest.send(null); 
}
