var ie = document.all ? 1 : 0
var ns = document.layers ? 1 : 0

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

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

if(ie){
  Ex = "event.x"
  Ey = "event.y"
  topColor = "#A1330E"
  subColor = "#EDCFAB"
}
if(ns){
  Ex = "e.pageX"
  Ey = "e.pageY"
  window.captureEvents(Event.MOUSEMOVE)
  window.onmousemove=overhere
  topColor = "#A1330E"
  subColor = "#EDCFAB"
}

function MoveToolTip(layerName, FromTop, FromLeft, e){
  if(ie){
	  eval(doc + layerName + sty + ".top = "  + (eval(FromTop) + document.body.scrollTop))
	}
	if(ns){
	  eval(doc + layerName + sty + ".top = "  +  eval(FromTop))
	}
	eval(doc + layerName + sty + ".left = " + (eval(FromLeft) + 15))
}

function ReplaceContent(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
}

function overhere(e){
  if(initialize){
	  MoveToolTip("ToolTip", Ey, Ex, e)
		eval(doc + "ToolTip" + sty + ".visibility = 'visible'")
	}
  else{
	  MoveToolTip("ToolTip", 0, 0)
		eval(doc + "ToolTip" + sty + ".visibility = 'hidden'")
	}
}

function EnterContent(layerName, TTitle, TContent, colorSet){
  var headingColor, contentColor
	
  if (colorSet == "2") {
	  headingColor="tool_tip_heading_02"
		contentColor="tool_tip_content_02"
	}
  else {
  	if (colorSet == "1") {
  	  headingColor="tool_tip_heading_01"
  		contentColor="tool_tip_content_01"
  	}
  	else {
  	  headingColor="tool_tip_heading_00"
  		contentColor="tool_tip_content_00"
  	}
	}

  ContentInfo = '<table class="tool_tip_table" cellspacing="1" cellpadding="0">'+
	'<tr><td class='+headingColor+'>'+TTitle+'</td></tr>'+
	'<tr><td class='+contentColor+'>'+TContent+'</td></tr>'+
	'</table>';
	ReplaceContent(layerName)
}
