function createCookie(n,t){document.cookie=n+"="+t+"; path=/"}function readCookie(n){for(var r=n+"=",u=document.cookie.split(";"),t,i=0;i<u.length;i++){for(t=u[i];t.charAt(0)==" ";)t=t.substring(1,t.length);if(t.indexOf(r)==0)return t.substring(r.length,t.length)}return null}function eraseCookie(n){createCookie(n,"",-1)}(function(n){n.fn.YafModalDialog=function(t){return t=n.extend({Dialog:"#MessageBox",ImagePath:"images/",Type:"information"},t),this.each(function(){n(n(this)).click(function(){n.fn.YafModalDialog.Show(t)})}),this},n.fn.YafModalDialog.Close=function(t){function u(){n(t.Dialog).hide(),n("#"+r+"_overlay").fadeOut(),n(document).unbind("keydown."+i),n("#"+r+"_overlay").remove();var u=n("#"+r+" .DialogContent").contents();return n("#"+r).replaceWith(u),n(t.Dialog+"#ModalDialog #"+i+"Close").remove(),n(t.Dialog+"#ModalDialog_overlay").remove(),!1}var i,r;return t=n.extend({Dialog:"#MessageBox",ImagePath:"images/",Type:"information"},t),i=t.Dialog,i=i.replace("#",""),r=i+"Box",u(),this},n.fn.YafModalDialog.Show=function(t){var f,r,i,u;t=n.extend({Dialog:"#MessageBox",ImagePath:"images/",Type:"information"},t),f=n(t.Dialog).find(".DialogIcon").eq(0).attr("src"),r=t.ImagePath,r=r.replace("images/","icons/"),t.Type=="error"?f=r+"ErrorBig.png":t.Type=="information"?f=r+"InfoBig.png":t.Type=="warning"&&(f=r+"WarningBig.png"),n(t.Dialog).find(".DialogIcon").eq(0).attr("src",f),n("#LoginBox").is(":visible")&&n.fn.YafModalDialog.Close({Dialog:"#LoginBox"});var e="25%",s=n(window).width()/2-205,o=readCookie("ScrollPosition");o!=null&&(eraseCookie("ScrollPosition"),e=0,e=parseInt(o)+100+"px"),i=t.Dialog,i=i.replace("#",""),u=i+"Box",n(t.Dialog).wrapInner('<div id="'+u+'" class="ModalDialog" style="top: '+e+"; display: block; left: "+s+'px; "><div class="yafpopup"><div class="DialogContent">'),n("#"+u+" .popup").after('<a href="javascript:void(0);" class="close" id="'+i+'Close"><img src="'+t.ImagePath+'closelabel.png" title="close" class="close_image"><\/a>'),n(t.Dialog).after('<div id="'+u+'_overlay" class="ModalDialog_hide ModalDialog_overlayBG" style="display: none; opacity: 0.2; "><\/div>'),n(t.Dialog).fadeIn("normal"),n("#"+u+"_overlay").css("filter","alpha(opacity=20)"),n("#"+u+"_overlay").fadeIn("normal"),n(document).bind("keydown."+i,function(i){return i.keyCode==27&&n.fn.YafModalDialog.Close(t),!0}),n("#"+i+"Close").click(function(){n.fn.YafModalDialog.Close(t)})}})(jQuery);