//<!-- 
/*
hoverText.js 
HoverText support javascript for HoverText in realm
Based on the DHTML tip message version 1.2 from  DHTML tip message version 1.2 copyright Essam Gamal 2003 (http://migoicons.tripod.com, migoicons@hotmail.com)
Modified to suite realm by JCL 20 Nov 2005

To avoid variable mixture, all variables for this module is started with "ht"
*/

var ht_ua = navigator.userAgent
var ht_ps = navigator.productSub 

var ht_dom = (document.getElementById)? 1:0
var ht_ie4 = (document.all&&!ht_dom)? 1:0
var ht_ie5 = (document.all&&ht_dom)? 1:0
var ht_nn4 =(navigator.appName.toLowerCase() == "netscape" && parseInt(navigator.appVersion) == 4)
var ht_nn6 = (ht_dom&&!ht_ie5)? 1:0
var ht_sNav = (ht_nn4||ht_nn6||ht_ie4||ht_ie5)? 1:0

// cssFilters is not used in this model.
// var cssFilters = ((navigator.userAgent.indexOf("MSIE 5.5")>=0||navigator.userAgent.indexOf("MSIE 6")>=0)&&navigator.userAgent.indexOf("Opera")<0)? 1:0
// In realm mode, every hoverText on a page is Div tag with ID, in this case we don't need Style and Text arrays

var ht_Count=0,ht_sbw=0,ht_move=0,ht_mx,ht_my,ht_scl,ht_sct,ht_ww,ht_wh,ht_obj,ht_sl,ht_st,ht_ih,ht_iw,ht_vl,ht_hl,ht_sv,ht_tbody

var ht_Hide = "eval(ht_obj+ht_sv+ht_hl+';'+ht_obj+ht_sl+'=0;'+ht_obj+ht_st+'=-800')"
var doc_root = ((ht_ie5&&navigator.userAgent.indexOf("Opera")<0||ht_ie4)&&document.compatMode=="CSS1Compat")? "document.documentElement":"document.body"
var PX = (ht_nn6)? "px" :"";

if(ht_sNav) {
	// window.onresize = ReloadTip
	// document.onmousemove = MoveTip
	//document.onmousemove = ShowMove
	if(ht_nn4) document.captureEvents(Event.MOUSEMOVE) 
}

function ht_TestVars()
{
	//document.onmousemove = ShowMove 
	//window.status = ht_Hide
	// alert("ht_ie4="+ht_ie4+",ht_ie5="+ht_ie5+",ht_nn4="+ht_nn4+",ht_nn6="+ht_nn6)
}

function ShowMove(e)
{
	//window.status='OK'
}

function ht_SetUpObject(hoverTextID){
    if(ht_nn4||ht_nn6) {
	    ht_mx = "e.pageX"
	    ht_my = "e.pageY"
	    ht_scl = "window.pageXOffset"
	    ht_sct = "window.pageYOffset"	
	    if(ht_nn4) {
		    ht_obj = "document." + hoverTextID + "."
		    ht_sl = "left"
		    ht_st = "top"
		    ht_ih = "clip.height"
		    ht_iw = "clip.width"
		    ht_vl = "'show'"
		    ht_hl = "'hide'"
		    ht_sv = "visibility="
	    }
	    else ht_obj = "document.getElementById('" + hoverTextID + "')."
    } 
    if(ht_ie4||ht_ie5) {
	    ht_obj = hoverTextID + "."
	    //ht_mx = "event.x"
	    //ht_my = "event.y"
	    ht_mx = "event.clientX"
	    ht_my = "event.clientY"
	    
	    ht_scl = "eval(doc_root).scrollLeft"
	    ht_sct = "eval(doc_root).scrollTop"
	    if(ht_ie5) {
		    ht_mx = ht_mx+"+"+ht_scl 
		    ht_my = ht_my+"+"+ht_sct
	    }
    }
    if (ht_dom)
    {
		ht_obj = "document.getElementById('" + hoverTextID + "')."
    }
    if(ht_ie4||ht_dom){
	    ht_sl = "style.left"
	    ht_st = "style.top"
	    ht_ih = "offsetHeight"
	    ht_iw = "offsetWidth"
	    ht_vl = "'visible'"
	    ht_hl = "'hidden'"
	    ht_sv = "style.visibility="
    }
    if(ht_ie4||ht_ie5||ht_ps>=20020823) {
	    ht_ww = "eval(doc_root).clientWidth"
	    ht_wh = "eval(doc_root).clientHeight"
    }	 
    else { 
	    ht_ww = "window.innerWidth"
	    ht_wh = "window.innerHeight"
	    ht_sbw=15
    }	
    //alert(ht_obj);
}

function showHoverText(hoverTextID) {
    ht_SetUpObject(hoverTextID)
    
    ht_tbody = {
		Pos:'right', 
		Xpos:10,
		Ypos:10, 
		Width:parseInt(eval(ht_obj+ht_iw)+3+ht_sbw)
	} 
	
	ht_Count=0	
	ht_move=1
	// alert("ht_ie4="+ht_ie4+",ht_ie5="+ht_ie5+",ht_nn4="+ht_nn4+"ht_nn6="+ht_nn6)
}

function moveHoverText(e, hoverTextID) {
	
    ht_SetUpObject(hoverTextID)
	if(ht_move) {
		var X,Y,MouseX = eval(ht_mx),MouseY = eval(ht_my)
		
		ht_tbody.Height = parseInt(eval(ht_obj+ht_ih)+3)
		ht_tbody.wiw = parseInt(eval(ht_ww+"+"+ht_scl))
		ht_tbody.wih = parseInt(eval(ht_wh+"+"+ht_sct))
		switch(ht_tbody.Pos) {
			case "left" : 
			    X=MouseX-ht_tbody.Width-ht_tbody.Xpos; 
			    Y=MouseY+ht_tbody.Ypos; 
			    break;
			case "center": 
			    X=MouseX-(ht_tbody.Width/2); 
			    Y=MouseY+ht_tbody.Ypos; 
			    break;
			case "float": 
			    X=ht_tbody.Xpos+eval(ht_scl); 
			    Y=ht_tbody.Ypos+eval(ht_sct); 
			    break;	
			case "fixed": 
			    X=ht_tbody.Xpos; 
			    Y=ht_tbody.Ypos; 
			    break;
			default: 
			    X=MouseX+ht_tbody.Xpos; 
			    Y=MouseY+ht_tbody.Ypos;
			    break;
		}
		if(ht_tbody.wiw<ht_tbody.Width+X) X = ht_tbody.wiw-ht_tbody.Width
		/* always display the hoverText below mouse cursor, no need to check y agains window here
		
		if(ht_tbody.wih<ht_tbody.Height+Y+ht_sbw) {
			if(ht_tbody.Pos=="float"||ht_tbody.Pos=="fixed") Y = ht_tbody.wih-ht_tbody.Height-ht_sbw
			else Y = MouseY-ht_tbody.Height
		}
		
		*/
		if(X<0) X=0 
		// eval(ht_obj+"innerHTML="+ht_obj+"innerHTML + '<br>' + htX + ',' + htY")
		eval(ht_obj+ht_sl+"=X+PX;"+ht_obj+ht_st+"=Y+PX")
		ViewHoverText()
	}
}

function ViewHoverText() {
  	ht_Count++
	if(ht_Count == 1) {
 		eval(ht_obj+ht_sv+ht_vl)
  	}
}



function hideHoverText(hoverTextID) {
	if(ht_sNav) {
	    ht_SetUpObject(hoverTextID)
	    eval(ht_Hide)
	} 
}

//-->


