function geovisit(){} // do nothing fix for a Yahoo bug 

if (top!=self)
{
  top.location=self.location;
}

document.writeln('<link rel="shortcut icon" href="'+imgPath+'favicon.ico" type="image/x-icon">');
document.writeln('<link rel="icon" href="'+imgPath+'favicon.ico" type="image/x-icon">');

var rightnow=new Date();
var imgBackground=imgPath+'bg00'+imgList[(Math.floor(rightnow.getMinutes())%imgList.length)]+'.gif';
if ((document.location+'').indexOf('?width=')<1 && (document.location+'').indexOf('?landscape')<1)
{
  document.writeln('<style>'); 
  document.writeln('BODY'); 
  document.writeln('{');
  document.writeln('  color: black;');
  document.writeln('  font: 13pt/14pt arial,helvetica,sans-serif;');
  document.writeln('  font-weight: none;');
  document.writeln('  background: url('+imgBackground+') white no-repeat left top; background-attachment: fixed;');
  document.writeln('  margin-top: 1px;');
  document.writeln('  margin-right: 4px;');
  document.writeln('  margin-bottom: 1px;');
  document.writeln('  margin-left: 4px;');
  document.writeln('}');
  
  document.writeln('.OUTLINK');
  document.writeln('{');
  document.writeln('  COLOR:#004400;');
  document.writeln('  xxxbackground: url('+imgPath+'outlinklink.gif) no-repeat right bottom;');
  document.writeln('  xxxpadding-right: 18px;');
  document.writeln('}');

  document.writeln('a.SOUND:link');
  document.writeln('{');
  document.writeln('  SOUND:#004400;');
  document.writeln('  background: url('+imgPath+'soundlinklink.gif) no-repeat right bottom;');
  document.writeln('  padding-right: 18px;');
  document.writeln('}');
  document.writeln('a.SOUND:visited');
  document.writeln('{');
  document.writeln('  SOUND:#443300;');
  document.writeln('  background: url('+imgPath+'soundlinkvisited.gif) no-repeat right bottom;');
  document.writeln('  padding-right: 18px;');
  document.writeln('}');
  document.writeln('a.SOUND:hover');
  document.writeln('{');
  document.writeln('  COLOR:#aa00ff;');
  document.writeln('  background: url('+imgPath+'soundlinkhover.gif) no-repeat right bottom;');
  document.writeln('  padding-right: 18px;');
  document.writeln('}');
  document.writeln('a.SOUND:active);');
  document.writeln('{');
  document.writeln('  COLOR:#0077ff;');
  document.writeln('  background: url('+imgPath+'soundlinkactive.gif) no-repeat right bottom;');
  document.writeln('  padding-right: 18px;');
  document.writeln('}');

  document.writeln('</style>'); 
}

function toggle(obj) {
  if (document.getElementById)
  {
    var style2 = document.getElementById(obj).style;
    style2.display = style2.display? "":"block";
  }
  else if (document.all)
  {
    var style2 = document.all[obj].style;
    style2.display = style2.display? "":"block";
  }
  else if (document.layers)
  {
    var style2 = document.layers[obj].style;
    style2.display = style2.display? "":"block";
  }
}

function addLoadEvent(func)
{
  var oldfunc = window.onload;
  if (typeof window.onload != 'function')
  {
    window.onload = func;
  }
  else
  {
    window.onload=function(){oldfunc();func();}
  }
}

function cleanPopUp(winURL)
{ 
  var w=Math.floor(window.screen.width*0.8);
  if (w>1024) w=1024;
  var h=Math.floor(window.screen.height*0.75);
  if (h>576)  h=576;
  var t=0;
  var l=Math.floor(w/8);
  var newWin=window.open(winURL,'','toolbar,menubar,scrollbars,resizable,location,status,width='+w+',height='+h+',top='+t+',left='+l);
  newWin.focus();
}

function togglePopUp()
{
  var nDays = 365
  var today = new Date();
  var nextYear = new Date(today.getTime() + nDays*24*60*60*1000);

  var topDomain=document.domain;
  if (topDomain.substr(0,4)=="www.") topDomain = topDomain.substr(4)
  if (topDomain.indexOf('\.')<0) topDomain='';
  if (topDomain.length>0) topDomain='; domain='+topDomain;

  if (document.cookie.indexOf('pu=no')<0)
  { 
    document.cookie='pu=no; expires='+nextYear.toGMTString()+topDomain+'; path=/';
  }
  else
  {
    document.cookie='pu=yes; expires='+nextYear.toGMTString()+topDomain+'; path=/';
  }
  if (document.cookie.length==0)
  {
    alert("Unable to change this setting because you have disabled your browser's ability to accept cookies.");
  }
  document.location.reload();
}

function fixupLinks()
{
  if (document.cookie.indexOf('pu=no')<0) 
  { 
    var links=document.getElementsByTagName("a");
    for (var i=0; i<links.length; i++)
    { 
      var name=links[i].getAttribute("class");
      if (name==null) name=links[i].getAttribute("className");

      if (name == "OUTLINK")
      {
        links[i].onclick = function(){cleanPopUp(this.getAttribute("href")); return false;}
      } 
      if (name == "BUYLINK")
      {
        links[i].onclick = function(){cleanPopUp(this.getAttribute("href")); return false;}
      } 
    }
  }
}

addLoadEvent(fixupLinks);
