<!-- //

imageFlag = 0
function setFlag()  {
   imageFlag = 1
}

function searchEntry(obj){
	var nullFlag = 1
	if (obj.PRODCAT.selectedIndex > 1) {
		nullFlag = 0
	}
	if (obj.COMBO1.selectedIndex > 1) {
		nullFlag = 0
	}
	if (obj.COMBO3.selectedIndex > 1) {
		nullFlag = 0
	}
	if (obj.TEXTBOX1.value != "") {
		nullFlag = 0
	}
	if (obj.SKU.value != ""){
		nullFlag = 0
	}
	frm = obj
	i = 1
	arWebCat = frm.COMBO1.length
	strWebList = ""
	for (i=1;i<arWebCat;i++)  {
		if (strWebList == "") {
			strWebList += frm.COMBO1.options[i].value 
		}else{
			strWebList += "!" + frm.COMBO1.options[i].value 
		}     
	}
	
	frm.HID_WEBLIST.value = strWebList   
	
	if (nullFlag == 1){   
		alert("Due to our extensive product line, please make a selection\nfrom one of the lists provided to narrow your search.")	
		return false
	}else{
		return true
	}
}

function smsDcount(string, delim)  {
  var cnt = 0;
  var val = "" + string;
  if (val.length > 0)   {
    var ind  = 0;
    var next = 0;
    var chr  = "" + delim;
    while ((ind = val.indexOf(chr, next)) >= 0)  {
      cnt++;
      next = ind + chr.length;
      if (next >= val.length)
        break;
    }
    cnt++;
  }
  return ( cnt );
}


function popSubCat(obj){
	var frm = obj.form
	var objValue = obj[obj.selectedIndex].value
	if (objValue == "ALL") {
		// changed it from something back to all
		frm.COMBO1.options.length = 1
		frm.COMBO1.options[0].text = '-- All --'
		frm.COMBO1.options[0].value = 'ALL'
		frm.COMBO1.options[0].selected = 1
	} else {
		var hid_string = frm.HID_WEB_CAT.value
		timez = smsDcount(field(hid_string,'|',1),'!')
		var pos = 0
		for (var i=1 ; i <= timez ; i++) {
			if (field(field(hid_string,'|',1),'!',i) == objValue) {	   
				pos = i
				break
			}
		}
		// the next line clears all the existing options
		frm.COMBO1.options.length = 0
		frm.COMBO1.options[0] = new Option('-- All --','ALL','',1)
		if (pos == 0) {
			// this should never happen
			return
		}
		var strStringToPass = ""
		timez = smsDcount(field(field(hid_string,'|',2),'!',pos),'~')
		for (var i=1 ; i <= timez ; i++) {
			text = field(field(field(hid_string,'|',3),'!',pos),'~',i)
			value = field(field(field(hid_string,'|',2),'!',pos),'~',i)
			//	   strStringToPass = strStringToPass + text + '~' + value + '|'
			if (strStringToPass == "") {
				strStringToPass = text + '~' + value
			}else{
				strStringToPass = strStringToPass + '|' + text + '~' + value
			}
			frm.COMBO1.options[i] = new Option(text,value)
		}
	}
	
	// annoying little trap for Netscape to refresh the page
 	//if (navigator.appName == "Netscape") {
  	if (navigator.appName == "Netscape") {
		// 3/2/01 rer begin
		//history.go(0)
		//strProductValue = frm.PRODCAT.value
		//location.href = "ic294frm.asp?HID_WEBLIST=" + strStringToPass
		frm.HID_WEBLIST.value = strStringToPass
		//frm.action = "ic294frm.asp"
		//frm.submit()
		// 3/2/01 rer end
	}
}

function field(textValue,delim,occurance) {
   var startPos = 0
   var endPos = ''     
   var chunk = ''
   for (var i=1; i <= occurance; i++) {
     endPos = textValue.indexOf(delim,startPos)
     if (endPos == -1) {
       // delimeter not found
       endPos = textValue.length
       if (startPos >= textValue.length) {
         // this means that it is past the last field
         chunk = ""
         break
       }
     }
     chunk = textValue.substring(startPos,endPos)
     startPos = endPos + 1
   }
   return chunk;
}
// -->