var DOM = (document.getElementById)? true : false;
var OP = (window.opera)? true : false;
var OP5plus = (OP && DOM)? true : false;
var NS = (window.outerWidth && !OP)? true : false;
var NS6plus = (NS && DOM)? true : false;
var NS4 = (NS && !DOM)? true : false;
var IE = (document.all && !OP)? true : false;
var IE5plus = (IE && DOM)? true : false;
var IE4 = (IE && !DOM)? true : false;

function getLayer(objectName) {
  if(NS4) {return document.layers[objectName]}
  else if(IE4) {return document.all[objectName].style}
  else if(DOM) {return document.getElementById(objectName).style}
  else return null;
}

function toShowObj(objName, toShow) {if (toShow) showObj(objName); else hideObj(objName);}
function showObj(objName) {thisObj(objName).display='';}
function hideObj(objName) {thisObj(objName).display='none';}
//function showObj(objName) {thisObj(objName).visibility = (NS4)? "show" : "visible";}
//function hideObj(objName) {thisObj(objName).visibility = (NS4)? "hide" : "hidden";}


function thisObj(objName) {
  if(IE4)      { if (document.all[objName]) return document.all[objName].style; else return false; }
  else if(DOM) { if (document.getElementById(objName)) return document.getElementById(objName).style; else return false; }
  else if(NS4) { if (document.layers[objName]) return document.layers[objName]; else return false; }
}


function clipObj(objName,x1,x2,y1,y2)
{
  if(NS4)
  {
    if(x1!="auto") {thisObj(objName).clip.left=x1;}
    if(x2!="auto") {thisObj(objName).clip.right=x2;}
    if(y1!="auto") {thisObj(objName).clip.top=y1;}
    if(y2!="auto") {thisObj(objName).clip.bottom=y2;}
  }
  else
  {
    if(x1!="auto") {x1=x1+'px ';} else {x1=x1+" ";}
    if(x2!="auto") {x2=x2+'px ';} else {x2=x2+" ";}
    if(y1!="auto") {y1=y1+'px ';} else {y1=y1+" ";}
    if(y2!="auto") {y2=y2+'px ';} else {y2=y2+" ";}
    thisObj(objName).clip="rect("+y1+x2+y2+x1+")";
  }
}

var sP = new Array();
var sN = 0;

function initSlide(objName,x1,y1,x2,y2,slidingTime,moveSteps)
{
  sN++;
  sP[sN] = new Object();
  sP[sN].objName = objName;
  sP[sN].step = 0;
  sP[sN].nrOfSteps = moveSteps;
  sP[sN].to = (slidingTime/moveSteps);
  sP[sN].left = x1;sP[sN].top = y1;
  sP[sN].diffX = (x2-x1)/moveSteps;
  sP[sN].diffY = (y2-y1)/moveSteps;
  moveObjTo(objName,x1,y1);
  eval("slide"+sN+" = new Function(\"\",\"sP["+sN+"].step++;if(sP["+sN+"].step<=sP["+sN+"].nrOfSteps) {sP["+sN+"].left+=sP["+sN+"].diffX;sP["+sN+"].top+=sP["+sN+"].diffY;moveObjTo(sP["+sN+"].objName,sP["+sN+"].left,sP["+sN+"].top);setTimeout('slide"+sN+"()',sP["+sN+"].to);}\")");
  eval("slide"+sN+"()");
}

function writeLayerText(lay, txt) {
  if(document.layers)
    {with(document.layers[lay].document)
      {open();write(txt);close();}}
  else if (document.getElementById) {document.getElementById(lay).innerHTML=txt;}
  else if (document.all) {document.all[lay].innerHTML=txt;}
}
