// POPUP TOOLTIP WITH LOGO
var dom = (document.getElementById)?true:false
var ns5 = (!document.all && dom || window.opera)?true:false
var ie5 = ((navigator.userAgent.indexOf('MSIE')>-1) && dom)?true:false
var ie4 = (document.all && !dom) ? true:false
var nodyn = (!ns5 && !ie4 && !ie5 && !dom)?true:false

var origWidth, origHeight

if (nodyn) { event='nope' }

var offX=50
var offY=46

var tooltip, tipcss, prevmousemove
function initTip() {
	if (nodyn) return
	tooltip = (ie4)?document.all['tipDiv']:(ie5||ns5)?document.getElementById('tipDiv'):null
	tipcss = tooltip.style
	if (tooltip) {
		prevmousemove = document.onmousemove
		document.onmousemove = trackMouse
	}
}

var t1,t2
var tipOn = false
function doTooltip(evt,id,file,w,h,bg,nocache) {
	if (!tooltip) return

	var e
	if (typeof(id) == 'string') {
		e = el(id)
		if (!e) return
		if (file) {
			file = el(file)
			if (file && (file.value <= 0)) return
		}

		id = e.value.split("\n")
		file = id[0]
		if (!file) return
		w = id[1]
		h = id[2]
		nocache = 1
	}else {
		e = el('mpro'+id)
		if (e && !e.style.display) return
	}
	if (t1) clearTimeout(t1)
	if (t2) clearTimeout(t2)

	tipOn = true
	if (ie4||ie5||ns5) {
		var img = '<img src="'+file+(nocache?'?rnd='+Math.random() : '')+'"'+(w?' width='+w:'')+(h?' height='+h:'')+' border=0 />'
		tooltip.innerHTML = (w && h && bg) ? '<div style="position:absolute; background-color:#eee; z-index:2; width:'+(w+8)+'; height:'+(h+8)+'; filter:alpha(opacity='+bg+');-moz-opacity:.'+bg+';opacity:.'+bg+'"></div><div style="padding:4px; position:absolute; z-index:3;">'+img+'</div>' : img
	}
	positionTip(evt)
	t1=setTimeout("tipcss.visibility='visible'",100)
}

var mouseX, mouseY, stdbody
function trackMouse(evt) {
	stdbody=(document.compatMode=='CSS1Compat')? document.documentElement : document.body
	if (stdbody) {
		mouseX = (ns5)? evt.pageX: window.event.clientX + stdbody.scrollLeft
		mouseY = (ns5)? evt.pageY: window.event.clientY + stdbody.scrollTop
	}
	if (tipOn) positionTip(evt)
	if (prevmousemove) prevmousemove(evt)
}

function positionTip(evt) {
        if (!stdbody) return false

	var tpWd = (ie4||ie5)? tooltip.clientWidth: tooltip.offsetWidth
	var tpHt = (ie4||ie5)? tooltip.clientHeight: tooltip.offsetHeight

	var winWd = (ns5)? window.innerWidth-20+window.pageXOffset: stdbody.clientWidth+stdbody.scrollLeft
	var winHt = (ns5)? window.innerHeight-20+window.pageYOffset: stdbody.clientHeight+stdbody.scrollTop

	if ((mouseX+offX+tpWd)>winWd)
		tipcss.left = mouseX-(tpWd+offX)+'px'
	else tipcss.left = mouseX+offX+'px'
	if ((mouseY+offY+tpHt)>winHt)
		tipcss.top = winHt-(tpHt+offY)+'px'
	else tipcss.top = mouseY+offY+'px'
}

function hideTip() {
	if (!tooltip) return
	t2=setTimeout("tipcss.visibility='hidden'",100)
	tipOn = false
}

document.write('<div id=tipDiv style="position:absolute;visibility:hidden;z-index:100"></div>')