/***************************/
//@Author: Jahrim Corvera
/***************************/

//SETTING UP OUR POPUP
//0 means disabled; 1 means enabled;
var popupStatusC = 0;

//loading popup with jQuery magic!
function loadPopupC(){
	//loads popup only if it is disabled
	if(popupStatusC==0){
		$("#backgroundPopupC").css({
			"opacity": "0.7"
		});
		$("#backgroundPopupC").fadeIn("slow");
		$("#popupContactC").fadeIn("slow");
		popupStatusC = 1;
	}
}

//disabling popup with jQuery magic!
function disablePopupC(){
	//disables popup only if it is enabled
	if(popupStatusC==1){
		$("#backgroundPopupC").fadeOut("slow");
		$("#popupContactC").fadeOut("slow");
		popupStatusC = 0;
	}
}

//centering popup
function centerPopupC(){
	//request data for centering
	window.scrollTo(0,0);
	window.resizeTo(screen.width,screen.height);

	var windowWidthC = screen.width;
	var windowHeightC = screen.height - 200;
	var popupHeightC = $("#popupContactC").height();
	var popupWidthC = $("#popupContactC").width();
	//centering
	$("#popupContactC").css({
		"position": "absolute",
		"top": windowHeightC/2-popupHeightC/2,
		"left": windowWidthC/2-popupWidthC/2
	});
	//only need force for IE6
	
	
}

function ShowRegister(){
		//centering with css
		centerPopupC();
		//load popup
		loadPopupC();
}


//CONTROLLING EVENTS IN jQuery
$(document).ready(function(){
	
				
	//CLOSING POPUP
	//Click the x event!
	$("#popupContactCloseC").click(function(){
		disablePopupC();
	});
	//Click out event!
	$("#backgroundPopupC").click(function(){
		disablePopupC();
	});
	//Press Escape event!
	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatusC==1){
			disablePopupC();
		}
	});

});
