﻿//-----------------------------------------------------------------------------
// Author   : Sudipta Das
// Date     : 18-Nov-2008
// Purpose  : This script is to show a pop-up image.
//-----------------------------------------------------------------------------
function Large(obj)
{
    var imgbox=document.getElementById("imgbox");
    imgbox.style.visibility='visible';
    var img = document.createElement("img");    
    img.src=obj.name;
    img.style.width=img.width;
    img.style.height=img.height;
    
    if(img.addEventListener){
        img.addEventListener('mouseout',Out,false);
    } else {
        img.attachEvent('onmouseout',Out);
    }        
    imgbox.width=img.width;
    imgbox.height=img.height;
    imgbox.innerHTML='';    
    imgbox.appendChild(img);   
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
    imgbox.style.left=((myWidth / 2) - (img.width / 2)) +'px';
    imgbox.style.top=(520 - (img.height / 2)) + 'px';     
    //imgbox.style.left=((innerWidth / 2) - (img.width / 2) + 'px';
    //imgbox.style.top=((innerHeight / 2) - (img.width / 2) + 'px';     
}  

function Out()
{
    document.getElementById("imgbox").style.visibility='hidden';
}

function Move(obj,e)
{
    var mouseY=e.clientY;
    alert(e.x)
    var mouseX=e.clientX; 
    var scrollTop=document.documentElement.scrollTop; 
    var scrollLeft=document.documentElement.scrollLeft;
    var y=scrollTop+mouseY+20;
    var x=scrollLeft+mouseX+20; 
    document.getElementById("imgbox").style.left=x + "px";
    document.getElementById("imgbox").style.top=y + "px";
}

function getElementLeft(elm) 
{
    var x = 0;

    //set x to elm’s offsetLeft
    x = elm.offsetLeft;

    //set elm to its offsetParent
    elm = elm.offsetParent;

    //use while loop to check if elm is null
    // if not then add current elm’s offsetLeft to x
    //offsetTop to y and set elm to its offsetParent

    while(elm != null)
     {
        x = parseInt(x) + parseInt(elm.offsetLeft);
        elm = elm.offsetParent;
     }
     
     return x;
}

function getElementTop(elm) 
{
    var y = 0;

    //set x to elm’s offsetLeft
    y = elm.offsetTop;

    //set elm to its offsetParent
    elm = elm.offsetParent;

    //use while loop to check if elm is null
    // if not then add current elm’s offsetLeft to x
    //offsetTop to y and set elm to its offsetParent

    while(elm != null)
     {
        y = parseInt(y) + parseInt(elm.offsetTop);
        elm = elm.offsetParent;
     }
     
     return y;
}

/* -- Capture date from calendar popup window -- */


