var isOn = false;

var ns6 = document.getElementById&&!document.all;
var ie  = document.all;
var ns  = document.layers;

function showMenu(name){
 isOn=false;
 if (ns){	
  document.layers[name].visibility="show";
 }else if(ie){
  obj=eval(name);
  obj.style.visibility="visible";
 }else if (ns6){
  document.getElementById(name).style.visibility="visible";
 }
}

function tryMenu(name){
 if(isOn){
  if(ns){
   hideMenu(name);
  }else if(ie){
   obj = eval(name);
   hideMenu(name);
  }else if(ns6){
   hideMenu(name);
  }
 }
}

function timeMenu(name){
 currentName=name;
 isOn=true;
 if (ns){
  setTimeout('tryMenu(currentName)', 1250);
 }else if(ie){
  obj=eval(name);
  setTimeout('tryMenu(obj)', 1250);
 }else if (ns6){
  setTimeout('tryMenu(document.getElementById(currentName).id)', 1250);
 }
}

function hideMenu(name){
 if (ns){
  document.layers[name].visibility="hide";
 }else if(ie){
  obj=eval(name);
  obj.style.visibility="hidden";
 }else if (ns6){
  document.getElementById(name).style.visibility="hidden";
 }
}

function itemOver(tr) {
 if(document.all){
  tr.style.backgroundColor = "#ffffff";
  tr.style.cursor = 'hand';
 }else if (ns6 || document.all){
  tr.style.backgroundColor='#ffffff';
 }
}

function itemOut(tr) {
 if(document.all){
  tr.style.backgroundColor = "#ccccff";
 }else if (ns6){
  tr.style.backgroundColor='#ccccff';
 }
}

function show(name){
 if (ns){
  document.layers[name].visibility="show";
 }else if(ie){
  obj=eval(name);
  obj.style.visibility="visible";
 }else if (ns6){
  document.getElementById(name).style.visibility="visible";
 }
}

function hide(name){
 if (ns){
  document.layers[name].visibility="hide";
 }else if(ie){
  obj=eval(name);
  obj.style.visibility="hidden";
 }else if (ns6){
  document.getElementById(name).style.visibility="hidden";
 }
}

function imageOff(name, path) { 
  if(document.images){
    document.images[name].src=path;
  }
}

function imageOn(name, path){
  if(document.images){
    document.images[name].src=path;
  }
}

function openWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}

function printPage() {
 if (window.print) {
  setTimeout('window.print();',200);
 } else if(navigator.userAgent.toLowerCase().indexOf("mac") != -1) {
  alert("Press 'Cmd+p' on your keyboard to print article.");
 } else {
  alert("Press 'Ctrl+p' on your keyboard to print article.");
 }
}

function reloadPage(){
  document.location.reload();
}

function resetForm(form){
 form.reset();
}

function submitForm(form, location){
 form.action=location;
 form.submit();
}

function printArticle() {
 if (window.print) {
  setTimeout('window.print();',200);
 } else if(agt.indexOf("mac") != -1) {
  alert("Press 'Cmd+p' on your keyboard to print article.");
 } else {
  alert("Press 'Ctrl+p' on your keyboard to print article.");
 }
}

function cartUpdate() {
  submitForm(document.cartform, '/cart.do?method=bulkupdate');
}

function checkFormManufacturer() {
 for(i = 0; i < document.manufacturer.smmanufacturer.options.length; i++) {
  if(document.manufacturer.smmanufacturer.options[i].selected) {
   if(document.manufacturer.smmanufacturer.options[i].value == '') {
    alert('Searching by manufacturer requires you to select a manufacturer!');
    return false;
   }
  }
 }
 if(document.manufacturer.smpartnumber.value == '') {
  alert('Searching by manufacturer requires you to enter a model or part number!');
  return false;
 }
 return true;
}

function checkFormDevice() {
 for(i = 0; i < document.device.sddevice.options.length; i++) {
  if(document.device.sddevice.options[i].selected) {
   if(document.device.sddevice.options[i].value == '') {
    alert('Searching by device requires you to select a device!');
    return false;
   }
  }
 }
 for(i = 0; i < document.device.sdmanufacturer.options.length; i++) {
  if(document.device.sdmanufacturer.options[i].selected) {
   if(document.device.sdmanufacturer.options[i].value == '') {
    alert('Searching by device requires you to select a manufacturer!');
    return false;
   }
  }
 }
 if(document.device.sdpartnumber.value == '') {
  alert('Searching by device requires you to enter a model or part number to search!');
  return false;
 }
 return true;
}

function compareProducts(path) {
 var total = document.forms.length;
 path = path + "?";
 for(var i = 0, n = total; i < n; i++) {
  if(document.forms[i].name == "purchase") {
   if(document.forms[i].comparesku.checked) {
    path = path.concat("sku=");
    path = path.concat(document.forms[i].comparesku.value);
    if(i < n) {
     path = path.concat("&");
    }
   }
  }
 }
 if(path.charAt(path.length-1) == "&") {
  path = path.substring(0, path.length-1);
 }
 document.location.href=path;
}

/*****************************************************************************************

  ***** ****** ****** *    *   ******    ****** *   * ****** *   * ****** ***** ******   
    *   *    * *      *    *   *    *    *    * *   * *      *   * *    *   *   *    *   
    *   *    * *      *    *   *    *    *    * *   * *      *   * *    *   *   *    *   
    *   *    * *      *    *   ********* *    * *   * *      *   * *    *   *   *    *   
    *   *    * ****** ******   *       * *    * *   * *      ***** ******   *   ******   
    *   *    *      * *    *   *       * *    * *   * *      *   * *    *   *   *     *  
 *  *   *    *      * *    *   *       * *    * *   * *      *   * *    *   *   *      * 
  ***   ****** ****** *    *   ********* ****** ***** ****** *   * *    * ***** *       *

*****************************************************************************************/