
function GoSearch(searchText) {
        if(!searchText || searchText.length<1 || Trim(searchText).length<1) {
                alert('Please type the word or words you want to search for in the search box.');
                return false;
        }

        return true;
}

function Trim(source) {
  source = source.replace( /^\s+/g, "" );
  return source.replace( /\s+$/g, "" );
}

function validate_count( which ) {
  var i=0;
  var count=0;
  for(i=0; i<document.CompareProducts.elements.length; i++)
  {
    if (document.CompareProducts.elements[i].checked == true){count++;}
    if (count > 10) {
       alert('A maximum of 10 products can be compared at one time.');
       document.CompareProducts[which].checked = false;
       break;
    }
  }
  if (which == 'Form') {
     if (count <= 1) {
         alert('Choose at least two products.');
         return false;
     } else {
         return true;
     }
  }
}

function toggle(section) {
    var elem = document.getElementById(section);
    if (elem) {
        elem.style.display = (elem.style.display != '') ? '' : 'none';
    }
    var img  = document.getElementById('img_'+section);
    if (img && img.src == plus.src) {
        img.src = minus.src;
        img.alt = minus.alt;
    } else if (img) {
        img.src = plus.src;
        img.alt = plus.alt;
    }
}

var minus = new Image(12,12);
var plus  = new Image(12,12);
minus.src = 'images/Skin2/minus1.gif';
minus.alt = 'Click here to collapse this section';
plus.src  = 'images/Skin2/plus1.gif';
plus.alt  = 'Click here to expand this section';

function toggle2(divId) {
  if(document.getElementById(divId).style.display == 'none') {
      document.getElementById(divId).style.display = 'block';
  } else {
      document.getElementById(divId).style.display = 'none';
  }
  return true;
}


linkName2Index=new Object();
function gotoclick(t,s){
   var d=document;
   if(linkName2Index[s]>=0){
      t.href=d.links[linkName2Index[s]];
      return true;
   }

   for(i=d.links.length-1;i>=0;i--){
      if(typeof d.links[i].name!="undefined"){
         if(d.links[i].name==s){
            linkName2Index[d.links[i].name]=i;
            t.href=d.links[i];
            return true;
         }
      }
   }
   return null;
}