var ie=(document.all)? true:false;
var ie5 =(navigator.appVersion.indexOf("MSIE 5.0")!=-1)? true:false;
var ieMac=((navigator.appVersion.indexOf("Mac")!=-1) && ie)? true:false;
var isMac=(navigator.appVersion.indexOf("Mac")!=-1)? true:false;
var ns4=(document.layers)? true:false;
var ns6=((document.getElementById) && (!ie))? true:false;
var leng;
var arr;
var leng_int;
var arr_int;
var isMacNs4 = (isMac && (navigator.appVersion.indexOf("4")!=-1))? true:false;

function Menu(){
 this.tmr=0;
 this.tmer;
 this.init = init;
 this.sho = sho;
 this.hid = hid;
 this.timer = timer;
 this.kill = kill;
 this.clipVert=0;
 this.pop = pop;
}

function stt(){
 arr= new Array("lay1","lay2","lay3","lay4","lay5","lay6","lay7");
 leng=arr.length;
}

function init(lay,anchlay,ieincrX,ieIncrY,nsincrX,nsincrY,ns6IncrX,ns6IncrY){
 stt();
 anchlay = (ie)? anchlay:((ns6)?  anchlay : "ns"+anchlay);
 var e = (ie)? document.all[lay].style : ((ns6)? document.getElementById(lay).style : eval("document."+lay));
 var f = (ie)? document.all[anchlay] : ((ns6)? document.getElementById(anchlay) : eval("document."+anchlay));
 e.left = (ie)? f.offsetLeft-(ieincrX) : ((ns6)? f.offsetLeft-(ns6IncrX) : f.pageX-(nsincrX));
 e.top = (ie)? f.offsetTop-(ieIncrY) : ((ns6)? f.offsetTop-(ns6IncrY) : f.pageY-(nsincrY));
}

function sho(lay, clipVert){
 killlays();
 var e = (ie)? document.all[lay].style : ((ns6)? document.getElementById(lay).style : eval("document."+lay));
 e.visibility='visible';
 clipAll(e, clipVert);
 expand(lay);
}

function hid(lay){
// alert("hid");
  var e = (ie)? document.all[lay].style : ((ns6)? document.getElementById(lay).style : document.layers[lay]);
  e.visibility='hidden';
}

function timer(lay){
var timout=50;
 this.tmr = setTimeout('hid("'+ lay +'")',timout);
}

function kill(){
 clearTimeout(this.tmr);
}

function killlays(){
 for(i=0;i<leng;i++){
//  alert(arr[i]);
  e = (ie)? document.all[arr[i]].style : ((ns6)? document.getElementById(arr[i]).style : eval("document."+arr[i]));
  e.visibility='hidden';
  }
return;
}

function kill_ints(){
 for(i=0;i<leng_int;i++){
  hid(arr_int[i]);
  }
}

function test(){
 test=(ns4)? 'ns4' : ((ns6)? 'ns6' : 'ie');
 alert(test);
}

function clipBy(obj,t,r,b,l){
// alert("top: "+clipValues(obj,'t'));
 if(ns4){
  obj.clip.top = clipValues(obj,'t') + t;
  obj.clip.right = clipValues(obj, 'r') + r;
  obj.clip.bottom = clipValues(obj, 'b') + b;
  obj.clip.left = clipValues(obj, 'l') + l;
  }
  else if(ie) obj.clip = "rect("+(this.clipValues(obj,'t')+t)+"px "+(this.clipValues(obj,'r')+r)+"px "+Number(this.clipValues(obj,'b')+b)+"px "+Number(this.clipValues(obj,'l')+l)+"px)";
// alert("top: "+clipValues(obj,'t'));
}

function clipValues(obj, prpty){
 if(ns4){
   if(prpty=="t") return obj.clip.top;
   if(prpty=="r") return obj.clip.right;
   if(prpty=="b") return obj.clip.bottom;
   if(prpty=="l") return obj.clip.left;
   }
  else if(ie){
      var clipv = obj.clip.split("rect(")[1].split(")")[0].split("px");
      if (prpty=="t") return Number(clipv[0]);
      if (prpty=="r") return Number(clipv[1]);
      if (prpty=="b") return Number(clipv[2]);
      if (prpty=="l") return Number(clipv[3]);
   }
}

function clipTo(obj,t,r,b,l){
 if(ns4){
  obj.clip.top = t;
  obj.clip.right = r;
  obj.clip.bottom = b;
  obj.clip.left = l;
  }
  else if(ie) obj.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)";
}

function clipAll(obj, clipVert){
 if(ns4){
   obj.clip.top = clipVert;
   obj.clip.right = 180;
   obj.clip.bottom = 0;
   obj.clip.left = 0;
   }
   else if(ie)  obj.clip = "rect("+clipVert+"px, 180px, 160px, 0px)";
 return;
}

function expand(lay){
 var e = (ie)? document.all[lay].style : ((ns6)? document.getElementById(lay).style : eval("document."+lay));
 if(clipValues(e,'t')>0){
// alert("top: "+clipValues(e,'t'));
  clipBy(e,-14,0,0,0);
  setTimeout('expand("'+ lay +'")',1);
  }
}

function pop(lay){
 var e = (ie)? document.all[lay].style : ((ns6)? document.getElementById(lay).style : eval("document."+lay));
 e.visibility='visible';
}

function pop_int(lay){
 kill_ints();
 pop(lay);
}

function kill_hilite(){
var indx=0;
var arg_array = kill_hilite.arguments;
var ileng = arg_array.length;
var iswaps = ileng/2;
for(i=0;i<iswaps;i++){
 if(document.images){
  document.images[arg_array[indx++]].src=arg_array[indx++];
  }
 }
}

var navDOM="";
function setAll(){
 markW = 90;       // pixels wide
 markH = 40;       // pixels high
 markX = 99;      // percent right
 markY = 99;      // percent down
 markRefresh = 50; // milliseconds

 wMark = (ie)? document.all["waterMark"].style : ((ns6)? document.getElementById("waterMark").style : eval("document.waterMark"));//document.all[""].style;
 wMark.width = markW;
 wMark.height = markH;
 navDOM = (window.innerHeight)? true:false; // Nav DOM flag
// alert(navDOM);
}
function setVals() {
barW = 0; // scrollbar compensation for PC Nav
 barH = 0;
 if (navDOM) {
  if (document.height > innerHeight) barW = 20;
  if (document.width > innerWidth) barH = 20;
  } else {
  innerWidth = document.body.clientWidth;
  innerHeight = document.body.clientHeight;
  }
 posX = ((innerWidth - markW)-barW) * (markX/100);
 posY = ((innerHeight - markH)-barH) * (markY/100);
 }

function wRefresh() {
 wMark.left = posX + ((navDOM)? pageXOffset-70 : document.body.scrollLeft-60);
 wMark.top = posY + ((navDOM)? pageYOffset+30 : document.body.scrollTop+20);
 }

function markMe() {
 setAll();
 setVals();
 window.onresize=setVals;
 markID = setInterval("wRefresh()",markRefresh);
 }

function write2lay(lay, txt) {
 lay=(ns4)? 'ns'+lay:lay;
 if (ns4) {
  document.layers[lay].document.open();
  document.layers[lay].document.write(txt);
  document.layers[lay].document.close();
  }
  else if (ie) {
   document.all(lay).innerHTML = txt;
   }
  else if (ns6){
   document.getElementById(lay).innerHTML = txt;
   }
}

function img_load(){
 var arg_array = img_load.arguments;
 for(i=0;i<arg_array.length;i++){
  img_list[parseInt(arg_array[i])] = new Image();
  img_list[arg_array[i]].src = img_array[arg_array[i]];
 }
}


