﻿var popupStatus = 0;
var popupStatus2 = 0;
var popupStatus3 = 0;
var popupStatus4 = 0;

//********* START POPUP #1 - TRIMITE UNUI PRIETEN ******//
function loadPopup(){
	if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		$("#popupContact").fadeIn("slow");
		popupStatus = 1;
	}
}

function disablePopup(){
	if(popupStatus==1){
		$("#backgroundPopup").fadeOut("slow");
		$("#popupContact").fadeOut("slow");
		popupStatus = 0;
	}
}


function centerPopup(){
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#popupContact").height();
	var popupWidth = $("#popupContact").width();

	$("#popupContact").css({
		"position": "absolute",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	});
	
	$("#backgroundPopup").css({
		"height": windowHeight
	});	
}

 
$(document).ready(function(){
	$("#button").click(function(){
		centerPopup();
		loadPopup();
	});
				
	$("#popupContactClose").click(function(){
		disablePopup();
	});

	$("#backgroundPopup").click(function(){
		disablePopup();
	});

	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus==1){
			disablePopup();
		}
	});

});

//********* END POPUP #1 - TRIMITE UNUI PRIETEN ******//

//********* START POPUP #2 - TABEL DE MASURI ******//

function loadPopup2(){
	if(popupStatus2==0){
		$("#backgroundPopup2").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup2").fadeIn("slow");
		$("#popupContact2").fadeIn("slow");
		popupStatus2 = 1;
	}
}

function disablePopup2(){
	if(popupStatus2==1){
		$("#backgroundPopup2").fadeOut("slow");
		$("#popupContact2").fadeOut("slow");
		popupStatus2 = 0;
	}
}

function centerPopup2(){
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#popupContact2").height();
	var popupWidth = $("#popupContact2").width();

	$("#popupContact2").css({
		"position": "absolute",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	});
	
	$("#backgroundPopup2").css({
		"height": windowHeight
	});	
}
 

$(document).ready(function(){
	$("#button2").click(function(){
		centerPopup2();
		loadPopup2();
	});
				
	$("#popupContactClose2").click(function(){
		disablePopup2();
	});

	$("#backgroundPopup2").click(function(){
		disablePopup2();
	});

	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus2==1){
			disablePopup2();
		}
	});

});


//********* END POPUP #2 - TABEL DE MASURI ******//



//********* START POPUP #3 - ABONARE NEWSLETTER ******//

function loadPopup3(){
	if(popupStatus3==0){
		$("#backgroundPopup3").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup3").fadeIn("slow");
		$("#popupContact3").fadeIn("slow");
		popupStatus3 = 1;
	}
}

function disablePopup3(){
	if(popupStatus3==1){
		$("#backgroundPopup3").fadeOut("slow");
		$("#popupContact3").fadeOut("slow");
		popupStatus3 = 0;
	}
}

function centerPopup3(){
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#popupContact3").height();
	var popupWidth = $("#popupContact3").width();

	$("#popupContact3").css({
		"position": "absolute",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	});
	
	$("#backgroundPopup3").css({
		"height": windowHeight
	});	
}
 

$(document).ready(function(){

	centerPopup3();
	loadPopup3();
	
				
	$("#popupContactClose3").click(function(){
		
		disablePopup3();
	});

	$("#backgroundPopup3").click(function(){
		disablePopup3();
	});

	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus3==1){
			disablePopup3();
		}
	});

});


//********* END POPUP #3 -  ABONARE NEWSLETTER ******//



//********* START POPUP #4 - PUNCTE DE LOIALITATE ******//

function loadPopup4(){
	if(popupStatus4==0){
		$("#backgroundPopup4").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup4").fadeIn("slow");
		$("#popupContact4").fadeIn("slow");
		popupStatus4 = 1;
	}
}

function disablePopup4(){
	if(popupStatus4==1){
		$("#backgroundPopup4").fadeOut("slow");
		$("#popupContact4").fadeOut("slow");
		popupStatus4 = 0;
	}
}

function centerPopup4(){
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#popupContact4").height();
	var popupWidth = $("#popupContact4").width();

	$("#popupContact4").css({
		"position": "absolute",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	});
	
	$("#backgroundPopup4").css({
		"height": windowHeight,
		"width": windowWidth
	});	
}
 

$(document).ready(function(){
	$("#btn_fol_puncte").click(function(){
		centerPopup4();
		loadPopup4();
	});
				
	$("#popupContactClose").click(function(){
		disablePopup4();
	});

	$("#backgroundPopup").click(function(){
		disablePopup4();
	});

	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus==1){
			disablePopup();
		}
	});

});


//********* END POPUP #4 - PUNCTE DE LOIALITATE ******//
 