/*
http://simonwillison.net/2004/May/26/addLoadEvent/
*/
function addLoadEvent(func)
{
  var oldonload = window.onload;
  if (typeof window.onload != 'function')
  {
    window.onload = func;
  }
  else
  {
    window.onload = function()
    {
      if (oldonload)
      {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(table_setup);

function table_setup()
{
  var elObj;
  var elObjReg;

  if (!document.getElementById)
  {
    return;
  }
  if (elObj = document.getElementById("footer"))
  {
    if (elObjReg = document.getElementsByTagName("a"))
    {
      for (var i=0;i<elObjReg.length;i++)
      {
        var elObjHref = elObjReg[i].href;
        if (elObjHref.indexOf('shipping-') != -1)
        {
          elObjReg[i].onclick = function () { return tableOpen(this.href); }
//          elObjReg[i].onclick = function () { window.open(this.href); return false; }
        }
      }
    }
  }
  else
  {
    setTimeout("table_setup()",10);
  }
}


/***************
 * table popup *
 ***************/

PWin = null;

PWinHeight = 650;
PWinWidth = 950;

function tableOpen(ptable)
{
  tableClose();

  PWin = window.open(ptable,'PWin','width='+PWinWidth+',height='+PWinHeight+',scrollbars=1,toolbars=0,resizable=1');
  PWin.focus();
  return false;
}

function tableClose()
{
  if (PWin)
    PWin.close();
}

function windowreturn()
{
  if (window.opener)
  {
    window.opener.focus();
    window.close();
  }
  else
  {
    location.href='shipping.asp';
  }

  return false;
}

