jQuery(document).ready(function($){$.init_pops_pre=function(){var i=0;var j=0;var k=0;var dfpopID;$("a.pop-link").each(function(){var parent=$(this);var url=$(this).attr("href");var parts=url.split(/&|\?/);$.each(parts,function(index,part){var params=part.split("=");if(params[0]=="tx_dfpopups_pi1[pop]"||params[0]=="tx_dfpopups_pi1%5Bpop%5D"){var dfpopID=params[1];parent.addClass("df-pop-"+dfpopID);var urlparams={"tx_dfpopups_pi1[title]":"true"};$.get(url,urlparams,function(data){$(".df-tab-container").append("<div class=\"df-tab df-pop-"+dfpopID+"\">"+data);k++;},"html");var urlparams="";$.get(url,urlparams,function(data){$(".df-pop-container").append("<div class=\"df-pop df-pop-"+dfpopID+"\">"+data+"");j++;},"html");}});i++;}).click(function(){var openID=$(this).attr("class").replace("pop-link df-pop-","");$.openPop(openID);return false;});}
$.init_pops=function(){$(".df-tab").click(function(){if(!$(this).hasClass("active")&&!$(this).hasClass("df-popup-close")){var popID=parseInt($(this).attr("class").match(/\d+/));$.changePop(popID);}});$(".df-pop-overlay,.df-popup-close").click(function(){$(".df-pop-overlay").fadeOut(0);$(".df-popup").fadeOut(0);});}
$.closePop=function(){$(".df-popup").hide();$(".df-pop-overlay").hide();$("select").css({"visibility":"visible"});}
$.changePop=function(id){$(".df-tab").each(function(){var popID=parseInt($(this).attr("class").match(/\d+/));if(id==popID){$(".active",$(this).parent()).toggleClass("active");$(this).toggleClass("active");$(".df-pop",$(this).parent().parent()).fadeOut(0);$(".df-pop:nth-child("+$(this).index()+")",$(this).parent().parent()).fadeIn(0);}});}
$.openPop=function(id){$.init_pops();$(".df-pop-overlay").fadeTo(0,0.8);$(".df-popup").fadeTo(0,1);if(id){$.changePop(id);}
$("select").css({"visibility":"hidden"});$(".df-popup").center();$(".df-pop-overlay").maximize();}
$(window).resize(function(){$(".df-popup").center();$(".df-pop-overlay").maximize();});$.init_pops_pre();});(function($){$.fn.extend({center:function(options){var options=$.extend({inside:window,transition:0,minX:0,minY:0,vertical:true,withScrolling:true,horizontal:true},options);return this.each(function(){var props={position:"absolute"};if(options.vertical){var top=($(options.inside).height()-$(this).outerHeight())/2;if(options.withScrolling)top+=$(options.inside).scrollTop()||0;top=(top>options.minY?top:options.minY);$.extend(props,{top:top+"px"});}
if(options.horizontal){var left=($(options.inside).width()-$(this).outerWidth())/2;if(options.withScrolling)left+=$(options.inside).scrollLeft()||0;left=(left>options.minX?left:options.minX);$.extend(props,{left:left+"px"});}
if(options.transition>0)$(this).animate(props,options.transition);else $(this).css(props);return $(this);});},maximize:function(options){var options=$.extend({inside:window,minX:0,minY:0,vertical:true,withScrolling:true,horizontal:true},options);return this.each(function(){var props={position:"absolute"};if(options.vertical){var height=$(document).height();$.extend(props,{height:height+"px"});}
if(options.horizontal){var width=$(document).width();$.extend(props,{width:width+"px"});}
$(this).css(props);return $(this);});}});})(jQuery);
