
function btnOn() 
  {
    var srcString = this.src
    srcString = srcString.replace(/.gif/,'_over.gif')
    this.src = srcString
  }
function btnOff() 
  {
    var srcString = this.src
    srcString = srcString.replace(/_over.gif/,'.gif')
    this.src = srcString
  }
  
  

var theme_bplx1 = new Object()

theme_bplx1.navCells = document.getElementById('mainnav').getElementsByTagName('TD');

theme_bplx1.killNav = function ()
  {
   for (var i = 0, navlen = theme_bplx1.navCells.length;  i < navlen; i++)
      {
        killClass(theme_bplx1.navCells[i],"navOn")
      }
  }

theme_bplx1.navOn = function ()
  {
    theme_bplx1.killNav();
    addClass(this,"navOn")
  }
  
  
theme_bplx1.followLink = function ()
  {
    window.location = this.firstChild.href;
  }
  
theme_bplx1.initNav = function()
  {
    var thisCell  
    for (var i = 0, navlen = theme_bplx1.navCells.length;  i < navlen; i++)
      {
        thisCell = this.navCells[i]
        thisCell.onmouseover = this.navOn;
        thisCell.onmouseout = this.killNav;
        thisCell.onclick = this.followLink;
      }
  }
  
theme_bplx1.initFormFields = function()
  {

    var formfields = [ {fm:document.searchform, fld:'search_string',ds:'Search Site'}]
    
    var selectedForm,formfield;
    
    for (var bt = 0; bt < formfields.length; bt++)
      {
        selectedForm = formfields[bt].fm;
        if (selectedForm)
          {
            formfield = selectedForm.elements[formfields[bt].fld]
            if (formfield)
              {
                formfield.label = document.getElementById('lbl_' + formfield.id)
                if(formfield.label)
                  {
                    formfield.defaultString = formfield.label.firstChild.nodeValue;
                    formfield.label.style.display = 'none'
                  }
                else {formfield.defaultString = formfields[bt].ds;}
                
                formfield.onfocus = function(){if(this.value == this.defaultString) {this.value = '' }}
                formfield.onblur = function(){if(this.value == '') {this.value = this.defaultString }};
                formfield.onblur()  
              } //end, formfield exists
          } //end, if selected form
      } //end, for
  
  
  }//end, initFormFields
  
  
//shop by form event handlers
theme_bplx1.handleShopBy = function()
  {
    var targetOption = this.options[this.selectedIndex]
    var targetId = targetOption.value
    var rw = this.form.rw.value == 'true'
    var targetText = encodeURIComponent(targetOption.text.replace(/-/g,'')) + '/';
    if(targetId == '') return false
   
    if(rw)
      {
        if(this.id == 'shopbygroup') {var destination = '/category/' + targetText + targetId}
        else {var destination = '/manufacturer/' + targetText + targetId}
      }
    else
      {
        if(this.id == 'shopbygroup') {var destination = '/group.cfm?gid=' + targetId}
       else {var destination = '/manufacturer.cfm?mfid=' + targetId}
      }
    
    window.location = destination;
  }
  
theme_bplx1.initShopBy = function()
  {
    if(document.getElementById('shopbygroup')){document.getElementById('shopbygroup').onchange = this.handleShopBy}
    if(document.getElementById('shopbybrand')){document.getElementById('shopbybrand').onchange = this.handleShopBy}
  }
 
 
  
theme_bplx1.initialize = function()
  {
    if (!(document.getElementById && document.getElementsByTagName && document.createElement)) {return false}
    
    this.initNav();
    this.initFormFields()
    this.initShopBy()
  }
  


window.postAJAXfn = function() {theme_bplx1.initialize()};
theme_bplx1.initialize()

