///* JQuery Popup Settings 	*/////
///* File Effected: Product.php, tab: Insulating Glass(IG) */

//0 means disabled; 1 means enabled;
var popupStatusAG = 0;

////////////////////////////////////////////////////////////
//// Global Variables - Based on <DIV> "id" attributes  ////
////////////////////////////////////////////////////////////

var popupAG = ("#popup_requestInfo");
var closePopupAG =("#popup_Close");
var bgroundPopupAG = ("#backgroundPopup");
var fadeInPopupAG = ("fast"); 

function loadPopupAG1(){
	//loads popup only if it is disabled
	if(popupStatusAG==0){
		$(bgroundPopupAG).css({
		"opacity": "0.4"
	});
	$(bgroundPopupAG).fadeIn(fadeInPopupAG);
	$("#popup_requestInfo").fadeIn(fadeInPopupAG);
	popupStatusAG = 1;
	}
}


////////////////////////////////////////////////
//// GLOBAL disabling POPUP FUNCTION ////
////////////////////////////////////////////////

function disablePopupAG(){
	//disables popup only if it is enabled
	if(popupStatusAG==1){
		$(bgroundPopupAG).fadeOut(fadeInPopupAG);
		$(popupAG).fadeOut(fadeInPopupAG);
		popupStatusAG = 0;
	}
}
////////////////////////////////////////////////
//// GLOBAL CENTER POPUP ON SCREEN FUNCTION ////
////////////////////////////////////////////////

function centerPopupAG(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $(popupAG).height();
	var popupWidth = $(popupAG).width();
	
	//centering
	$(popupAG).css({
	"position": "absolute",
	//"top": windowHeight/2-popupHeight/2,
	"top": -50,
	//"left": windowWidth/2-popupWidth/2,
	"left":168
	});
	//only need force for IE6
	$(bgroundPopupAG).css({
	"height": windowHeight
	});
}

$(document).ready(function(){
//Click the button event!
	$("#Prod_AG_btn-1").click(function(){
	//centering with css
	centerPopupAG();
	//load popup
	loadPopupAG1();
	//window.alert("I am an alert box");
	});
	

///////////////////////////////
//// GLOBAL CLOSE FUNCTION POPUP ////
///////////////////////////////

//Click the popup x event!
	// USES inline script that references function disablePopupAG(){} //	

//CLOSING BLACK BACGROUND POPUP 
	//Click out event!
	$(bgroundPopupAG).click(function(){
		disablePopupAG();
	});

//Press Escape event!
	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatusAG==1){
			disablePopupAG();
		}
	});	
});



