divForPopUpImage = null;


var DeltaXAxle=20;
var DeltaYAxle=20;

function TracePositionOfCursor(e)
{
	x1 = (document.all) ? window.event.clientX + truebody().scrollLeft : e.pageX;
	y1 = (document.all) ? window.event.clientY + truebody().scrollTop : e.pageY;
	if (divForPopUpImage != null&&divForPopUpImage.style.display!="none")
	{
		divForPopUpImage.style.left = (x1 + DeltaXAxle) + "px";
		divForPopUpImage.style.top = (y1 +DeltaYAxle) + "px";	
	}
}
function TracePositionOfCursorWithCorrection(e)
{
	x = (document.all) ? window.event.clientX + truebody().scrollLeft : e.pageX;
	y = (document.all) ? window.event.clientY  : e.pageY-truebody().scrollTop;
//    x = (document.all) ? window.event.clientX : e.pageX-truebody().scrollLeft;
//	y = (document.all) ? window.event.clientY  : e.pageY-truebody().scrollTop;
	x1=x;
	y1=y;
	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)
	
		//alert(x+'|'+y+' window='+docwidth+'|'+docheight);
		/*if (docwidth - x1 < Pop_UpDivWidth){
			x1 = x1 - DeltaXAxle - Pop_UpDivWidth;
		} else {
			x1 += DeltaXAxle;
		}*/
		if(Pop_UpDivWidth>0)
		x1 -= DeltaXAxle+Pop_UpDivWidth+50;
		else
		x1+=DeltaXAxle;
		if (docheight - y1 <Pop_UpDivHeight ){
			y1 = docheight -Pop_UpDivHeight+truebody().scrollTop-50;
		} else {
			y1 += DeltaYAxle+truebody().scrollTop;
		}



	if(y1 < 0) {y1 = y;}
	if (divForPopUpImage != null&&divForPopUpImage.style.display!="none")
	{
		divForPopUpImage.style.left = x1+ "px";
		divForPopUpImage.style.top = y1 + "px";	
	}
}
function ShowPopUpDiv(id,logofile, transparency,imgContainerID)
{
    document.onmousemove = TracePositionOfCursor;
	var TransparencyValue=90;
	if(transparency)
	TransparencyValue=transparency;
	var AbsoluteTransparencyValue=(TransparencyValue/100);
	if(divForPopUpImage==null)
	{
		divForPopUpImage=document.getElementById(id);
	}
	var imgContainer=document.getElementById(imgContainerID);
	if(logofile)
	{
	if(imgContainer)
	imgContainer.innerHTML='<img src="'+logofile+'" style="-moz-opacity: '+AbsoluteTransparencyValue+';filter: alpha(Opacity='+TransparencyValue+');">';
	else
	divForPopUpImage.innerHTML='<img src="'+logofile+'" style="-moz-opacity: '+AbsoluteTransparencyValue+';filter: alpha(Opacity='+TransparencyValue+');">';
	}
	divForPopUpImage.style.position = "absolute";
	divForPopUpImage.style.display = "block";
	divForPopUpImage.style.visibility = "visible";
	
}
function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
var Pop_UpDivHeight=0,Pop_UpDivWidth=0;

function ShowPopUpDivWithComment(id,logofile, transparency, imgDivID, commentDivID, comment, width,height)
{
	var TransparencyValue=90;
	if(transparency)
	TransparencyValue=transparency;
	var AbsoluteTransparencyValue=(TransparencyValue/100);
	if(divForPopUpImage==null)
	{
		divForPopUpImage=document.getElementById(id);
		
	}
	
	if(logofile)
	{
	var imgDiv=document.getElementById(imgDivID);
	imgDiv.innerHTML='<img src="'+logofile+'" style="-moz-opacity: '+AbsoluteTransparencyValue+';filter: alpha(Opacity='+TransparencyValue+');">';
	var commentDiv=document.getElementById(commentDivID);
	if(comment)
	commentDiv.innerHTML=comment;
	else
	commentDiv.style.display="none";
	
	}
	if(window.ActiveXObject&&width==0)
	{
        x1 = window.event.clientX + truebody().scrollLeft;
	    y1 = window.event.clientY + truebody().scrollTop;
	    if(width>0)
	    x1 -= DeltaXAxle+width+50;
		divForPopUpImage.style.left = (x1 + DeltaXAxle) + "px";
		divForPopUpImage.style.top = (y1 +DeltaYAxle) + "px";	
    }
	if(height>0)
{
    document.onmousemove = TracePositionOfCursorWithCorrection;
    Pop_UpDivHeight=height;
    Pop_UpDivWidth=width;
    }
    else
    document.onmousemove = TracePositionOfCursor;
    
	divForPopUpImage.style.position = "absolute";
	divForPopUpImage.style.display = "block";
	divForPopUpImage.style.visibility = "visible";
	
}

function HidePopUpDiv() {
if(divForPopUpImage)
{
	divForPopUpImage.style.display = "none";
	divForPopUpImage=null;
	document.onmousemove = null;
	}
	
}




