var fixitem;
var loaded = false;

//image preload

function preload( imgObj, imgSrc)
{
  eval(imgObj+' = new Image()');
  eval(imgObj+'.src = "'+imgSrc+'"');
  loaded = true;
}

//change image for any named image object
function changeImage(imgName, imgObj)
{
  if( loaded == true) {
    if( eval("document.images[\""+imgName+"\"]"))
      eval("document.images[\""+imgName+"\"].src = "+imgObj+".src");
  }
}

//client detection
var agt = navigator.userAgent.toLowerCase();

var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);
var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible')==-1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1));
var ns5 = (is_nav && (is_major >= 5));
var ns4 = (document.layers) ? true : false;
var ie4 = (document.all) ? true : false;
var nsMac = (ns4 &&  navigator.platform == "MacPPC") ? true : false;
var ieMac = (ie4 &&  navigator.platform == "MacPPC") ? true : false;
var op = (agt.indexOf('opera')!=-1) ? true : false;

//netscape reloading in case of resizing
if (document.layers) {
  widthCheck = window.innerWidth;
  heightCheck = window.innerHeight;
  window.onResize = resizeFix;
}

function resizeFix()
{
  if (widthCheck != window.innerWidth || heightCheck != window.innerHeight) {
    document.location.href = document.location.href;
  }
}

//general show/hide-functions

//ns6
function setIdProperty( id, property, value )
{
  if (ns5) {
    var styleObject = document.getElementById( id );
    if( styleObject != null) {
      styleObject = styleObject.style;
      styleObject[ property ] = value;
    }
  }
}

function show(id)
{
  if( ns4)
    document.layers[id].visibility = "show";
  else if( ie4)
    document.all[id].style.visibility = "visible";
  else if( ns5)
    setIdProperty( id, "visibility", "visible" );
  else
    document.getElementById[id].style.visibility = "visible";
}

function hide( id)
{
  if( ns4)
    document.layers[id].visibility = "hide";
  else if( ie4)
    document.all[id].style.visibility = "hidden";
  else if( ns5)
    setIdProperty( id, "visibility", "hidden" );
}

function winopen( url)
{
  if (document.layers) {
    thewin = window.open(url,"thewin","outerWidth=800,outerHeight=600,resizable=1,scrollbars=1,location=1,directories=1,menubar=1,toolbar=1,status=yes");
  } else {
    thewin = window.open(url,"thewin","width=800,height=470,resizable=1,scrollbars=1,location=1,directories=1,menubar=1,toolbar=1");
  }
}

function shows( x)
{
  document.getElementById(x).style.display = 'block';
}

function hides( x)
{
  document.getElementById(x).style.display = 'none';
}
