var myWidth, myHeight, ratio
   function ShowHide(EltId,Action) {
  var elt = document.getElementById(EltId); if (!elt) return;
  Action = (typeof Action=="undefined" ) ? "" : Action.substring(0,1).toLowerCase();
  with(elt.style) {
   display = (Action=="" ) ? (display=="block" || display=="" ) ? "none" : "block" : (Action=="h" ) ? "none" : "block";
  }

if (elt.style.display=="none")
{
document.getElementById("Caselect").style.display="block"
}
    }


function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function affVg(imagefile,myW,myH, nom,ndiv){


	
	ratio = (document.getElementById(ndiv).width) / (document.getElementById(ndiv).height);

if(ratio>=1) {
myWidth = 250;
myHeight = Math.round(250/ratio) ;
}
else
{
myWidth = Math.round(250*ratio)  ;
myHeight = 250;
}


	
	newHTML = '<div style="padding: 0px; background: #FFFFFF"; border: solid #777 1px;> ';
	newHTML = newHTML + '<table border=0 cellspacing="8" cellpadding="0" bgcolor="#FFFFFF">';
  	newHTML = newHTML + '<tr><td style=" background: url(/images/loading.gif); background-repeat: no-repeat; background-position: center;" align="center"><img src='+imagefile + ' width=' + myWidth + ' height=' + myHeight + ' border=0 id=nimg></td>';
    newHTML = newHTML + '</tr><tr><td nowrap style="font-size: 11pt;  font-family: Arial, Helvetica, sans-serif; color: #000000;">' + nom.replace("_","'") + '</td></tr></table>';
	newHTML = newHTML + '</div>';

	
document.getElementById('trailimageid').innerHTML = newHTML;
document.onmousemove=followmouse;
}


function maskVg(){


var Getobj = document.getElementById("trailimageid");
	Getobj.style.visibility= 'hidden';
	document.onmousemove= '';
}

function followmouse(e) {
	
	var docwidth =document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-25
	var docheight =document.all? truebody().scrollHeight+truebody().clientHeight : pageYOffset+window.innerHeight-25


	

	 if (navigator.appName=="Microsoft Internet Explorer"){	
var docheight = document.documentElement.offsetHeight + document.body.scrollTop;
e = window.event;
			}
	
	x=20, y=20;
		
	x+= e.clientX +  Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);
	y+= e.clientY + Math.max(document.body.scrollTop,document.documentElement.scrollTop);
	

if ((x+myWidth)>(docwidth-3)) {
x=x-document.getElementById("trailimageid").offsetWidth-25;
}
if ((y+myHeight)>(docheight-3)) {
y = y - document.getElementById("trailimageid").offsetHeight-25;
}

document.getElementById('trailimageid').style.left=x+'px';
document.getElementById('trailimageid').style.top=y+'px';

var Getobj = document.getElementById("trailimageid");
Getobj.style.visibility="visible";

}


