var dom = document.getElementById ? true:false;
var nn4 = document.layers ? true:false;
var ie4 = document.all ? true:false;
var mouseY;
var mouseX;
var wCurrentText='';

function reloadPage(init) {
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
reloadPage(true);

function fO(n, d) { 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=fO(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function switch_layer() { 
  var i,p,v,obj,args=switch_layer.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=fO(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function setText(objName,x,newText) { 
  if ((obj=fO(objName))!=null) with (obj)
    if (navigator.appName=='Netscape') {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}
function getMouse(){
	if(ie4){
		mouseY =  event.clientY + document.body.scrollTop ;
		mouseX =  event.clientX + document.body.scrollLeft;
	}
	else if(nn4 || dom){
		mouseY = e.pageX + document.body.scrollTop ;
		mouseX = e.pageY + document.body.scrollLeft;
		
	}
}
function correct_pos() {

	getMouse();
	if (mouseX<500) {
		deltaX=10;
	} else {
		deltaX=120;
	}
	if(ie4) {
		document.all.hint.style.pixelLeft = mouseX-deltaX;
		document.all.hint.style.pixelTop  = mouseY+5; 	
	}
	else if(nn4) {
		document.hint.left   = mouseX-deltaX;
		document.hint.top    = mouseY+5;			
		}       
		else if(dom) {
			document.getElementById("hint").style.left = mouseX-deltaX;
			document.getElementById("hint").style.top  = mouseY+5;
		}
}


function showPopWnd (sText) {
	correct_pos();
	switch_layer('hint','','show');
	var sLine = '<table class="poptable" width="100%" cellspacing="1" cellpadding="1" align="center">';
	sLine = sLine + '<tr>';
	sLine = sLine + '<td class="pop">'+sText+'</td>';
	sLine = sLine + '</tr>';
	sLine = sLine + '</table>'
	setText('hint','',sLine);
	wCurrentText=sText;
}

function off() {
	if (wCurrentText=='') {
		switch_layer('hint','','hide');
	}
}



