/***************************/
//@Author: Adrian "yEnS" Mato Gondelle
//@website: www.yensdesign.com
//@email: yensamg@gmail.com
//@license: Feel free to use it, but keep this credits please!					
/***************************/

//SETTING UP OUR POPUP
//0 means disabled; 1 means enabled;
var popupStatus = 0;
var popupStatus2 = 0;
var popupStatus3 = 0;
var popupStatus4 = 0;
var popupStatus5 = 0;
var popupStatus6 = 0;
var popupStatus7 = 0;
var popupStatus8 = 0;
var popupStatus9 = 0;
var popupStatus10 = 0;
var popupStatus11 = 0;

//loading popup with jQuery magic!
function loadPopup(){
	//loads popup only if it is disabled
	if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		$("#popupContact").fadeIn("slow");
		popupStatus = 1;
	}
}


//loading popup with jQuery magic!
function loadPopup2(){
	//loads popup only if it is disabled
	if(popupStatus2==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		$("#popupInvitation").fadeIn("slow");
		popupStatus2 = 1;
	}
}

//loading popup with jQuery magic!
function loadPopup3(){
	//loads popup only if it is disabled
	if(popupStatus3==0){
		$("#backgroundPopup").css({
			"opacity": "0"
		});
		$("#backgroundPopup").fadeIn("slow");
		$("#popupMember").fadeIn("slow");
		popupStatus3 = 1;
	}
}

//loading popup with jQuery magic!
function loadPopup4(){
	//loads popup only if it is disabled
	if(popupStatus4==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		$("#popupFreeconsultation").fadeIn("slow");
		popupStatus4 = 1;
	}
}

//loading popup with jQuery magic!
function loadPopup5(){
	//loads popup only if it is disabled
	if(popupStatus5==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		$("#popupHirereasons").fadeIn("slow");
		popupStatus5 = 1;
	}
}

//loading popup with jQuery magic!
function loadPopup6(){
	//loads popup only if it is disabled
	if(popupStatus6==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		$("#popupBenefits").fadeIn("slow");
		popupStatus6 = 1;
	}
}

//loading popup with jQuery magic!
function loadPopup7(){
	//loads popup only if it is disabled
	if(popupStatus7==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		$("#popupCredentials1").fadeIn("slow");
		popupStatus7 = 1;
	}
}
//loading popup with jQuery magic!
function loadPopup8(){
	//loads popup only if it is disabled
	if(popupStatus8==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		$("#popupCredentials2").fadeIn("slow");
		popupStatus8 = 1;
	}
}
//loading popup with jQuery magic!
function loadPopup9(){
	//loads popup only if it is disabled
	if(popupStatus9==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		$("#popupCredentials3").fadeIn("slow");
		popupStatus9 = 1;
	}
}
//loading popup with jQuery magic!
function loadPopup10(){
	//loads popup only if it is disabled
	if(popupStatus10==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		$("#popupCredentials4").fadeIn("slow");
		popupStatus10 = 1;
	}
}
//loading popup with jQuery magic!
function loadPopup11(){
	//loads popup only if it is disabled
	if(popupStatus11==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		$("#popupCredentials5").fadeIn("slow");
		popupStatus11 = 1;
	}
}

//disabling popup with jQuery magic!
function disablePopup(){
	//disables popup only if it is enabled
	if(popupStatus==1){
		$("#backgroundPopup").fadeOut("slow");
		$("#popupContact").fadeOut("slow");
		popupStatus = 0;
	}
}

//disabling popup with jQuery magic!
function disablePopup2(){
	//disables popup only if it is enabled
	if(popupStatus2==1){
		$("#backgroundPopup").fadeOut("slow");
		$("#popupInvitation").fadeOut("slow");
		popupStatus2 = 0;
	}
}

//disabling popup with jQuery magic!
function disablePopup3(){
	//disables popup only if it is enabled
	if(popupStatus3==1){
		$("#backgroundPopup").fadeOut("slow");
		$("#popupMember").fadeOut("slow");
		popupStatus3 = 0;
	}
}

//disabling popup with jQuery magic!
function disablePopup4(){
	//disables popup only if it is enabled
	if(popupStatus4==1){
		$("#backgroundPopup").fadeOut("slow");
		$("#popupFreeconsultation").fadeOut("slow");
		popupStatus4 = 0;
	}
}

//disabling popup with jQuery magic!
function disablePopup5(){
	//disables popup only if it is enabled
	if(popupStatus5==1){
		$("#backgroundPopup").fadeOut("slow");
		$("#popupHirereasons").fadeOut("slow");
		popupStatus5 = 0;
	}
}

//disabling popup with jQuery magic!
function disablePopup6(){
	//disables popup only if it is enabled
	if(popupStatus6==1){
		$("#backgroundPopup").fadeOut("slow");
		$("#popupBenefits").fadeOut("slow");
		popupStatus6 = 0;
	}
}
//disabling popup with jQuery magic!
function disablePopup7(){
	//disables popup only if it is enabled
	if(popupStatus7==1){
		$("#backgroundPopup").fadeOut("slow");
		$("#popupCredentials1").fadeOut("slow");
		popupStatus7 = 0;
	}
}
//disabling popup with jQuery magic!
function disablePopup8(){
	//disables popup only if it is enabled
	if(popupStatus8==1){
		$("#backgroundPopup").fadeOut("slow");
		$("#popupCredentials2").fadeOut("slow");
		popupStatus8 = 0;
	}
}
//disabling popup with jQuery magic!
function disablePopup9(){
	//disables popup only if it is enabled
	if(popupStatus9==1){
		$("#backgroundPopup").fadeOut("slow");
		$("#popupCredentials3").fadeOut("slow");
		popupStatus9 = 0;
	}
}
//disabling popup with jQuery magic!
function disablePopup10(){
	//disables popup only if it is enabled
	if(popupStatus10==1){
		$("#backgroundPopup").fadeOut("slow");
		$("#popupCredentials4").fadeOut("slow");
		popupStatus10 = 0;
	}
}
//disabling popup with jQuery magic!
function disablePopup11(){
	//disables popup only if it is enabled
	if(popupStatus11==1){
		$("#backgroundPopup").fadeOut("slow");
		$("#popupCredentials5").fadeOut("slow");
		popupStatus11 = 0;
	}
}

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

//centering popup
function centerPopup2(){
	//request data for centering
	var windowWidth2 = document.documentElement.clientWidth;
	var windowHeight2 = document.documentElement.clientHeight;
	var popupHeight2 = $("#popupInvitation").height();
	var popupWidth2 = $("#popupInvitation").width();
	//centering
	$("#popupInvitation").css({
		"position": "absolute",
		"top": windowHeight2/2-popupHeight2/2,
		"left": windowWidth2/2-popupWidth2/2
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight2
	});
	
}

//centering popup
function centerPopup3(){
	//request data for centering
	var windowWidth3 = document.documentElement.clientWidth;
	var windowHeight3 = document.documentElement.clientHeight;
	var popupHeight3 = $("#popupMember").height();
	var popupWidth3 = $("#popupMember").width();
	//centering
	$("#popupMember").css({
		"position": "absolute",
		"top": 80,
		"left": 925
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight3
	});
	
}

//centering popup
function centerPopup4(){
	//request data for centering
	var windowWidth4 = document.documentElement.clientWidth;
	var windowHeight4 = document.documentElement.clientHeight;
	var popupHeight4 = $("#popupFreeconsultation").height();
	var popupWidth4 = $("#popupFreeconsultation").width();
	//centering
	$("#popupFreeconsultation").css({
		"position": "absolute",
		"top": windowHeight4/2-popupHeight4/2,
		"left": windowWidth4/2-popupWidth4/2
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight4
	});
	
}

//centering popup
function centerPopup5(){
	//request data for centering
	var windowWidth5 = document.documentElement.clientWidth;
	var windowHeight5 = document.documentElement.clientHeight;
	var popupHeight5 = $("#popupHirereasons").height();
	var popupWidth5 = $("#popupHirereasons").width();
	//centering
	$("#popupHirereasons").css({
		"position": "absolute",
		"top": windowHeight5/2-popupHeight5/2,
		"left": windowWidth5/2-popupWidth5/2
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight5
	});
	
}

//centering popup
function centerPopup6(){
	//request data for centering
	var windowWidth6 = document.documentElement.clientWidth;
	var windowHeight6 = document.documentElement.clientHeight;
	var popupHeight6 = $("#popupBenefits").height();
	var popupWidth6 = $("#popupBenefits").width();
	//centering
	$("#popupBenefits").css({
		"position": "absolute",
		"top": windowHeight6/2-popupHeight6/2,
		"left": windowWidth6/2-popupWidth6/2
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight6
	});
	
}

//centering popup
function centerPopup7(){
	//request data for centering
	var windowWidth7 = document.documentElement.clientWidth;
	var windowHeight7 = document.documentElement.clientHeight;
	var popupHeight7 = $("#popupCredentials1").height();
	var popupWidth7 = $("#popupCredentials1").width();
	//centering
	$("#popupCredentials1").css({
		"position": "absolute",
		"top": windowHeight7/2-popupHeight7/2,
		"left": windowWidth7/2-popupWidth7/2
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight7
	});	
}
//centering popup
function centerPopup8(){
	//request data for centering
	var windowWidth8 = document.documentElement.clientWidth;
	var windowHeight8 = document.documentElement.clientHeight;
	var popupHeight8 = $("#popupCredentials2").height();
	var popupWidth8 = $("#popupCredentials2").width();
	//centering
	$("#popupCredentials2").css({
		"position": "absolute",
		"top": windowHeight8/2-popupHeight8/2,
		"left": windowWidth8/2-popupWidth8/2
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight8
	});	
}
//centering popup
function centerPopup9(){
	//request data for centering
	var windowWidth9 = document.documentElement.clientWidth;
	var windowHeight9 = document.documentElement.clientHeight;
	var popupHeight9 = $("#popupCredentials3").height();
	var popupWidth9 = $("#popupCredentials3").width();
	//centering
	$("#popupCredentials3").css({
		"position": "absolute",
		"top": windowHeight9/2-popupHeight9/2,
		"left": windowWidth9/2-popupWidth9/2
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight9
	});	
}
//centering popup
function centerPopup10(){
	//request data for centering
	var windowWidth10 = document.documentElement.clientWidth;
	var windowHeight10 = document.documentElement.clientHeight;
	var popupHeight10 = $("#popupCredentials4").height();
	var popupWidth10 = $("#popupCredentials4").width();
	//centering
	$("#popupCredentials4").css({
		"position": "absolute",
		"top": windowHeigh10/2-popupHeight10/2,
		"left": windowWidth10/2-popupWidth10/2
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight10
	});	
}
//centering popup
function centerPopup11(){
	//request data for centering
	var windowWidth11 = document.documentElement.clientWidth;
	var windowHeight11 = document.documentElement.clientHeight;
	var popupHeight11 = $("#popupCredentials5").height();
	var popupWidth11 = $("#popupCredentials5").width();
	//centering
	$("#popupCredentials5").css({
		"position": "absolute",
		"top": windowHeigh11/2-popupHeight11/2,
		"left": windowWidth11/2-popupWidth11/2
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight11
	});	
}

//CONTROLLING EVENTS IN jQuery
$(document).ready(function(){
	
	//LOADING POPUP
	//Click the button event!
	$("#button").click(function(){
		//centering with css
		centerPopup();
		//load popup
		loadPopup();
	});
	
	//Click the button2 event!
	$("#invitation").click(function(){
		//centering with css
		centerPopup2();
		//load popup
		loadPopup2();
	});
	
	//Click the button3 event!
	$("#member").click(function(){
		//centering with css
		centerPopup3();
		//load popup
		loadPopup3();
	});
	
	//Click the button4 event!
	$("#freeconsultation").click(function(){
		//centering with css
		centerPopup4();
		//load popup
		loadPopup4();
	});
	
	//Click the button5 event!
	$("#hirereasons").click(function(){
		//centering with css
		centerPopup5();
		//load popup
		loadPopup5();
	});
	
	//Click the button6 event!
	$("#benefits").click(function(){
		//centering with css
		centerPopup6();
		//load popup
		loadPopup6();
	});
	
	//Click the button7 event!
	$("#credentials1").click(function(){
		//centering with css
		centerPopup7();
		//load popup
		loadPopup7();
	});
	
	//Click the button8 event!
	$("#credentials2").click(function(){
		//centering with css
		centerPopup8();
		//load popup
		loadPopup8();
	});
	
	//Click the button9 event!
	$("#credentials3").click(function(){
		//centering with css
		centerPopup9();
		//load popup
		loadPopup9();
	});
	
	//Click the button10 event!
	$("#credentials4").click(function(){
		//centering with css
		centerPopup10();
		//load popup
		loadPopup10();
	});
	
	//Click the button11 event!
	$("#credentials5").click(function(){
		//centering with css
		centerPopup11();
		//load popup
		loadPopup11();
	});
				
	//CLOSING POPUP
	//Click the x event!
	$("#popupContactClose").click(function(){
		disablePopup();
	});
	//Click out event!
	$("#backgroundPopup").click(function(){
		disablePopup();
	});
	//Press Escape event!
	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus==1){
			disablePopup();
		}
	});
		
	//CLOSING POPUP
	//Click the x event!
	$("#popupInvitationClose").click(function(){
		disablePopup2();
	});
	//Click out event!
	$("#backgroundPopup").click(function(){
		disablePopup2();
	});
	//Press Escape event!
	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus2==1){
			disablePopup2();
		}
	});
		
	//CLOSING POPUP
	//Click the x event!
	$("#popupMemberClose").click(function(){
		disablePopup3();
	});
	//Click out event!
	$("#backgroundPopup").click(function(){
		disablePopup3();
	});
	//Press Escape event!
	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus3==1){
			disablePopup3();
		}
	});
		
	//CLOSING POPUP
	//Click the x event!
	$("#popupFreeconsultationClose").click(function(){
		disablePopup4();
	});
	//Click out event!
	$("#backgroundPopup").click(function(){
		disablePopup4();
	});
	//Press Escape event!
	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus4==1){
			disablePopup4();
		}
	});
		
	//CLOSING POPUP
	//Click the x event!
	$("#popupHirereasonsClose").click(function(){
		disablePopup5();
	});
	//Click out event!
	$("#backgroundPopup").click(function(){
		disablePopup5();
	});
	//Press Escape event!
	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus5==1){
			disablePopup5();
		}
	});
		
	//CLOSING POPUP
	//Click the x event!
	$("#popupBenefitsClose").click(function(){
		disablePopup6();
	});
	//Click out event!
	$("#backgroundPopup").click(function(){
		disablePopup6();
	});
	//Press Escape event!
	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus6==1){
			disablePopup6();
		}
	});
		
	//CLOSING POPUP
	//Click the x event!
	$("#popupCredentials1Close").click(function(){
		disablePopup7();
	});
	//Click out event!
	$("#backgroundPopup").click(function(){
		disablePopup7();
	});
	//Press Escape event!
	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus7==1){
			disablePopup7();
		}
	});
		
	//CLOSING POPUP
	//Click the x event!
	$("#popupCredentials2Close").click(function(){
		disablePopup8();
	});
	//Click out event!
	$("#backgroundPopup").click(function(){
		disablePopup8();
	});
	//Press Escape event!
	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus8==1){
			disablePopup8();
		}
	});
		
	//CLOSING POPUP
	//Click the x event!
	$("#popupCredentials3Close").click(function(){
		disablePopup9();
	});
	//Click out event!
	$("#backgroundPopup").click(function(){
		disablePopup9();
	});
	//Press Escape event!
	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus9==1){
			disablePopup9();
		}
	});
		
	//CLOSING POPUP
	//Click the x event!
	$("#popupCredentials4Close").click(function(){
		disablePopup10();
	});
	//Click out event!
	$("#backgroundPopup").click(function(){
		disablePopup10();
	});
	//Press Escape event!
	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus10==1){
			disablePopup10();
		}
	});
		
	//CLOSING POPUP
	//Click the x event!
	$("#popupCredentials5Close").click(function(){
		disablePopup11();
	});
	//Click out event!
	$("#backgroundPopup").click(function(){
		disablePopup11();
	});
	//Press Escape event!
	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus11==1){
			disablePopup11();
		}
	});
});