//SETTING UP OUR POPUP
//0 means disabled; 1 means enabled;
var popupStatusSubscribe = 0;

//loading popup with jQuery magic!
function loadOverlaySubscribe(){
	//loads popup only if it is disabled
	if(popupStatusSubscribe==0){
		$(".backgroundOverlaySubscribe").css({
			"opacity": "0.8"
		});
		$(".backgroundOverlaySubscribe").fadeIn("slow");
		$(".overlaySubscribe").fadeIn("slow");
		popupStatusSubscribe = 1;
	}
}

//disabling popup with jQuery magic!
function disableOverlaySubscribe(){
	//disables popup only if it is enabled
	if(popupStatusSubscribe==1){
		$(".backgroundOverlaySubscribe").fadeOut("slow");
		$(".overlaySubscribe").fadeOut("slow");
		popupStatusSubscribe = 0;
	}
}

//centering popup
function centerOverlaySubscribe(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $(".overlaySubscribe").height();
	var popupWidth = $(".overlaySubscribe").width();
	//centering
	$(".overlaySubscribe").css({
		"position": "absolute",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	});
	//only need force for IE6
	
	$(".backgroundOverlaySubscribe").css({
		"height": windowHeight
	});
	
}


//CONTROLLING EVENTS IN jQuery
$(document).ready(function(){
	
	$('a.overlay').click(function(){
	
	//centering with css
	centerOverlaySubscribe();
	//load popup
	loadOverlaySubscribe();
	
	});
				
	//CLOSING POPUP
	//Click the x event!


});

