// JavaScript Document


var WinId="";
function ShowWin(id, content)
{	
	document.getElementById("popContent").innerHTML = content;
	WinId=id;	
	ChangeWin();
	
	//transition effect		
	$('#mask').fadeIn(100);	
	$('#mask').fadeTo("slow",0.5);	

	//transition effect
	$(WinId).fadeIn(200); 	
	
	window.onresize = function(){
		ChangeWin();
	}

}

function ChangeWin()
{
	//Get the screen height and width
	var maskHeight = $(document).height();
	var maskWidth = $(window).width();
	$('#mask').css({'width':maskWidth,'height':maskHeight});
	
	//Get the window height and width
	var winH = $(window).height();
	var winW = $(window).width();	
	//Set the popup window to center
	
	var cssTop=winH/2-$(WinId).height()/2;
	if(cssTop<0) cssTop=0;
	var cssLeft=winW/2-$(WinId).width()/2;
	if(cssLeft<0) cssLeft=0;
	$(WinId).css('top',  cssTop);
	$(WinId).css('left', cssLeft);
}

function HideWin(id)
{		
	$('#mask').hide();
	$(id).hide();
}


