function which( whichLayer ){ if( whichLayer.style ) return whichLayer; if( document.getElementById ) return document.getElementById( whichLayer ); if( document.all ) return document.all[whichLayer]; if( document.layers ) document.layers[whichLayer]; return null; }
function toggleLayer( whichLayer ) { var vis = which(whichLayer).style;  vis.display = (vis.display==''||vis.display=='block')?'none':'block'; }
function hideLayer( whichLayer ) { which(whichLayer).style.display='none'; }
function showLayer( whichLayer ) { which(whichLayer).style.display='block'; }
function showLayerHideRest(layers, layerName) { for(var x=0;x<layers.length;x++) if (layers[x]==layerName) showLayer(layers[x]); else hideLayer(layers[x]); }
function MM_findObj(n, d) { var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x;}
function MM_showHideLayers() { var i,p,v,obj,args=MM_showHideLayers.arguments; for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2]; if (obj.style) { obj=obj.style; v=(v=='show')?'block':(v=='hide')?'none':v; } obj.display=v; }}
function showHide(id,show) {MM_showHideLayers(id,'',show ? 'show' : 'hide');}
function listBoxSetSelected(listBox, setTo) { var i, vals; for (i=0; i<listBox.options.length; i++) {vals += listBox.options[i].value + ", "; if (listBox.options[i].value == setTo) { listBox.options[i].selected = true; return; }}}
function getRadioValue(radio) { for (i=0;i<radio.length;i++) if (radio[i].checked) return radio[i].value; return null; }
function listGetSelected(listBox) { var obj = document.getElementById(listBox); return obj.options[obj.selectedIndex].value; }
function getCurrentValue(item) { var itemId = document.getElementById(item); return itemId[itemId.selectedIndex].value; }
function setInputValue(itemName, value) { var id = document.getElementById(itemName); id.value = value; }
function importOrig(path){ var i, base, src = "replace.js", scripts = document.getElementsByTagName("script");for (i=0; i<scripts.length; i++){if (scripts[i].src.match(src)){ base = scripts[i].src.replace(src, "");break;}} document.write("<" + "script src=\"" + base + path + "\"></" + "script>");}
function checkItem(fieldName, fieldValue, fieldLength, fieldIsNUll, fieldDescription, allowNull, minLength, maxLength, regExpr) {   var alertMsg = fieldDescription + "\n"; if (allowNull && fieldIsNUll) { alert(alertMsg + "Field is mandatory please provide a value"); return false; } if (fieldIsNUll) return true;    if (fieldLength > maxLength) { alert(alertMsg + "Field should be a maximum of " + maxLength + " characters the current length is " + fieldLength);  return false;   }   if (fieldLength < minLength) { alert(alertMsg + "Field should be a minimum of " + minLength + " characters the current length is only " + fieldLength); return false; } if (regExpr && regExpr.test(fieldValue)) { alert(alertMsg + "Field has invalid characters"); return false; } return true;}
function pagedListSubmitForm(which, val) { if (which == 0) { if(val == null){ document.forms.productSearch.pagedListType.value="sort"; } else { document.forms.productSearch.pagedListType.value=val; } document.forms.productSearch.submit(); } else { if(val == null){ document.forms.productSearch1.pagedListType.value="sort"; } else { document.forms.productSearch1.pagedListType.value=val; } document.forms.productSearch1.submit(); }}
function inList(item, listStr) { var listItems=listStr.split(","); for (var i=0;i<listItems.length; i++) if (listItems[i] == item) return true; return false; }
function openWindow(theURL,winName,features) {window.open(theURL,winName,features);}