function removeText(nFormID, nFieldID, nFieldValue) {
	if (document.forms[nFormID].elements[nFieldID].value == nFieldValue) {
		document.forms[nFormID].elements[nFieldID].value = '';
	}
}

function enterText(nFormID, nFieldID, nFieldValue) {
	if(document.forms[nFormID].elements[nFieldID].value == '') {
		document.forms[nFormID].elements[nFieldID].value = nFieldValue;
	}
}

function toggle(list){ 
	var listElementStyle=document.getElementById(list).style; 
	if (listElementStyle.display=="none"){ 
		listElementStyle.display="block"; 
	} else {
		listElementStyle.display="none"; 
	} 
}
function reloadList(lstToLoad, curIndex) { // pass in the current index
  if ( curIndex < 0 ) return;  // nothing selected, so do nothing
  //document.forms['checkout'].destination.value = document.forms['checkout'].shippingCountry.options[document.forms['checkout'].shippingCountry.selectedIndex].text;
  var lst = document.getElementById(lstToLoad);
  var master = document.getElementById('master').options;
  var aryOptions = lst.options;  // points to list options array
  aryOptions.length=0;  // first, clear the current options ...
  // then re-load the options with values for the current index
  for ( var i=0,n=master.length; i<n; i++ ){
    if (master[i].value == curIndex){
      var optionText = master[i].text;
      var aryText = optionText.split('|');      
      aryOptions.length++;  // add a new Option, then put data in it
      aryOptions[aryOptions.length-1].text  = aryText[1];
      aryOptions[aryOptions.length-1].value = aryText[0];
    }
  }
}
function goToPage(pageid)
{
 if (pageid == 0){
   document.forms['products'].d.value = '';
   document.forms['products'].b.value = '';
   document.forms['products'].pg.value = 1;
 } else {
  document.forms['products'].pg.value = pageid;
 }
 document.forms['products'].submit();
}
function filterByDept(deptname)
{
 document.forms['products'].d.value = deptname;
 document.forms['products'].submit();
}
function filterByBrand(brandname)
{
 document.forms['products'].b.value = brandname;
 document.forms['products'].submit();
}
