var isPaused = true;
var OverDiv = false;

// --- Start Stephen Chapman code ---
// Cross Browser DOM
// copyright Stephen Chapman, 4th Jan 2005
// you may copy this code but please keep the copyright notice as well
 var aDOM = 0, ieDOM = 0, nsDOM = 0;
 var stdDOM = document.getElementById;
 if (stdDOM) aDOM = 1;
 else {
  ieDOM = document.all;
  if (ieDOM) aDOM = 1;
  else {
   var nsDOM = ((navigator.appName.indexOf('Netscape') != -1)&& (parseInt(navigator.appVersion) ==4));
   if (nsDOM) aDOM = 1;
  }
 }

function xDOM(objectId, wS) {
 if (stdDOM) return wS ? document.getElementById(objectId).style: document.getElementById(objectId);
 if (ieDOM) return wS ? document.all[objectId].style: document.all[objectId];
 if (nsDOM) return document.layers[objectId];
}
// --- End Stephen Chapman code ---


function GetTop(objectID) {
 var obj = xDOM(objectID,0); var objs = xDOM(objectID,1);
 return 36;
 if(objs.top) return objs.top;
 if (objs.pixelTop) return objs.pixelTop;
 if (obj.offsetTop) return obj.offsetTop;
 return 0;
} 

function SetTop(objectID, NewTop) {
 var obj = xDOM(objectID,0); var objs = xDOM(objectID,1);
 if(objs.top) objs.top=NewTop;
// if (objs.pixelTop) objs.pixelTop=NewTop;
// if (obj.offsetTop) obj.offsetTop=NewTop;
} 

function GetLeft(objectID) {
 var obj = xDOM(objectID,0); var objs = xDOM(objectID,1);
 if (objs.left) return objs.left;
 if (objs.pixelLeft) return objs.pixelLeft;
 if (obj.offsetLeft) return obj.offsetLeft;
 return 0;
} 







function pause(i)
{
  setTimeout("isPaused = false;", i);
  do
  {
    i=0;
  } while( isPaused )
  isPaused = true;
  return true;
}

function E_Getobj(n, d) {
  var p,i,x;
  if(!d) d=document;
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=E_Getobj(n,d.layers[i].document);
  return x;
}

// Takes a list of object-ID/visability pairs and shows or hides the objects
function E_Layers()
{
 var args=E_Layers.arguments;
 var i,v,objs;
 for (i=0; i<(args.length-1); i+=2) 
 {
  v=args[i+1];
  v=(v=='s')?'visible':(v='h')?'hidden':v;
  objs= xDOM (args[i], 1);
  objs.visibility=v;

//    if(document.layers){
//      obj = document.layers[args[i]]
//      objs.visibility=v;
//    }
//    if(document.all){
//      obj = document.all[args[i]];
//      obj.style.visibility=v;
//    }
//    if(!document.all && document.getElementById){
//      obj = document.getElementById(args[i]);
//      obj.style.visibility=v;
//    }
 } 
}

function E_LayersAtMouse()
{
  var i,v,obj,args=E_LayersAtMouse.arguments;
  var IE = document.all?true:false
  var tempX = 0
  var tempY = 0
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    document.captureEvents(Event.MOUSEMOVE)
    tempX = e.pageX
    tempY = e.pageY
  }  
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  for (i=0; i<(args.length-1); i+=2) if ((obj=E_Getobj(args[i]))!=null)
  {
    v=args[i+1];
    v=(v=='s')?'visible':(v='h')?'hidden':v;
    obj.style.visibility=v;
    obj.style.position='absolute';
    obj.style.top=tempY +2;
    obj.style.left=tempX +32;
  } 
}

function VisibleAtMouse (obj)
{
  var IE = document.all?true:false
  var tempX = 0
  var tempY = 0
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    document.captureEvents(Event.MOUSEMOVE)
    tempX = e.pageX
    tempY = e.pageY
  }  
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  obj.style.visibility='visible';
  obj.style.position='absolute';
  obj.style.top=tempY-1;
  obj.style.left=tempX +10;
}

function Invisible (obj)
{
  obj.style.visibility='hidden';
}

function E_Button()
{
  var o,args=E_Button.arguments; 
  o=E_Getobj(args[0]);
  if (o.style.backgroundImage != args[1]) o.style.backgroundImage=args[1];  
}

function E_NavMenuOver(n)
{
  var MenuDiv="menu"+n;
//  var RootTd="topbtn"+n;
//  var NewTop= GetTop(RootTd);
//  var NewLeft= GetLeft(RootTd);
//  alert (NewLeft);
  E_Layers (MenuDiv, "s");
//  SetTop (MenuDiv, NewTop);
}

function E_NavMenuOut(n)
{
  var divn="menu"+n;
  E_Layers(divn,"h");
}

function E_NewWindow(windurl,windname)
{ 
 window.open(windurl,windname,'width=400,height=400,resizable=no,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no'); 
} 

function E_OpenImage (FileName, Width, Height) 
{
 window.open("image.php?Fn="+FileName,"_blank","toolbar=no, location=no, directories=no, menubar=no,status=no, scrollbars=no, resizable=no, copyhistory=no, width="+Width+", height="+Height);
}
