var popUpWin=0;

function popUpWindow(width, height, URLStr)
  {
    if (typeof(SymRealWinOpen)!="undefined")
        window.open = SymRealWinOpen;

    var left = (screen.width/2) - width/2;
    var top = (screen.height/2) - height/2;
    if(popUpWin)
      {
        if(!popUpWin.closed) popUpWin.close();
      }
    popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
    if (popUpWin==null)
        ; //alert("Please enable popups for this site");
    else
        popUpWin.focus()
  }

function popUpWindowFlexible(width, height, URLStr)
  {
    if (typeof(SymRealWinOpen)!="undefined")
        window.open = SymRealWinOpen;

    var left = (screen.width/2) - width/2;
    var top = (screen.height/2) - height/2;
    if(popUpWin)
      {
        if(!popUpWin.closed) popUpWin.close();
      }
    popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=Yes,menubar=no,scrollbars=Yes,resizable=Yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
    if (popUpWin==null)
        ; //alert("Please enable popups for this site");
    else
        popUpWin.focus()
  }

  function getCookie (name)
    {
      var cookies = document.cookie.split(";");
      for (var i in cookies)
        {
            var parts = cookies[i].replace(/^ */,"").split("=");
            if (parts[0].toLowerCase()==name.toLowerCase())
                return parts.length > 1 ? unescape(parts[1]) : "";
        }
      return "";
    }

  function setCookie (name, value)
    {
      var date = new Date();
      if (typeof(date.setFullYear)!="undefined")
          date.setFullYear(date.getFullYear()+2);
      else
          date.setYear(date.getYear()+2);
      document.cookie = name + "=" + escape(value) + ";path=/;expires=" + date.toGMTString();

    }
    
  function preLoad()
    {
      if (typeof(document.getElementById)=='undefined')
          return;
      var num = getCookie('picture');
      if (num=='' || isNaN(num) || num > 10 || num < 1)
          num = 2;
      preloadImg = document.getElementById('header');
      preloadImg.src = '/images/header' + String(num) + '.jpg';
    }

  function swapPicture()
    {
      if (typeof(document.getElementById)=='undefined')
          return;
      var num = getCookie('picture');
      if (num=='' || isNaN(num) || num > 10 || num < 1)
          num = 1;
      var el = document.getElementById('header');
      el.src = '/images/header' + String(num++) + '.jpg';
      //alert(el.src);
      if (num > 10) num=1;
      setCookie('picture', num);
      preLoad();
    }

  function pictureShow()
    {
      preLoad();
      window.setInterval('swapPicture()', 10000);
    }
