﻿/***************************/
//@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
var popupStatus = 0;
function loadPopup(){if(popupStatus==0){$("#backgroundPopup").css({"opacity": "0.7"});$("#backgroundPopup").fadeIn("slow");$("#popupWrap").fadeIn("slow");popupStatus = 1;}}
function disablePopup(){if(popupStatus==1){$("#backgroundPopup").fadeOut("slow");$("#popupWrap").fadeOut("slow");popupStatus = 0;}}

//centering popup
function centerPopup(thisObj){
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#popupWrap").height();
	var popupWidth = $("#popupWrap").width();
	var documentHeight = $(document).height();
	var scrollPosition = $(window).height() + $(window).scrollTop();
	var idtopdiff = (windowHeight/2)-popupHeight;
	var iwindowHeight = (scrollPosition - windowHeight) + idtopdiff;	
	$("#popupWrap").css({"position": "absolute","top": iwindowHeight+164,"left": windowWidth/2-popupWidth/2});
	
	//only need force for IE6
	$("#backgroundPopup").css({"height": windowHeight});
}
