
// Suppress error messages for the rollover script

  function noErrorMessages() {
     return true;
  }
  window.onerror = noErrorMessages;


// Preload images for the side navigation rollovers

   function preLoad() {

      if (document.images)  {
        img1a=new Image();      img1b=new Image();
        img2a=new Image();      img2b=new Image();
        img3a=new Image();      img3b=new Image();
        img4a=new Image();      img4b=new Image();
        img5a=new Image();      img5b=new Image();
        img6a=new Image();      img6b=new Image();
        img7a=new Image();
        img8a=new Image();      img8b=new Image();

        img1a.src="/images/nav/new/home_off.gif";               img1b.src="/images/nav/new/home_on.gif";
        img2a.src="/images/nav/new/about_off.gif";              img2b.src="/images/nav/new/about_on.gif";
        img3a.src="/images/nav/new/directory_off.gif";          img3b.src="/images/nav/new/directory_on.gif";
        img4a.src="/images/nav/new/customer_off.gif";           img4b.src="/images/nav/new/customer_on.gif";
        img5a.src="/images/nav/new/account_off.gif";            img5b.src="/images/nav/new/account_on.gif";
        img6a.src="/images/nav/new/register_off.gif";           img6b.src="/images/nav/new/register_on.gif";
        img7a.src="/images/new/arrow_small_on.gif";
        img8a.src="/images/nav/new/shopping_off.gif";           img8b.src="/images/nav/new/shopping_on.gif";
     }
     loaded = true;
}


function imgOn(imgName) {
    if  (document.images && loaded) {
        document.images[imgName].src =  eval(imgName + "b.src");
    }
    return false;
}


function imgOff(imgName) {
    if  (document.images && loaded)  {
        document.images[imgName].src =  eval(imgName + "a.src");
    }
    return false;
}


// Fix window resize problem in Netscape 4 browsers

  var NS4 = (document.layers) ? true: false;

  function reDo() {
    self.location.reload()
  }

window.onload = preLoad();


// Rollover for drop down menu (Show/Hide arrow)

  function arrowMenu(menuID,classRef) {
    document.getElementById(menuID).className=classRef;
}


// Change the background color when rolling over a New Product image
 
function showBorder(bord1,bord2) {
  document.getElementById(bord1).className='onState';
  document.getElementById(bord2).className='onState';
}

function hideBorder(bord1,bord2) {
  document.getElementById(bord1).className='offState';
  document.getElementById(bord2).className='offState';
}


// Rollover for price arrow

function arrowOn(priceNum, arrowImg) {
  if  (document.images && loaded) {
       document.images[priceNum].src = "/images/new/" + arrowImg + ".gif";
  }
  return false;
}


function arrowOff(priceNum, arrowImg) {
  if  (document.images && loaded) {
       document.images[priceNum].src = "/images/new/" + arrowImg + ".gif";
  } 
  return false;
}


// Rollover for Special Offers arrow

function specialOn(imgRef, arrowName) {
  if  (document.images && loaded) {
       document.images[imgRef].src = "/images/new/" + arrowName + "_on.gif";
  }
  return false;
}


function specialOff(imgRef, arrowName) {
  if  (document.images && loaded) {
       document.images[imgRef].src = "/images/new/" + arrowName + "_off.gif";
  } 
  return false;
}


// Popup window for Special Offers

var newWin = null;

// Check to see if the pop-up window is open before doing anything
// If a previous pop-up window is open then close it

  function closeWin() {
    if (newWin && !newWin.closed && newWin.open) {
      newWin.close();
      newWin=null;
   }  
}  

// Center the pop-up window for 4.0+ browsers 
// Make sure to account for browser chrome when doing the subtraction.

  function openWin(url,wide,high) {

    closeWin();

    if (document.getElementById || document.all || document.layers) {
      var screenWidth = screen.availWidth;
      var screenHeight = screen.availHeight;
      var newWidth = screenWidth - (wide-10);
      var newHeight = screenHeight - (high-40);
      var xPos = newWidth/2;
      var yPos = newHeight/2;

      newWin = window.open(url,'popup','height='+ high +',width='+ wide +',toolbar=no,menubar=no,status=no,location=no,scrollbars=yes,left=' + xPos + ',top=' + yPos + ',screenX=' + xPos + ',screenY=' + yPos + '');
    }
    else {
        newWin = window.open(url,'popup','height='+ high +',width='+ wide +',toolbar=no,menubar=no,status=no,location=no,scrollbars=yes,left=' + xPos + ',top=' + yPos + ',screenX=' + xPos + ',screenY=' + yPos + '');
    }

    if (newWin.opener == null) newWin.opener = window;
        newWin.opener.name = "opener";
}


// Break out of a framed page

if (self != top) {
    if (document.images)
        top.location.replace('http://www.sharperbrand.com/');
    else
        top.location.href = 'http://www.sharperbrand.com/';
}
