var popupErrorStatus = 0;

function loadPopupError() {
	if(popupErrorStatus==0) {
		$("#backgroundPopup").css({"opacity": "0.5"});
		$("#backgroundPopup").fadeIn();  
		$("#popupError").fadeIn();  
		popupErrorStatus = 1;  
	}
}

function disablePopupError(){  
	//disables popup only if it is enabled  
	if(popupErrorStatus==1){  
		$("#backgroundPopup").fadeOut("fast");  
		$("#popupError").fadeOut("fast");  
		popupErrorStatus = 0;  
	}  
} 

//centering popup  
function centerPopupError(){  
//request data for centering  
	var windowWidth = document.documentElement.clientWidth;  
	var windowHeight = document.documentElement.clientHeight;  
	var popupHeight = $("#popupError").height();  
	var popupWidth = $("#popupError").width();  
//centering  
	$("#popupError").css({  
		"position": "absolute",  
		"top": windowHeight/2-popupHeight/2,  
		"left": windowWidth/2-popupWidth/2  
	});  
//only need force for IE6  
  
	$("#backgroundPopup").css({  
		"height": windowHeight  
	});  
} 

$(document).ready(function(){
	//CLOSING POPUP
	//Click the x event!
	$("#popupErrorClose").click(function(){
		disablePopupError();
	});
	//Press Escape event!
	$(document).keypress(function(e){
		if(e.keyCode==27 && popupErrorStatus==1){
			disablePopupError();
		}
	});
	$('.rounded').corners();
});


