var layerRef;
var layerStyle;
var menuName;
var visible;
var invisible;
var width;
var height;
var imageOn;
imageOn = "";
menuName = "";

function IdentifyBrowser(){
	this.ua=navigator.userAgent;
	this.ver=navigator.appVersion;
	this.dom=document.getElementById?1:0;
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns6=(this.ua.indexOf("Netscape6")>-1 && this.dom)?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5);
	return this;
}
var brw=new IdentifyBrowser();

if (brw.ns4) {
  document.captureEvents(Event.MOUSEMOVE);
  layerRef = 'document.layers[';
  layerStyle = "]";
  visible = 'show';
  invisible = 'hide';
  width = '.clip.width';
  height = '.clip.height';  
}
if (brw.ns6) {
  document.captureEvents(Event.MOUSEMOVE);
  layerRef = 'document.getElementById(';
  layerStyle = ").style";
  visible = 'visible';
  invisible = 'hidden';
  width = '.width';
  height = '.height';
}
if (brw.ie4) {
  layerRef = 'document.all[';
  layerStyle = "].style";
  visible = 'visible';
  invisible = 'hidden'; 
  width = '.width';
  height = '.height';
}
if (brw.ie5) {
  layerRef = 'document.getElementById(';
  layerStyle = ").style";
  visible = 'visible';
  invisible = 'hidden';
  width = '.width';
  height = '.height';
}
document.onmousemove = mouseMove;

function mouseMove(e){
	if(brw.ie4 || brw.ie5){menuOffTaf(event.x,event.y);}
	if(brw.ns4 || brw.ns6){menuOffTaf(e.pageX,e.pageY);}
}

function hide(layerName){
eval(layerRef+'"'+layerName+'"'+layerStyle+'.visibility="'+invisible+'"');
}

function show(layerName){
eval(layerRef+'"'+layerName+'"'+layerStyle+'.visibility="'+visible+'"');
}

function menuOnTaf(lName, imgName){
		if (menuName.length) hide(menuName);
		if (imageOn.length) turnOffTaf(imageOn);
		if (imgName.length) turnOnTaf(imgName);
		menuName = lName;
		show(menuName);
		imageOn = imgName;
}

function menuOffTaf(xcord,ycord){
	var left,right,top,bottom;
		//document.xy.mx.value=xcord;
		//document.xy.my.value=ycord;
if(menuName.length){
		left = parseInt(eval(layerRef+'"'+menuName+'"'+layerStyle+'.left'));
		right = left + parseInt(eval(layerRef+'"'+menuName+'"'+layerStyle+width));
		top = parseInt(eval(layerRef+'"'+menuName+'"'+layerStyle+'.top'));
		bottom = top + parseInt(eval(layerRef+'"'+menuName+'"'+layerStyle+height));
		//alert(left+','+right+','+top+','+bottom+','+xcord+','+ycord);
	if ((xcord <= left - intLeftAdjust_taf)||(xcord >= right + intRightAdjust_taf)||(ycord <= top-intImageHeight_taf)||(ycord >=(bottom + intImageHeight_taf))){ 
			if (imageOn){turnOffTaf(imageOn)};
			imageOn = "";
			hide(menuName);
			menuName = "";}}
}
	
	ready_taf = "yes";

