﻿/***************************/
//@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 captcha_popupStatus = 0;


//loading popup with jQuery magic!
function loadCaptchaPopup(el, bgEl){
	//loads popup only if it is disabled
	if(captcha_popupStatus==0){
		$(bgEl).css({
			"opacity": "0.7"
		});
		$(bgEl).fadeIn("slow");
		$(el).fadeIn("slow");
		captcha_popupStatus = 1;
	}
}

//disabling popup with jQuery magic!
function disableCaptchaPopup(el, bgEl){
	//disables popup only if it is enabled
	if(captcha_popupStatus==1){
		$(bgEl).fadeOut("slow");
		$(el).fadeOut("slow");
		captcha_popupStatus = 0;
	}
}

//centering popup
function centerCaptchaPopup(el, bgEl){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $(el).height();
	var popupWidth = $(el).width();
	//centering
	$(el).css({
		"position": "absolute",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	});
	//only need force for IE6
	
	$(bgEl).css({
		"height": windowHeight
	});

}

jQuery.fn.center = function() {
    this.css("position", "absolute");
    this.css("top", (($(window).height() - this.outerHeight()) / 2) + $(window).scrollTop() + "px");
    this.css("left", (($(window).width() - this.outerWidth()) / 2) + $(window).scrollLeft() + "px");
    return this;


}


