!function(e){e.rpopup=function(o){function t(o){e.each(o,function(o,t){function p(e,o,t){var i=0;if(/%/.test(o)){var s=e*(r=parseInt(o))/100;i=50==r?s-t/2:s+t>e?e-t:s}else{var r;i=(r=parseInt(o))+t>e?e-t:r}return i}for(var a=document.cookie.split(";"),d=0;d

'+v.headerText+'

",v.footerBar&&(l+='"),l+="
",e("body").append(l);var h=e('.rPopup[data-idx="'+o+'"]'),m=v.positionLeft,g=v.positionTop;if(/0&&(o.hide(),t.show())})))}var s=!0,r=720,p=e(document),n=p.innerWidth()-2,u=p.innerHeight()-2,a=o;switch(e.type(a)){case"undefined":t([{}]);break;case"object":t([a]);break;case"array":t(a)}var d=!0;e(window).resize(function(){d&&(e(".rPopup").hide(),d=!1),this.resizeTO&&clearTimeout(this.resizeTO),this.resizeTO=setTimeout(function(){e(this).trigger("resizeEnd")},300)}).on("resizeEnd",function(){n=p.innerWidth()-2,u=p.innerHeight()-2,e(".rPopup").each(function(){var o=e(this),t=o.outerWidth(),i=o.outerHeight(),s=parseInt(o.css("left")),r=parseInt(o.css("top")),p=i+r;t+s>=n&&o.css({left:n-t}),s<=0&&o.css({left:0}),p>=u&&o.css({top:u-i}),r<=0&&o.css({top:0})}),d=!0,e(".rPopup").show(),i()}),e(".rPopup_header").mousedown(function(o){var t=e(this).closest(".rPopup"),i=o.pageX-t.offset().left,s=o.pageY-t.offset().top;e(document).mousemove(function(e){var o=e.pageX-i,r=e.pageY-s;t.css({top:r,left:o});var p=t.outerWidth(),a=t.outerHeight();o<=0&&r<=0?t.css({left:0,top:0}):o<=0?t.css({left:0}):r<=0&&t.css({top:0});var d=o+p,c=r+a;d>=n&&c>=u?t.css({left:n-p,top:u-a}):d>=n?t.css({left:n-p}):c>=u&&t.css({top:u-a})}).mouseup(function(){p.unbind("mousemove")})}).mouseup(function(){p.unbind("mousemove")}),e(".rPopup").mousedown(function(){e(".rPopup").css({"z-index":99999999998}),e(this).css({"z-index":999999999999})}).on("selectstart dragstart",function(){return!1}).find("button").click(function(){var o=e(this).closest(".rPopup"),t=o.data("idx");o.find(".popupChk").is(":checked")&&function(e,o,t){var i=new Date;i.setDate(i.getDate()+t),document.cookie=e+"="+escape(o)+"; path=/; expires="+i.toGMTString()+";"}("rPopup"+t,t,1),o.remove(),e(".rPopup").eq(0).show()})}}(jQuery);