﻿/***************************/
//@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 divupStatus = 0;

var popupStatus2 = 0;
var divupStatus2 = 0;

//loading popup with jQuery magic!
function loadPopup2(pValue){
	//loads popup only if it is disabled
	divupStatus2 = pValue;
	if(popupStatus2==0){
		$("#backgroundPopup2").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup2").fadeIn("slow");
		$("#" + pValue).fadeIn("slow");
		popupStatus2 = 1;
	}
}

//disabling popup with jQuery magic!
function disablePopup2(){
	//disables popup only if it is enabled
	if(popupStatus2==1){
		$("#backgroundPopup2").fadeOut("slow");
		$("#" + divupStatus2).fadeOut("slow");
		popupStatus2 = 0;
	}
	//$('html,body').animate({scrollTop: $("#" + divupStatus).offset().top}, 1000);
}

//loading popup with jQuery magic!
function loadPopup(pValue){
	//loads popup only if it is disabled
	divupStatus = pValue;
	if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		$("#" + pValue).fadeIn("slow");
		popupStatus = 1;
	}
	$("#flashamigo").hide();
}

//disabling popup with jQuery magic!
function disablePopup(){
	//disables popup only if it is enabled
	if(popupStatus==1){
		$("#backgroundPopup").fadeOut("slow");
		$("#" + divupStatus).fadeOut("slow");
		popupStatus = 0;
	}
	$("#flashamigo").show();
	//$('html,body').animate({scrollTop: $("#" + divupStatus).offset().top}, 1000);
}

//centering popup
function centerPopup(divPopup){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#" + divPopup).height();
	var popupWidth = $("#" + divPopup).width();
	//centering
	$("#" + divPopup).css({
		"position": "absolute",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	});
	//only need force for IE6	
}

