///* JQuery Popup Settings 	*/////
///* File Effected: Services.php, tab: Customer Service(CS) */

//0 means disabled; 1 means enabled;
var popupStatusCS = 0;

////////////////////////////////////////////////////////////
//// Global Variables - Based on <DIV> "id" attributes  ////
////////////////////////////////////////////////////////////

var popupCS = ("#popup_Loc");
var closePopupCS =("#popup_Close");
var bgroundPopupCS = ("#backgroundPopup");
var fadeInPopupCS = ("fast"); 

function loadPopupCS0(){
	//loads popup only if it is disabled
	if(popupStatusCS==0){
		if ( $.browser.msie ) {
		  //alert( $.browser.version );
			$(bgroundPopupCS).css({"opacity": "0.2"});
			$(bgroundPopupCS).fadeIn(fadeInPopupCS);
			$(popupCS).fadeIn(fadeInPopupCS);
			popupStatusCS = 1;
		} else {
			//$(bgroundPopupCS).css({"opacity": "0.2"});
			//$(bgroundPopupCS).fadeIn(fadeInPopupCS);
			$(popupCS).fadeIn(fadeInPopupCS);
		
			//$("h1").css({ "margin-left":"10px"});
			popupStatusCS = 1;	
		}
	}
}


////////////////////////////////////////////////
//// GLOBAL disabling POPUP FUNCTION ////
////////////////////////////////////////////////

function disablePopupCS(){
	//disables popup only if it is enabled
	if(popupStatusCS==1){
		$(bgroundPopupCS).fadeOut(fadeInPopupCS);
		$(popupCS).fadeOut(fadeInPopupCS);
		popupStatusCS = 0;
	}
}
////////////////////////////////////////////////
//// GLOBAL CENTER POPUP ON SCREEN FUNCTION ////
////////////////////////////////////////////////

function centerPopupCS(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $(popupCS).height();
	var popupWidth = $(popupCS).width();
	
	//centering
	$(popupCS).css({
	"position": "absolute","top": windowHeight/2-popupHeight/2, "left":windowWidth/2-popupWidth/2
	});
	
	//only need force for IE6
	$(bgroundPopupCS).css({
	"height": windowHeight
	});
}

function centerPopupLoc(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $(popupCS).height();
	var popupWidth = $(popupCS).width();
	
	//centering top:100 , left:100, 280
	$(popupCS).css({
	"position": "absolute", "top": windowHeight/2-popupHeight, "left":windowWidth/2-popupWidth/2});
	
	
	//only need force for IE6
	$(bgroundPopupCS).css({
	"height": windowHeight});
}

$(document).ready(function(){
//Click the button event!
	$("#Serv_CSbutton-0").click(function(){
	//centering with css
	centerPopupLoc();
	//load popup
	loadPopupCS0();
	});



///////////////////////////////
//// GLOBAL CLOSE FUNCTION ////
///////////////////////////////

//Click the popup x event!
	// USES inline script that references function disablePopupIG(){} //

//CLOSING BLACK BACGROUND POPUP 
	//Click out event!
	$(bgroundPopupCS).click(function(){
		disablePopupCS();
	});

//Press Escape event!
	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatusCS==1){
			disablePopupCS();
		}
	});

});

