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

var layerRefChild;
var layerStyleChild;
var menuNameChild;
var visibleChild;
var invisibleChild;
var widthChild;
var heightChild;
menuNameChild = "";

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';  
  layerRefChild = 'document.layers[';
  layerStyleChild = "]";
  visibleChild = 'show';
  invisibleChild = 'hide';
  widthChild = '.clip.width';
  heightChild = '.clip.height';  
}
if (brw.ns6) {
  document.captureEvents(Event.MOUSEMOVE);
  layerRef = 'document.getElementById(';
  layerStyle = ").style";
  visible = 'visible';
  invisible = 'hidden';
  width = '.width';
  height = '.height';    
  layerRefChild = 'document.getElementById(';
  layerStyleChild = ").style";
  visibleChild = 'visible';
  invisibleChild = 'hidden';
  widthChild = '.width';
  heightChild = '.height';
}
if (brw.ie4) {
  layerRef = 'document.all[';
  layerStyle = "].style";
  visible = 'visible';
  invisible = 'hidden'; 
  width = '.width';
  height = '.height';
    layerRefChild = 'document.all[';
  layerStyleChild = "].style";
  visibleChild = 'visible';
  invisibleChild = 'hidden'; 
  widthChild = '.width';
  heightChild = '.height'
}
if (brw.ie5) {
  layerRef = 'document.getElementById(';
  layerStyle = ").style";
  visible = 'visible';
  invisible = 'hidden';
  width = '.width';
  height = '.height';  layerRefChild = 'document.getElementById(';
  layerStyleChild = ").style";
  visibleChild = 'visible';
  invisibleChild = 'hidden';
  widthChild = '.width';
  heightChild = '.height';
}
document.onmousemove = mouseMove;
  
function mouseMove(e){
	if(brw.ie4 || brw.ie5){menuOffGalleryChild(event.x,event.y);}
	if(brw.ns4 || brw.ns6){menuOffGalleryChild(e.pageX,e.pageY);}
	if(brw.ie4 || brw.ie5){menuOffGallery(event.x,event.y);}
	if(brw.ns4 || brw.ns6){menuOffGallery(e.pageX,e.pageY);}
}

function hideGalleryChild(layerNameChild){
eval(layerRefChild+'"'+layerNameChild+'"'+layerStyleChild+'.visibility="'+invisibleChild+'"');
}

function showGalleryChild(layerNameChild){
eval(layerRefChild+'"'+layerNameChild+'"'+layerStyleChild+'.visibility="'+visibleChild+'"');
}

function menuOnGalleryChild(lNameChild){
		if (menuNameChild.length) hideGalleryChild(menuNameChild);
		menuNameChild = lNameChild;
		showGalleryChild(menuNameChild);
}

function menuOffGalleryChild(xcord,ycord){
	var left,right,top,bottom;
		//document.xy.mx.value=xcord;
		//document.xy.my.value=ycord;
if(menuNameChild.length){
		left = parseInt(eval(layerRefChild+'"'+menuNameChild+'"'+layerStyleChild+'.left'));
		right = left + parseInt(eval(layerRefChild+'"'+menuNameChild+'"'+layerStyleChild+widthChild));
		top = parseInt(eval(layerRefChild+'"'+menuNameChild+'"'+layerStyleChild+'.top'));
		bottom = top + parseInt(eval(layerRefChild+'"'+menuNameChild+'"'+layerStyleChild+heightChild));
		//alert(left+','+right+','+top+','+bottom+','+xcord+','+ycord);
	if ((xcord <= left - intLeftAdjust_galleryChild)||(xcord >= right + intRightAdjust_galleryChild)||(ycord <= top-intImageHeight_galleryChild)||(ycord >=(bottom + intImageHeight_galleryChild))){ 
			hideGalleryChild(menuNameChild);
			menuNameChild = "";}}
}
	
	ready_galleryChild = "yes";


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

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

function menuOnGallery(lName, imgName){
		if (menuName.length) hideGallery(menuName);
		menuName = lName;
		showGallery(menuName);
		imageOn = imgName;
}

function menuOffGallery(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_gallery)||(xcord >= right + intRightAdjust_gallery)||(ycord <= top-intImageHeight_gallery)||(ycord >=(bottom + intImageHeight_gallery))){ 
			imageOn = "";
			hideGallery(menuName);
			menuName = "";}}
}
	
	ready_gallery = "yes";

