﻿var popupStatus = 0;
var popupStatus2 = 0;
var popupStatus3 = 0;
var popupStatus4 = 0;
var popupStatus5 = 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 #4 - TABEL DE Fabric ******//

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
	});	
}
 

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

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

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

});


//********* END POPUP #4 - FABRIC GUIDE ******//

//********* START POPUP #5 - COLORS ******//

function loadPopup5(){
	if(popupStatus5==0){
		$("#backgroundPopup5").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup5").fadeIn("slow");
		$("#popupContact5").fadeIn("slow");
		popupStatus5 = 1;
	}
}

function disablePopup5(){
	if(popupStatus5==1){
		$("#backgroundPopup5").fadeOut("slow");
		$("#popupContact5").fadeOut("slow");
		popupStatus5 = 0;
	}
}

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

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

$(document).ready(function(){
	$("#button5").click(function(){
		centerPopup5();
		loadPopup5();
	});
				
	$("#popupContactClose5").click(function(){
		disablePopup5();
	});

	$("#backgroundPopup5").click(function(){
		disablePopup5();
	});

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

});


//********* END POPUP #4 - COLORS ******//

