// JavaScript Document

function popupWindow( vURL, vWinName, vWidth, vHeight, vScrollbar)
{
  if (! window.focus) return true;
  
  var vhref;
  var vSWidth = screen.width;
  var vSHeight = screen.height;
  
  if(vScrollbar == "yes")
  {
    vWidth += 16;
  }
  
  var vleftPos = (vSWidth / 2) - (vWidth / 2);
  var vtopPos = (vSHeight / 2) - (vHeight / 2);
  
  if (document.frmProduct.stock.value != '') 
  {
    // sort ? & 
    if (vURL.indexOf("?") == -1) {
      sJoiner = '?';
    } else {
      sJoiner = '&';
    }      
  
   // vURL = vURL + sJoiner + 'i=' + document.frmProduct.stock.value;
  }
  
  vhref = vURL;
  window.open(vhref, vWinName, 'scrollbars=' + vScrollbar + ',status=no,width=' + vWidth + ',height=' + vHeight + ',left=' + vleftPos + ',top=' + vtopPos);
  return false;

}

function popupAnyWindow( vURL, vWinName, vWidth, vHeight, vScrollbar)
{
  if (! window.focus) return true;
  
  var vhref;
  var vSWidth = screen.width;
  var vSHeight = screen.height;
  
  if(vScrollbar == "yes")
  {
    vWidth += 16;
  }
  
  var vleftPos = (vSWidth / 2) - (vWidth / 2);
  var vtopPos = (vSHeight / 2) - (vHeight / 2);

  vhref = vURL;
  window.open(vhref, vWinName, 'scrollbars=' + vScrollbar + ',status=no,width=' + vWidth + ',height=' + vHeight + ',left=' + vleftPos + ',top=' + vtopPos);
  return false;

}

// Add bookmark for both browser engines...
function addBookmark(title,url) {
  if (window.sidebar) {
    window.sidebar.addPanel(title, url,"");
  } else if( document.all ) {
    window.external.AddFavorite( url, title);
  } else if( window.opera && window.print ) {
    return true;
  }
} 

// HierMenus Init
if(window.event + "" == "undefined") event = null;
function HM_f_PopUp(){return false};
function HM_f_PopDown(){return false};


// function to disable an anchor
function disableAnchor(obj, disable){
  if(disable){
    var href = obj.getAttribute("href");
    if(href && href != "" && href != null){
       obj.setAttribute('href_bak', href);
    }
    obj.removeAttribute('href');
    obj.style.color="gray";
  }
  else{
    obj.setAttribute('href', obj.attributes['href_bak'].nodeValue);
    obj.style.color="blue";
  }
}