  var ns4 = (document.layers)? true:false;

// resize fix for ns4
var origWidth, origHeight;
if (document.layers) {
	origWidth = window.innerWidth; origHeight = window.innerHeight;
	window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
}

// link style change
var cur_link;
function doLinkClass(lnk) {
  if (lnk && lnk.blur) lnk.blur();	// remove marquee
  if (!lnk || cur_link == lnk) return;
  if (cur_link) cur_link.className = "done";
  lnk.className = "on";
  cur_link = lnk;
}

var cur_lyr;	// holds id of currently visible layer
function swapLayers(lnk,id) {
  doLinkClass(lnk);
  if (cur_lyr) hideLayer(cur_lyr);
  showLayer(id);
  cur_lyr = id;
}

var last_hilite = "";

// change the image and bullets on MouseOver
function swapLayers2(lnk,id,item,bullet) {
  if (!ns4){
     document.getElementById('lyr1').style.visibility="hidden";
     doLinkClass(lnk);
     if (cur_lyr) hideLayer(cur_lyr);
     showLayer(id);
     cur_lyr = id;
     last_hilite.src = "arrow_inactive.gif";
     bullet.src = "arrow_active.gif";
     last_hilite = bullet;
  }
}

function closeLayer(lnk,id) {
  document.getElementById(id).style.visibility="hidden";
  document.getElementById('lyr1').style.visibility="visible";
    //hide left menu arrow and link
  last_hilite.src = "arrow_inactive.gif";
  doLinkClass(lnk);
}

function showLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "visible";
}

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) { lyr.css.visibility = "hidden";}
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? getLyrRef(id,document): null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}


function getLyrRef(lyr,doc) {
	if (document.layers) {
		var theLyr;
		for (var i=0; i < doc.layers.length; i++) {
	  	theLyr = doc.layers[i];
			if (theLyr.name == lyr) return theLyr;
			else if (theLyr.document.layers.length > 0) 
	    	if ((theLyr = getLyrRef(lyr,theLyr.document)) != null)
					return theLyr;
	  }
		return null;
  }
}


function init(id,lyr) {
 if (!ns4){
  var lnk = getElemRefs(id);
  swapLayers(lnk,lyr);
  myImgDim = getDim(document.images.MyImage);
  var left_1 = myImgDim.x + 10;
  var top_1 = myImgDim.y + 10;

       document.getElementById('lyr1').style.left= left_1.toString() + "px";
       document.getElementById('lyr1').style.top=top_1.toString() + "px";

       document.getElementById('lyr2').style.left= left_1.toString() + "px";
       document.getElementById('lyr2').style.top=top_1.toString() + "px";

       document.getElementById('lyr3').style.left= left_1.toString() + "px";
       document.getElementById('lyr3').style.top=top_1.toString() + "px";

       document.getElementById('lyr4').style.left= left_1.toString() + "px";
       document.getElementById('lyr4').style.top=top_1.toString() + "px";

       document.getElementById('lyr5').style.left= left_1.toString() + "px";
       document.getElementById('lyr5').style.top=top_1.toString() + "px";

       document.getElementById('lyr6').style.left= left_1.toString() + "px";
       document.getElementById('lyr6').style.top=top_1.toString() + "px";

       document.getElementById('lyr7').style.left= left_1.toString() + "px";
       document.getElementById('lyr7').style.top=top_1.toString() + "px";

       document.getElementById('lyr8').style.left= left_1.toString() + "px";
       document.getElementById('lyr8').style.top=top_1.toString() + "px";

       document.getElementById('lyr9').style.left= left_1.toString() + "px";
       document.getElementById('lyr9').style.top=top_1.toString() + "px";

       document.getElementById('lyr10').style.left= left_1.toString() + "px";
       document.getElementById('lyr10').style.top=top_1.toString() + "px";

       document.getElementById('lyr11').style.left= left_1.toString() + "px";
       document.getElementById('lyr11').style.top=top_1.toString() + "px";

       document.getElementById('lyr12').style.left= left_1.toString() + "px";
       document.getElementById('lyr12').style.top=top_1.toString() + "px";

       document.getElementById('lyr13').style.left= left_1.toString() + "px";
       document.getElementById('lyr13').style.top=top_1.toString() + "px";

       document.getElementById('lyr14').style.left= left_1.toString() + "px";
       document.getElementById('lyr14').style.top=top_1.toString() + "px";

       document.getElementById('lyr15').style.left= left_1.toString() + "px";
       document.getElementById('lyr15').style.top=top_1.toString() + "px";

       document.getElementById('lyr16').style.left= left_1.toString() + "px";
       document.getElementById('lyr16').style.top=top_1.toString() + "px";
  }


}

function getDim(el){
	for (var lx=0,ly=0;el!=null;
	  lx+=el.offsetLeft,ly+=el.offsetTop,el=el.offsetParent);
	return {x:lx,y:ly}
}


var last_hilite2 = "";

function arrowSwap(id,arrow) {
 last_hilite2.src = "arrow_active.gif";
 arrow.src = "arrow_active.gif";
 last_hilite2 = arrow;
}




var tid, time, action;

//setInactivityTimer (1000, 'alert(message1 + (time / 1000) + message2);', true);
setInactivityTimer (120000, "init('lnk1','lyr1');", true);

function setInactivityTimer (time, action, repeat) {
//alert("in timer");
  window.time = time;
  window.action = action;
  window.repeat = repeat;
  if (tid) 
    clearTimeout(tid);
  if (document.layers)
    document.captureEvents(Event.MOUSEMOVE | Event.KEYUP);
  document.onmousemove = document.onkeyup =
    function (evt) {
      setInactivityTimer(window.time, window.action, window.repeat);
      return true;
    };
  if (repeat)
    action += '; setInactivityTimer(' + time + ', "' + action + '", ' + repeat + ');';
  else 
    action += '; clearEvents();';
  tid = setTimeout(action, time);
}

function clearEvents() {
  if (document.layers)
    document.releaseEvents(Event.MOUSEMOVE | Event.KEYUP);
  document.onmousemove = document.onkeyup = null;
}

// =================================
//test zone







//-->