var c_cache=[],dle_poll_voted=[];function reload(){var e=(new Date).getTime();document.getElementById("dle-captcha").innerHTML='
'}function dle_change_sort(e,o){var t=document.getElementById("news_set_sort");return t.dlenewssortby.value=e,t.dledirection.value=o,t.submit(),!1}function doPoll(e,o){var t=document.getElementById("dlepollform_"+o),i=t.status.value,n="";if(1!=dle_poll_voted[o]){if("results"!=e&&1!=i){for(var d=0;d'+o+"",n[1]=''+t+"",n[2]=''+i+"",n}function ajax_save_for_edit(e,o){var t={};return"2"==quick_wysiwyg&&tinyMCE.triggerSave(),$.each($("#ajaxnews"+e).serializeArray(),function(e,o){-1!=o.name.indexOf("xfield")&&(t[o.name]=o.value)}),document.getElementById("allow_br_"+e).checked&&(t.allow_br=1),document.getElementById("approve_"+e).checked&&(t.approve=1),t.news_txt=$("#dleeditnews"+e).val(),t.full_txt=$("#dleeditfullnews"+e).val(),t.title=$("#edit-title-"+e).val(),t.reason=$("#edit-reason-"+e).val(),t.id=e,t.field=o,t.action="save",ShowLoading(""),$.post(dle_root+"engine/ajax/editnews.php",t,function(e){HideLoading(""),"ok"!=e?DLEalert(e,dle_info):($("#dlepopup-news-edit").dialog("close"),DLEconfirm(dle_save_ok,dle_confirm,function(){location.reload(!0)}))}),!1}function ajax_prep_for_edit(e,o){for(var t=0,i=c_cache.length;t'),$("#modal-overlay").css({filter:"alpha(opacity=40)"}).fadeIn();var n={};n[dle_act_lang[3]]=function(){$(this).dialog("close")},n[dle_act_lang[4]]=function(){ajax_save_for_edit(e,o)},$("#dlepopup-news-edit").remove(),$("body").prepend(""),$(".dlepopupnewsedit").html(""),$("#dlepopup-news-edit").dialog({autoOpen:!0,width:800,height:600,buttons:n,resizable:!1,dialogClass:"modalfixed dle-popup-quickedit",dragStart:function(e,o){i=$(".modalfixed").css("box-shadow"),$(".modalfixed").css("box-shadow","none")},dragStop:function(e,o){$(".modalfixed").css("box-shadow",i)},close:function(e,o){$(this).dialog("destroy"),$("#modal-overlay").fadeOut(function(){$("#modal-overlay").remove()})}}),830<$(window).width()&&530<$(window).height()&&($(".modalfixed.ui-dialog").css({position:"fixed"}),$("#dlepopup-news-edit").dialog("option","position",["0","0"])),$("#dlepopup-news-edit").css({overflow:"auto"}),$("#dlepopup-news-edit").css({"overflow-x":"hidden"}),$("#dlepopup-news-edit").html(t)},"html"),!1}function ajax_comm_edit(e,o){for(var t=0,i=c_cache.length;t")).replace(/&/g,"&");$("#ratig-layer-"+o).html(t),$("#vote-num-id-"+o).html(e.votenum)}else e.error&&DLEalert(e.errorinfo,dle_info)},"json")}function doCommentsRate(e,o){ShowLoading(""),$.get(dle_root+"engine/ajax/ratingcomments.php",{go_rate:e,c_id:o,skin:dle_skin},function(e){if(HideLoading(""),e.success){var t=(t=(t=(t=e.rating).replace(/</g,"<")).replace(/>/g,">")).replace(/&/g,"&");$("#comments-ratig-layer-"+o).html(t),$("#comments-vote-num-id-"+o).html(e.votenum)}else e.error&&DLEalert(e.errorinfo,dle_info)},"json")}function ajax_cancel_reply(){$("#dlefastreplycomments").hide("blind",{},1400)}function ajax_fast_reply(e,o){var t=$("#comments"+e).val(),i=$("#name"+e).val(),n=$("#question_answer"+e).val(),d=$("#sec_code"+e).val(),l=$("#recaptcha"+e).val(),a=$("#subscribe"+e+":checked").val(),s=$("#postid"+e).val();return""==i||""==t?(DLEalert(dle_req_field,dle_info),!1):(l=l?grecaptcha.getResponse(recaptcha_widget):"",a||(a=0),d||(d=""),n||(n=""),ShowLoading(""),$.post(dle_root+"engine/ajax/addcomments.php",{post_id:s,parent:e,indent:o,comments:t,name:i,mail:"",editor_mode:"",skin:dle_skin,sec_code:d,question_answer:n,g_recaptcha_response:l,allow_subscribe:a},function(o){HideLoading(""),$("#blind-animation"+e).remove(),$("#dlefastreplyesponse").html(o),"error"!=o&&document.getElementById("blind-animation"+e)&&($("html,body").stop().animate({scrollTop:$("#dlefastreplyesponse").offset().top-70},1100),setTimeout(function(){$("#blind-animation"+e).show("blind",{},1500),$("#dlefastreplycomments").hide("blind",{},1500)},1100))},"html"),!1)}function dle_reply(e,o,t){var i={};return $("#dlereplypopup").remove(),"1"==t&&($("#dlefastreplycomments").remove(),$("#dlefastreplyesponse").remove()),i[dle_act_lang[3]]=function(){$(this).dialog("close")},i[dle_p_send]=function(){if("1"==dle_wysiwyg||"2"==dle_wysiwyg){"2"==dle_wysiwyg&&tinyMCE.triggerSave();var t="wysiwyg"}else t="";var i=$("#comments"+e).val(),n=$("#name"+e).val(),d=$("#mail"+e).val(),l=$("#question_answer"+e).val(),a=$("#sec_code"+e).val(),s=$("#recaptcha"+e).val(),r=$("#subscribe"+e+":checked").val(),p=$("#postid"+e).val();return""==n||""==i?(DLEalert(dle_req_field,dle_info),!1):(s=s?grecaptcha.getResponse(recaptcha_widget):"",r||(r=0),a||(a=""),l||(l=""),ShowLoading(""),$.post(dle_root+"engine/ajax/addcomments.php",{post_id:p,parent:e,indent:o,comments:i,name:n,mail:d,editor_mode:t,skin:dle_skin,sec_code:a,question_answer:l,g_recaptcha_response:s,allow_subscribe:r},function(o){HideLoading(""),$("#blind-animation"+e).remove(),$("#comments-tree-item-"+e).append(o),"error"!=o&&document.getElementById("blind-animation"+e)&&($("#dlereplypopup").remove(),$("html,body").stop().animate({scrollTop:$("#comments-tree-item-"+e).offset().top+$("#comments-tree-item-"+e).height()-70},1100),setTimeout(function(){$("#blind-animation"+e).show("blind",{},1500)},1100))},"html"),!1)},ShowLoading(""),$.get(dle_root+"engine/ajax/replycomments.php",{id:e,indent:o,skin:dle_skin},function(o){HideLoading(""),"1"==t?($("#comment-id-"+e).append(""),$("#dlefastreplycomments").html(o),$("html,body").stop().animate({scrollTop:$("#comment-id-"+e).offset().top+$("#comment-id-"+e).height()-70},1100),setTimeout(function(){$("#dlefastreplycomments").show("blind",{},1500)},1100)):($("body").append(""),$("#dlereplypopup").html(o),$("#dlereplypopup").dialog({autoOpen:!0,width:700,resizable:!1,dialogClass:"modalfixed dle-popup-replycomments",buttons:i}),$(".modalfixed.ui-dialog").css({position:"fixed"}),$("#dlereplypopup").dialog("option","position",["0","0"]))},"html"),!1}function doAddComments(){var e=document.getElementById("dle-comments-form");if("1"==dle_wysiwyg||"2"==dle_wysiwyg){"2"==dle_wysiwyg&&tinyMCE.triggerSave();var o="wysiwyg"}else o="";if(""==e.comments.value||""==e.name.value)return DLEalert(dle_req_field,dle_info),!1;var t=e.question_answer?e.question_answer.value:"",i=e.sec_code?e.sec_code.value:"",n="undefined"!=typeof grecaptcha?grecaptcha.getResponse():"",d=e.allow_subscribe&&1==e.allow_subscribe.checked?"1":"0",l=e.mail?e.mail.value:"";return ShowLoading(""),$.post(dle_root+"engine/ajax/addcomments.php",{post_id:e.post_id.value,comments:e.comments.value,name:e.name.value,mail:l,editor_mode:o,skin:dle_skin,sec_code:i,question_answer:t,g_recaptcha_response:n,allow_subscribe:d},function(o){HideLoading(""),$("#dle-ajax-comments").html(o),"error"!=o&&document.getElementById("blind-animation")&&($("html,body").stop().animate({scrollTop:$("#dle-ajax-comments").offset().top-70},1100),setTimeout(function(){$("#blind-animation").show("blind",{},1500)},1100),e.sec_code&&(e.sec_code.value="",reload()),"undefined"!=typeof grecaptcha&&grecaptcha.reset())},"html"),!1}function isHistoryApiAvailable(){return!(!window.history||!history.pushState)}function CommentsPage(e,o,t){return ShowLoading(""),$.get(dle_root+"engine/ajax/comments.php",{cstart:e,news_id:o,skin:dle_skin},function(i){HideLoading(""),isNaN(e)||isNaN(o)||($("#dle-comm-link").off("click"),$("#dle-comm-link").on("click",function(){return CommentsPage(e,o),!1})),scroll(0,$("#dle-comments-list").offset().top-70),$("#dle-comments-list").html(i.comments),$(".dle-comments-navigation").html(i.navigation),isHistoryApiAvailable()&&window.history.pushState(null,null,t)},"json"),!1}function dle_copy_quote(e){dle_txt="",window.getSelection?dle_txt=window.getSelection():document.selection&&(dle_txt=document.selection.createRange().text),""!=dle_txt&&(dle_txt="[quote="+e+"]"+dle_txt+"[/quote]")}function dle_fastreply(e){if(!document.getElementById("dle-comments-form"))return!1;var o=document.getElementById("dle-comments-form").comments,t="";return"0"==dle_wysiwyg||"-1"==dle_wysiwyg?(o.value="0"==dle_wysiwyg?o.value+"[b]"+e+"[/b],\n":o.value+(e+",\n"),o.focus()):(t=""+e+",
","1"==dle_wysiwyg?($("#comments").froalaEditor("events.focus"),$("#comments").froalaEditor("html.insert",t,!0)):tinyMCE.execCommand("mceInsertContent",!1,t)),setTimeout(function(){$("html,body").stop().animate({scrollTop:$("#dle-comments-form").offset().top-70},700)},100),!1}function dle_ins(e){if(!document.getElementById("dle-comments-form"))return!1;var o=document.getElementById("dle-comments-form").comments,t="";return""!=dle_txt?("0"==dle_wysiwyg||"-1"==dle_wysiwyg?(o.value+=dle_txt+"\n",o.focus()):(t=dle_txt+"
","1"==dle_wysiwyg?($("#comments").froalaEditor("events.focus"),$("#comments").froalaEditor("html.insert",t,!0)):tinyMCE.execCommand("mceInsertContent",!1,t)),setTimeout(function(){$("html,body").stop().animate({scrollTop:$("#dle-comments-form").offset().top-70},700)},100)):(ShowLoading(""),$.get(dle_root+"engine/ajax/quote.php",{id:e},function(e){HideLoading(""),"0"==dle_wysiwyg||"-1"==dle_wysiwyg?(e=(e=(e=(e=(e=(e=(e=e.replace(/</g,"<")).replace(/>/g,">")).replace(/&/g,"&")).replace(/"/g,'"')).replace(/'/g,"'")).replace(/'/g,"'")).replace(/"/g,'"'),o.value+=e+"\n",o.focus()):(t=e+"
","1"==dle_wysiwyg?($("#comments").froalaEditor("events.focus"),$("#comments").froalaEditor("html.insert",t,!0)):tinyMCE.execCommand("mceInsertContent",!1,t)),setTimeout(function(){$("html,body").stop().animate({scrollTop:$("#dle-comments-form").offset().top-70},700)},100)})),!1}function ShowOrHide(e){var o=$("#"+e);e=document.getElementById("image-"+e)?document.getElementById("image-"+e):null;var t=o.height()/200*1e3;3e3t&&(t=250),"none"==o.css("display")?(o.show("blind",{},t),e&&(e.src=dle_root+"templates/"+dle_skin+"/dleimages/spoiler-minus.gif")):(2e3$("#dle-promt-text").val().length)$("#dle-promt-text").addClass("ui-state-error");else{var o=$("#dle-promt-text").val();$(this).dialog("close"),$("#dlepopup").remove(),$.post(dle_root+"engine/ajax/message.php",{id:e,text:o},function(o){"ok"==o?document.location=dle_root+"index.php?do=deletenews&id="+e+"&hash="+dle_login_hash:DLEalert("Send Error",dle_info)})}},$("#dlepopup").remove(),$("body").append(""),$("#dlepopup").dialog({autoOpen:!0,width:500,resizable:!1,dialogClass:"modalfixed dle-popup-newsdelete",buttons:o}),$(".modalfixed.ui-dialog").css({position:"fixed"}),$("#dlepopup").dialog("option","position",["0","0"])}),o[dle_act_lang[0]]=function(){$(this).dialog("close"),document.location=dle_root+"index.php?do=deletenews&id="+e+"&hash="+dle_login_hash},$("#dlepopup").remove(),$("body").append(""),$("#dlepopup").dialog({autoOpen:!0,width:500,resizable:!1,dialogClass:"modalfixed dle-popup-newsdelete",buttons:o}),$(".modalfixed.ui-dialog").css({position:"fixed"}),$("#dlepopup").dialog("option","position",["0","0"])}function MenuNewsBuild(e,o){var t=[];return t[0]="'+menu_short+"",""!=dle_admin&&(t[1]=''+menu_full+""),allow_dle_delete_news&&(t[2]="'+dle_notice+"",t[3]="'+dle_del_news+""),t}function sendNotice(e){var o={};o[dle_act_lang[3]]=function(){$(this).dialog("close")},o[dle_p_send]=function(){if(1>$("#dle-promt-text").val().length)$("#dle-promt-text").addClass("ui-state-error");else{var o=$("#dle-promt-text").val();$(this).dialog("close"),$("#dlepopup").remove(),$.post(dle_root+"engine/ajax/message.php",{id:e,text:o,allowdelete:"no"},function(e){"ok"==e&&DLEalert(dle_p_send_ok,dle_info)})}},$("#dlepopup").remove(),$("body").append(""),$("#dlepopup").dialog({autoOpen:!0,width:500,resizable:!1,dialogClass:"modalfixed dle-popup-sendmessage",buttons:o}),$(".modalfixed.ui-dialog").css({position:"fixed"}),$("#dlepopup").dialog("option","position",["0","0"])}function AddComplaint(e,o){var t={};t[dle_act_lang[3]]=function(){$(this).dialog("close")},t[dle_p_send]=function(){if(1>$("#dle-promt-text").val().length)$("#dle-promt-text").addClass("ui-state-error");else{var t=$("#dle-promt-text").val();$(this).dialog("close"),$("#dlepopup").remove(),$.post(dle_root+"engine/ajax/complaint.php",{id:e,text:t,action:o},function(e){DLEalert("ok"==e?dle_p_send_ok:e,dle_info)})}},$("#dlepopup").remove(),$("body").append(""),$("#dlepopup").dialog({autoOpen:!0,width:500,resizable:!1,dialogClass:"modalfixed dle-popup-complaint",buttons:t}),$(".modalfixed.ui-dialog").css({position:"fixed"}),$("#dlepopup").dialog("option","position",["0","0"])}function DLEalert(e,o){$("#dlepopup").remove(),$("body").append(""),$("#dlepopup").dialog({autoOpen:!0,width:470,resizable:!1,dialogClass:"modalfixed dle-popup-alert",buttons:{Ok:function(){$(this).dialog("close"),$("#dlepopup").remove()}}}),$(".modalfixed.ui-dialog").css({position:"fixed"}),$("#dlepopup").dialog("option","position",["0","0"])}function DLEconfirm(e,o,t){var i={};i[dle_act_lang[1]]=function(){$(this).dialog("close"),$("#dlepopup").remove()},i[dle_act_lang[0]]=function(){$(this).dialog("close"),$("#dlepopup").remove(),t&&t()},$("#dlepopup").remove(),$("body").append(""),$("#dlepopup").dialog({autoOpen:!0,width:500,resizable:!1,dialogClass:"modalfixed dle-popup-confirm",buttons:i}),$(".modalfixed.ui-dialog").css({position:"fixed"}),$("#dlepopup").dialog("option","position",["0","0"])}function DLEprompt(e,o,t,i,n){var d={};d[dle_act_lang[3]]=function(){$(this).dialog("close")},d[dle_act_lang[2]]=function(){if(!n&&1>$("#dle-promt-text").val().length)$("#dle-promt-text").addClass("ui-state-error");else{var e=$("#dle-promt-text").val();$(this).dialog("close"),$("#dlepopup").remove(),i&&i(e)}},$("#dlepopup").remove(),$("body").append(""),$("#dlepopup").dialog({autoOpen:!0,width:500,resizable:!1,dialogClass:"modalfixed dle-popup-promt",buttons:d}),$(".modalfixed.ui-dialog").css({position:"fixed"}),$("#dlepopup").dialog("option","position",["0","0"]),0'),$("#modal-overlay").css({filter:"alpha(opacity=40)"}).fadeIn("slow"),$("#dleuserpopup").remove(),$("body").append(""),e[dle_act_lang[3]]=function(){$(this).dialog("close"),$("#dleuserpopup").remove()},e[dle_act_lang[5]]=function(){window.frames.edituserframe.confirmDelete(dle_login_hash)},e[dle_act_lang[4]]=function(){document.getElementById("edituserframe").contentWindow.document.getElementById("saveuserform").submit()},$("#dleuserpopup").dialog({autoOpen:!0,show:"fade",width:560,resizable:!1,dialogClass:"modalfixed dle-popup-userprofileadmin",buttons:e,open:function(e,o){$("#dleuserpopup").html("")},beforeClose:function(e,o){$("#dleuserpopup").html("")},close:function(e,o){$("#modal-overlay").fadeOut("slow",function(){$("#modal-overlay").remove()})}}),830<$(window).width()&&530<$(window).height()&&($(".modalfixed.ui-dialog").css({position:"fixed"}),$("#dleuserpopup").dialog("option","position",["0","0"]))}),$("#dleprofilepopup").remove(),$("body").append(e),$("#dleprofilepopup").dialog({autoOpen:!0,show:"fade",hide:"fade",resizable:!1,dialogClass:"dle-popup-userprofile",buttons:t,width:550}),!1}function ShowProfile(e,o,t){return dle_user_profile==e&&document.getElementById("dleprofilepopup")?($("#dleprofilepopup").dialog("open"),!1):(dle_user_profile=e,dle_user_profile_link=o,ShowLoading(""),$.get(dle_root+"engine/ajax/profile.php",{name:e,skin:dle_skin},function(e){HideLoading(""),ShowPopupProfile(e,t)}),!1)}function FastSearch(){$("#story").attr("autocomplete","off"),$("#story").blur(function(){$("#searchsuggestions").fadeOut()}),$("#story").keyup(function(){var e=$(this).val();0==e.length?$("#searchsuggestions").fadeOut():dle_search_value!=e&&3"),$.post(dle_root+"engine/ajax/search.php",{query:""+e},function(e){$("#searchsuggestions").html(e).fadeIn().css({position:"absolute",top:0,left:0}).position({my:"left top",at:"left bottom",of:"#story",collision:"fit flip"})}),dle_search_value=e}function ShowLoading(e){$("#loading-layer").remove(),$("body").append(""),e?$("#loading-layer").html(e):$("#loading-layer").html(dle_act_lang[6]),e=($(window).width()-$("#loading-layer").width())/2;var o=($(window).height()-$("#loading-layer").height())/2;$("#loading-layer").css({left:e+"px",top:o+"px",position:"fixed",zIndex:"99"}),$("#loading-layer").fadeTo("slow",.6)}function HideLoading(e){$("#loading-layer").fadeOut("slow",function(){$("#loading-layer").remove()})}function ShowAllVotes(){return document.getElementById("dlevotespopup")?($("#dlevotespopup").dialog("open"),!1):($.ajaxSetup({cache:!1}),ShowLoading(""),$.get(dle_root+"engine/ajax/allvotes.php?dle_skin="+dle_skin,function(e){HideLoading(""),$("#dlevotespopup").remove(),$("body").append(e),$(".dlevotebutton").button(),$("#dlevotespopup").dialog({autoOpen:!0,show:"fade",hide:"fade",resizable:!1,dialogClass:"dle-popup-allvotes",width:600}),400<$("#dlevotespopupcontent").height()&&$("#dlevotespopupcontent").height(400),$("#dlevotespopup").dialog("option","height",$("#dlevotespopupcontent").height()+60),$("#dlevotespopup").dialog("option","position","center")}),!1)}function fast_vote(e){var o=$("#vote_"+e+" input:radio[name=vote_check]:checked").val();return ShowLoading(""),$.get(dle_root+"engine/ajax/vote.php",{vote_id:e,vote_action:"vote",vote_mode:"fast_vote",vote_check:o,vote_skin:dle_skin},function(o){HideLoading(""),$("#dle-vote_list-"+e).fadeOut(500,function(){$(this).html(o),$(this).fadeIn(500)})}),!1}function AddIgnorePM(e,o){DLEconfirm(o,dle_confirm,function(){ShowLoading(""),$.get(dle_root+"engine/ajax/pm.php",{id:e,action:"add_ignore",skin:dle_skin},function(e){return HideLoading(""),DLEalert(e,dle_info),!1})})}function DelIgnorePM(e,o){DLEconfirm(o,dle_confirm,function(){ShowLoading(""),$.get(dle_root+"engine/ajax/pm.php",{id:e,action:"del_ignore",skin:dle_skin},function(o){return HideLoading(""),$("#dle-ignore-list-"+e).html(""),DLEalert(o,dle_info),!1})})}function subscribe(e){return DLEconfirm(dle_sub_agree,dle_confirm,function(){ShowLoading(""),$.get(dle_root+"engine/ajax/commentssubscribe.php",{news_id:e,skin:dle_skin,user_hash:dle_login_hash},function(e){HideLoading(""),e.success?DLEalert(e.info,dle_info):e.error&&DLEalert(e.errorinfo,dle_info)},"json")}),!1}function media_upload(e,o,t,i){var n=(new Date).getTime(),d="none";return $("#mediaupload").remove(),$("body").append(""),$("#mediaupload").dialog({autoOpen:!0,width:710,resizable:!1,dialogClass:"modalfixed dle-popup-upload",open:function(d,l){$("#mediaupload").html(""),$(".ui-dialog").draggable("option","containment","")},dragStart:function(e,o){d=$(".modalfixed").css("box-shadow"),$(".modalfixed").fadeTo(0,.6).css("box-shadow","none"),$("#mediaupload").css("visibility","hidden")},dragStop:function(e,o){$(".modalfixed").fadeTo(0,1).css("box-shadow",d),$("#mediaupload").css("visibility","visible")},beforeClose:function(e,o){$("#mediaupload").html("")}}),830<$(window).width()&&530<$(window).height()&&($(".modalfixed.ui-dialog").css({position:"fixed"}),$("#mediaupload").dialog("option","position",["0","0"])),!1}function dropdownmenu(e,o,t,i){return window.event?event.cancelBubble=!0:o.stopPropagation&&o.stopPropagation(),(o=$("#dropmenudiv")).is(":visible")?(clearhidemenu(),o.fadeOut("fast"),!1):(o.remove(),$("body").append(''),(o=$("#dropmenudiv")).html(t.join("")),i&&o.width(i),(t=$(document).width()-30)-(i=$(e).offset()).lefte("#dle-promt-text").val().length)e("#dle-promt-text").addClass("ui-state-error");else{var o=e("#dle-promt-text").val(),t=e("#orfom").text();e(this).dialog("close"),e("#dlepopup").remove(),e.post(dle_root+"engine/ajax/complaint.php",{seltext:t,text:o,action:"orfo",url:window.location.href},function(e){DLEalert("ok"==e?dle_p_send_ok:e,dle_info)})}},e("#dlepopup").remove(),e("body").append(""),e("#dlepopup").dialog({autoOpen:!0,width:600,resizable:!1,dialogClass:"modalfixed dle-popup-complaint",buttons:o}),e(".modalfixed.ui-dialog").css({position:"fixed"}),e("#dlepopup").dialog("option","position",["0","0"])}})});