//SETTING UP OUR POPUP  
//0 means disabled; 1 means enabled;  
var popupStatus = 0;  
//loading popup with jQuery magic!  
function loadPopup(id){  
//loads popup only if it is disabled  
  fnHideCombo();
   
   if(popupStatus==0){  
    document.getElementById("backgroundPopup").style.height= document.body.offsetHeight;
		$("#backgroundPopup").css({  
		"opacity": "0.6"  
	});  
	$("#backgroundPopup").fadeIn("slow");  
		$("#"+id).fadeIn("slow");  
		popupStatus = 1;  
	}  
 fnDivLoad();
	
} 
//disabling popup with jQuery magic!  
function disablePopup(panel_name){  
var id=$("#"+panel_name).attr('id');
//disables popup only if it is enabled  
	if(popupStatus==1){  
		$("#backgroundPopup").fadeOut("fast");  
		$("#"+id).fadeOut("fast");  
		popupStatus = 0;  
	}  
	fnShowCombo();
} 
//centering popup  
function centerPopup(panel_name){ 
var id=$("#"+panel_name).attr('id');
$("#"+id).addClass('popupSize');
//alert('id='+id);
//request data for centering  
	var windowWidth = document.documentElement.clientWidth;  
	var windowHeight = document.documentElement.clientHeight;  
	var popupHeight = $("#"+id).height();  
	var popupWidth = $("#"+id).width(); 
	//alert('popupWidth='+popupWidth+' popupHeight='+popupHeight+' windowWidth='+windowWidth+' windowHeight='+windowHeight);

	//centering  
	$("#"+id).css({  
		"position": "absolute",  
		"top": windowHeight/2-popupHeight/2,  
		"left": windowWidth/2-popupWidth/2  
	});  
	//only need force for IE6  
	  
	$("#backgroundPopup").css({  
		"height": windowHeight  
	});  
	loadPopup(id);
}
function popup_open(id) {
	//alert('id='+id);
	centerPopup(id);
}
function popup_close(id) {
	//alert('id='+id);
	disablePopup(id);
}
