// Button Rollover Code
function rollOverNew(imgID, imgName) {
  document.getElementById(imgID).setAttribute('src', imgName);
}

function MM_jumpMenu(targ, selObj, restore){ //v3.0
  eval(targ + ".location='" + selObj.options[selObj.selectedIndex].value + "'");
  if (restore) selObj.selectedIndex = 0;
}

function checkProduct() {
  var getProductObj = document.getElementById('product');
  // If user has selected "Tectyl" as the product. redirect them to the map page.
  if (getProductObj.value == "Tectyl") {
    popupFoot('popup','/contact_us/region_tectyl&product=Tectyl','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,copyhistory=0,resizable=0,left=0,top=0','650','450');
    //window.location='main.taf?p=4,2,2&product=Tectyl';
  }
  if (getProductObj.value == "Nox-Rust") {
    popupFoot('popup','/contact_us/region_nox_rust&product=Nox-Rust','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,copyhistory=0,resizable=0,left=0,top=0','650','450');
    //window.location='main.taf?p=4,2,3&product=Nox-Rust';
  }
}

// Popup Window Code for Footer
function popupFoot(winname, winurl, winopt, winwidth, winheight) {
  //var winname = "Popup";
  height = screen.availHeight;
  height = (height - winheight) / 2;
  width = screen.availWidth;
  width = (width - winwidth) / 2;
  winopt = winopt + ",left=" + width + ",top=" + height + ",width=" + winwidth + ",height=" + winheight;
  var newwin = window.open(winurl,winname,winopt);
}

function toggleSSTab(id) {
  getTabOn = $$('.on');
  
  for (i = 0; i < getTabOn.length; i++) {
    getTabOn[i].removeClassName('on');
  }

  $('t_' + id).addClassName('on');
  $('tabc_' + id).addClassName('on');
}

function toggleHomeTiles(id) {
  getOnTiles = $$('.ht.on');
  for (i = 0; i < getOnTiles.length; i++) {
    getOnTiles[i].removeClassName('on');
  }
  
  getOnShow = $$('.htn_on.show');
  for (i = 0; i < getOnShow.length; i++) {
    getOnShow[i].removeClassName('show');
    getOnShow[i].addClassName('hide');
  }
  
  getOffHide = $$('.htn_off.hide');
  for (i = 0; i < getOffHide.length; i++) {
    getOffHide[i].removeClassName('hide');
    getOffHide[i].addClassName('show');
  }

  $('ht_' + id).addClassName('on');
  $('htn_on_' + id).removeClassName('hide');
  $('htn_on_' + id).addClassName('show');
  $('htn_off_' + id).removeClassName('show');
  $('htn_off_' + id).addClassName('hide');
}

function slideHomeTiles(id) {
  $('ht_' + id).setStyle({
    left: '870px',
    opacity: 1
  });
  $('hti_' + id).setStyle({
    opacity: 0
  });
  
  // move old tile out and fade, while moving new tile in
  getOnTile = $$('.ht.on');
  for (i = 0; i < getOnTile.length; i++) {
    getOnTile[i].setStyle({
      left: '0px',
      opacity: 1
    });
    new Effect.Parallel([
      new Effect.Move(getOnTile[i], { sync: true, x: -870, y: 0, mode: 'relative' }), 
      new Effect.Move('ht_' + id, { sync: true, x: -870, y: 0, mode: 'relative' }), 
      new Effect.Opacity(getOnTile[i], { sync: true, from: 1, to: 0 })
    ], { 
      duration: 1.5
    });
  }
  setTimeout("toggleHomeTiles('" + id + "');", 100);
  setTimeout("showHomeTileText('" + id + "');", 1000);
}

function showHomeTileText(id) {
  new Effect.Opacity('hti_' + id, { from: 0, to: 1 })
}

function openRules() {
  var target = 'shippingRules';

  new LDialog({
    target: target
  });
}


