// Browser Check
ie=document.all
iens6=ie||document.getElementById
// GLOBALS
showed=0
winWidth=0
x=0
y=0
ytop=0
xleft=0
popoffbottom=0
popofftop=0
popofflow=0
winH=-1000
stayOnTop=0
stayOnBottom=0
stayOnLeft=0
stayOnRight=0
var intervalID; 
// END GLOBALS

function stopIt() {
 showed=0
 if (menObj) {
	menObj.className='popOff'
	menObj.innerHTML = ""
 }
 // if (document.getElementById) document.getElementById('midrow').className='hideImg'
}


function hideFloat() {
 if (FltMenObj) {
	FltMenObj.className='popOff'
	FltMenObj.innerHTML = ""
 }
}

function getXYie(e) {
	x=0; y=0
	x=event.x; y=event.y
	if (showed) {
		if ((y<stayOnTop)||(y>stayOnBottom)||(x<stayOnLeft)||(x>stayOnRight)) stopIt()
        }
}

function getXYns6(e) {
	x=0; y=0
	x=e.pageX; y=e.pageY
	if (showed) {
		if ((y<stayOnTop)||(y>stayOnBottom)||(x<stayOnLeft)||(x>stayOnRight)) stopIt()
	}
}


 if (ie) { 
	if (window.event!='undefined') document.onmousemove=getXYie
 } else {
	if (iens6) document.onmousemove=getXYns6
 }



function showPop(msg) { // for side menu
	if (!iens6) return
	popx=x; popy=y; var yscroll=0
	if (((document.body.scrollLeft)||(document.body.scrollTop))&&(ie)) {
		yscroll=document.body.scrollTop
		popx=popx+document.body.scrollLeft
		popy=popy+yscroll
	}
	xleft=120; ytop=popy-10
 	if (document.getElementById('pop')) {
		menObj=document.getElementById('pop')
		menObj.style.top = ytop 
		menObj.style.left = xleft
		menObj.innerHTML=msg
		menObj.className='popOn'
	}
}



function showFloatIECM() {
 	if (document.getElementById('bottom')) {
		FltMenObj=document.getElementById('bottom')
		FltMenObj.style.paddingBottom='0px';
		FltMenObj.style.top = document.documentElement.scrollTop+document.documentElement.clientHeight-FltMenObj.clientHeight;
		FltMenObj.style.left = '5%'
	}
}


function showFloatIE() {
 	if (document.getElementById('bottom')) {
		FltMenObj=document.getElementById('bottom')
		FltMenObj.style.paddingBottom='0px';
		FltMenObj.style.top = document.body.scrollTop+document.body.clientHeight-FltMenObj.clientHeight;
		FltMenObj.style.left = '5%'
	}
}


function showFloatNS() {
 	if (document.getElementById('bottom')) {
		winH = window.innerHeight;
		yscroll=0
		FltMenObj=document.getElementById('bottom')
		FltMenObj.style.top = window.scrollY+winH-56
		FltMenObj.style.left = '5%'
	}
}


function pop(msgNo,posn) {
	if (!iens6) return
	msg=getMenu(msgNo,"../")
	popCell='cell'+msgNo
 	if (document.getElementById(popCell)) {
		var xscroll=0; var yscroll=0;
		if (((document.body.scrollLeft)||(document.body.scrollTop))&&(ie)) {
			xscroll=document.body.scrollLeft
			yscroll=document.body.scrollTop
		}
		xleft=0
		ytop=0
		tableObj=document.getElementById('topTable')
		if (tableObj.offsetParent) {
			tableLeft=tableObj.offsetLeft
			tableTop=tableObj.offsetTop
		}
		cellObj=document.getElementById(popCell)
		if (cellObj.offsetParent) {
			cellLeft=cellObj.offsetLeft
			cellTop=cellObj.offsetTop
		}
		menObj=document.getElementById('pop')
		var menuTop=tableTop+cellTop+13
		menObj.style.top = menuTop
		var menuLeft=tableLeft+cellLeft
		if (posn>1) menuLeft = menuLeft-200+document.getElementById(popCell).offsetWidth
		menObj.style.left = menuLeft
		menObj.innerHTML=msg
		menObj.className='topPopOn'
		showed=1
		var popupWidth=menObj.offsetWidth
		var popupHeight=menObj.offsetHeight
		stayOnTop=menuTop-yscroll-23
		stayOnBottom=stayOnTop+popupHeight+30
		stayOnLeft=menuLeft-xscroll
		stayOnRight=stayOnLeft+popupWidth
	}
}


if (ie) {
	if (typeof document.compatMode!='undefined'&&document.compatMode!='BackCompat') {
		intervalID = setInterval(showFloatIECM, 250);
	} else {
		intervalID = setInterval(showFloatIE, 250);
	}
} else {
	intervalID = setInterval(showFloatNS, 250);
}
//alert('Win height='+document.body.offsetHeight+'. Scroll Top='+document.body.scrollTop)
