var ie = document.all ? 1 : 0
//var ns = document.getElementById && !document.all
var ns = document.layers ? 1 : 0
var doc = ""
var sty = "" 

if(ns){doc = "document."; sty = ""}
if(ie){doc = "document.all."; sty = ".style"}

var initialize = 0
var Ex, Ey, topColor, subColor, ContentInfo

var w_y, w_x

//if(ns) {document.captureEvents(Event.MOUSEMOVE)}
if(ie){
	Ex = "event.x"
    Ey = "event.y"
} else {
	Ex = "e.clientX"
	Ey = "e.clientY"
	document.captureEvents(Event.MOUSEMOVE)
	document.onmousemove=overhere
}

function MoveToolTip(layerName, fromTop, fromLeft, e){
	var ttx, ttWidth, winWidth, ttY, ttHeight, winHeight
	
	ttX = eval(fromLeft)+8
	ttY = eval(fromTop)
	ttWidth  = document.getElementById("ToolTip").offsetWidth
	ttHeight = document.getElementById("ToolTip").offsetHeight
	
	if(ie) {
		winWidth  = eval(document.body.clientWidth+document.body.scrollLeft)
		winHeight = eval(document.body.clientHeight)
		if ((ttX+ttWidth)>winWidth) {ttX = eval(ttX-ttWidth-20)} 
		if ((ttY+ttHeight)>winHeight) {ttY = Math.max(eval(winHeight-ttHeight),0)}
		eval(doc + layerName + sty + ".top = "  + ( eval(ttY) + document.body.scrollTop) )
	} else {
		winWidth  = eval(window.innerWidth-10)
		winHeight = eval(window.innerHeight)
		if ((ttX+ttWidth)>winWidth) {ttX = eval(ttX-ttWidth-20)}
		if ((ttY+ttHeight)>winHeight) {ttY = Math.max(eval(winHeight-ttHeight),0)}
		document.getElementById("ToolTip").style.top = (ttY + window.pageYOffset)
	}
	
	document.getElementById("ToolTip").style.left = ttX+1
}

function ReplaceContent(layerName){
  document.getElementById("ToolTip").innerHTML = ContentInfo
}

function ReplaceContentold(layerName){
	if(ie){document.all[layerName].innerHTML = ContentInfo}
	if(ns){
		with(document.layers[layerName].document) 
		{ 
		   open(); 
		   write(ContentInfo); 

		   close(); 
		}
	}
}


function Activate(){initialize=1}

function deActivate(){
	initialize=0
	self.status = ""
}

function overhere(e)
{
	if(initialize){
		MoveToolTip("ToolTip", Ey, Ex, e)
        document.getElementById("ToolTip").style.visibility = 'visible'
   		self.status = "Click The Pik To Zoom In!"
	}
	else{
		MoveToolTip("ToolTip", 0, 0)
        document.getElementById("ToolTip").style.visibility = 'hidden'
	}
}

function EnterContent(layerName, TTitle, TContent){
topColor = "#000077"
subColor = "#ffffff"

ContentInfo = '<table border="0" cellspacing="0" cellpadding="0">'+
'<tr><td width="100%" bgcolor="#000000">'+

'<table border="0" width="100%" cellspacing="1" cellpadding="0">'+
'<tr><td width="100%" bgcolor='+topColor+'>'+

'<table border="0" width="98%" cellspacing="0" cellpadding="0" align="center">'+
'<tr><td width="100%" align="center">'+

'<font class="tooltiptitle">&nbsp;'+TTitle+'</font>'+

'</td></tr>'+
'</table>'+

'</td></tr>'+

'<tr><td width="100%" bgcolor='+subColor+'>'+

'<table border="0" width="98%" cellpadding="0" cellspacing="0" align="center">'+

'<tr><td class="loader" width="100%" align="center" background="images/loading.gif">'+

'<img src="'+TContent+'" alt="Loading Image.. Please Wait">'+

'</td></tr>'+
'</table>'+

'</td></tr>'+
'</table>'+

'</td></tr>'+
'</table>';


ReplaceContent(layerName)

}

