function showCalendar(id)
{
	popUpCalendar(id);
}

/*
* PopupImage / Popup function
* DIV for Image / Popup and Screen
*/
var idIMG="imgPopup";
var idBGD="imgScreen";
var idPOP="popupWin";
var idCON="popupCon";
document.write('<div id="'+idIMG+'" style="position:absolute; visibility:hidden;z-index:100"></div>');
document.write('<div id="'+idPOP+'" style="position:absolute; visibility:hidden;z-index:100;border: #888888 1px solid;background-color:#ffffff">'+
'<div style="position:relative;top:0;left:0;width:100%;height:20px;background-color:#888888;color:#ffffff;font:8pt Tahoma;line-height:20px;cursor:pointer;text-align:right" onclick="hidePopup()"><img src="../javascript/images/close.gif" title="Close window"></div>'+
'<div style="position:relative;top:0;left:0;width:0px;height:0px;overflow:auto" id="'+idCON+'"></div></div>');
document.write('<div id="'+idBGD+'" style="position:absolute; visibility:hidden;z-index:10"></div>');


function image_open(text,i)
{ 
   hideIMG();
   img2=new Image();
	img2.src=text;	
	t='<table bgcolor=#eeeeee cellpadding=0 cellspacing=0 title="Click to close" onclick="hideIMG()" style="border:#eeeeee 5px solid"><tr><td>';
	t+='<img src='+text+' style="border:#888888 1px solid" onload="adjustPopup(img2.width,img2.height)"></td><tr><td align=right style="cursor:pointer;font:8pt Tahoma;color:#000000">X Close</td></tr></table>';
   left1=((parseInt(getWinX())- parseInt(img2.width))/2)+parseInt(getScrX());
	top1=((parseInt(getWinY())- parseInt(img2.height))/2)+parseInt(getScrY());
	imgid=document.getElementById(idIMG);
	imgid.style.left = left1+'px';
	imgid.style.top = top1+'px';
	imgid.innerHTML= t;
	imgid.style.visibility = 'visible';
   showBGD();
}

function showIMG(text)
{ 
   hideIMG();
   img2=new Image();
	img2.src=text;	
	t='<table bgcolor=#eeeeee cellpadding=0 cellspacing=0 title="Click to close" onclick="hideIMG()" style="border:#eeeeee 5px solid"><tr><td>';
	t+='<img src='+text+' style="border:#888888 1px solid" onload="adjustPopup(img2.width,img2.height)"></td><tr><td align=right style="cursor:pointer;font:8pt Tahoma;color:#000000">X Close</td></tr></table>';
   left1=((parseInt(getWinX())- parseInt(img2.width))/2)+parseInt(getScrX());
	top1=((parseInt(getWinY())- parseInt(img2.height))/2)+parseInt(getScrY());
	imgid=document.getElementById(idIMG);
	imgid.style.left = left1+'px';
	imgid.style.top = top1+'px';
	imgid.innerHTML= t;
	imgid.style.visibility = 'visible';
   showBGD();
}


function hideIMG()
{
	hideid=document.getElementById(idIMG);
	hideid.style.height = '0px';
	hideid.style.width = '0px';
   hideid.style.left = '0px';
	hideid.style.top = '0px';
   hideid.style.visibility = 'hidden';	
	hideBGD();	
}

function showPopup(url,w,h)
{
	left1=((parseInt(getWinX())- parseInt(w))/2)+parseInt(getScrX());
	top1=((parseInt(getWinY())- parseInt(h))/2)+parseInt(getScrY());	
	
	pop=document.getElementById(idPOP);
	pop.style.width = w+'px';
	pop.style.height = (h+20)+'px';	
	
	pop.style.left = parseInt(left1)+'px';
	pop.style.top = parseInt(top1)+'px';
   pop.style.visibility = 'visible';	
   
   pop1=document.getElementById(idCON);
	pop1.style.width = w+'px';
	pop1.style.height = h+'px';
	loadPage(url,idCON);   
	
	showBGD();	
}
function hidePopup()
{
	hideid=document.getElementById(idPOP);	
	hideid.style.height = '0px';
	hideid.style.width = '0px';
   hideid.style.left = '0px';
	hideid.style.top = '0px';
   hideid.style.visibility = 'hidden';	
	hideBGD();	
}
function showWindow(url,w,h)
{
	left1=((parseInt(getWinX())- parseInt(w))/2);
	top1=((parseInt(getWinY())- parseInt(h))/2);
	w = w+20;
	h = h+20;
	l = left1;
	t = top1;
   pop=window.open(url,'pop','width='+w+',height='+h+',top='+t+',left='+l+',scrollbars=yes');	
   return pop;
}


function adjustPopup(w,h)
{
	left1=((parseInt(getWinX())- parseInt(w))/2)+parseInt(getScrX());
	top1=((parseInt(getWinY())- parseInt(h))/2)+parseInt(getScrY());
	document.getElementById(idIMG).style.left = left1+'px';
	document.getElementById(idIMG).style.top = top1+'px';
	document.getElementById(idIMG).style.visibility = 'visible';
}
function hideBGD()
{
	hideid=document.getElementById(idBGD);
   hideid.style.height = '0px';
	hideid.style.width = '0px';
   hideid.style.visibility = 'hidden';	
}
function showBGD()
{
	bgid=document.getElementById(idBGD);
	bgid.style.left = '0px';
	bgid.style.top = '0px';
	bgid.style.height = (1000+getScrY())+'px';
	bgid.style.width = '100%';
	bgid.style.backgroundImage="url(../javascript/overlay.png)";	
	bgid.style.visibility = 'visible';
}

/*
* Lay vi tri tuyet doi/ tuong doi/ va kich thuoc doi tuong
*/

function getScrX() 
{
	var offset = 0;
	if(window.pageXOffset)
		offset = window.pageXOffset;
	else if(document.documentElement && document.documentElement.scrollLeft)
		offset = document.documentElement.scrollLeft;
	else if(document.body && document.body.scrollLeft)
		offset = document.body.scrollLeft;
	return offset;
}
function getScrY() 
{
	var offset = 0;
	if(window.pageYOffset)
		offset = window.pageYOffset;
	else if(document.documentElement && document.documentElement.scrollTop)
		offset = document.documentElement.scrollTop;
	else if(document.body && document.body.scrollTop)
		offset = document.body.scrollTop;
	return offset;
}
function getWinX() 
{
	var size = 0;
	if(window.innerWidth)
		size = window.innerWidth;
	else if(document.documentElement && document.documentElement.clientWidth)
		size = document.documentElement.clientWidth;
	else if(document.body && document.body.clientWidth)
		size = document.body.clientWidth;
	else size = screen.width;
	return size;
}
function getWinY() 
{
	var size = 0;
	if(window.innerHeight)
		size = window.innerHeight;
	else if(document.documentElement && document.documentElement.clientHeight)
		size = document.documentElement.clientHeight;
	else if(document.body && document.body.clientHeight)
		size = document.body.clientHeight;
	else size = screen.height;
	return size;
}
function getHeight(id) 
{
	return document.getElementById(id).offsetHeight;
}
function getWidth(id) 
{
	return document.getElementById(id).offsetWidth;
}
function getTop(id) 
{
	return document.getElementById(id).offsetTop;
}
function getLeft(id) 
{
	return document.getElementById(id).offsetLeft;
}
