var n_cache=[],c_cache=[],comm_id,comm_edit_id,s_id,e_id;function IPMenu(a,c,b,d){var e=[];e[0]='<a href="https://www.nic.ru/whois/?ip='+a+'" target="_blank">'+c+"</a>";e[1]='<a href="'+dle_root+dle_admin+"?mod=iptools&ip="+a+'" target="_blank">'+b+"</a>";e[2]='<a href="'+dle_root+dle_admin+"?mod=blockip&ip="+a+'" target="_blank">'+d+"</a>";return e}function ajax_cancel_for_edit(a){if(n_cache[a]!="")document.getElementById("news-id-"+a).innerHTML=n_cache[a];return false}
function whenCompletedSave(){n_cache[e_id]=""}
function ajax_save_for_edit(a,c){var b=new dle_ajax,d=0,e="";if(document.getElementById("allow_br_"+a).checked)d=1;e_id=a;b.onShow("");e=quick_wysiwyg=="1"?b.encodeVAR($("#dleeditnews"+a).html()):b.encodeVAR(document.getElementById("dleeditnews"+a).value);var f=b.encodeVAR(document.getElementById("edit-title-"+a).value);e="news_txt="+e;b.setVar("id",a);b.setVar("allow_br",d);b.setVar("title",f);b.setVar("reason",b.encodeVAR(document.getElementById("edit-reason-"+a).value));b.setVar("field",c);b.setVar("action",
"save");b.requestFile=dle_root+"engine/ajax/editnews.php";b.method="POST";b.element="news-id-"+a;b.onCompletion=whenCompletedSave;b.sendAJAX(e);return false}function whenCompleted(){setTimeout(function(){$("html:not(:animated)"+(!$.browser.opera?",body:not(:animated)":"")).animate({scrollTop:$("#news-id-"+s_id).position().top-70},700)},100)}
function ajax_prep_for_edit(a,c){if(!n_cache[a]||n_cache[a]=="")n_cache[a]=document.getElementById("news-id-"+a).innerHTML;var b=new dle_ajax;s_id=a;b.onShow("");b.setVar("id",a);b.setVar("field",c);b.setVar("action","edit");b.requestFile=dle_root+"engine/ajax/editnews.php";b.method="GET";b.element="news-id-"+a;b.execute=true;b.onCompletion=whenCompleted;b.sendAJAX("");return false}
function whenCompletedCommentsEdit(){setTimeout(function(){$("html:not(:animated)"+(!$.browser.opera?",body:not(:animated)":"")).animate({scrollTop:$("#comm-id-"+comm_id).position().top-70},700)},100)}function MenuCommBuild(a,c){var b=[];b[0]="<a onclick=\"ajax_comm_edit('"+a+"', '"+c+'\'); return false;" href="#">'+menu_short+"</a>";b[1]='<a href="'+dle_root+"?do=comments&action=comm_edit&id="+a+"&area="+c+'">'+menu_full+"</a>";return b}
function ajax_comm_edit(a,c){if(!c_cache[a]||c_cache[a]=="")c_cache[a]=document.getElementById("comm-id-"+a).innerHTML;var b=new dle_ajax;comm_id=a;b.onShow("");b.setVar("id",a);b.setVar("area",c);b.setVar("action","edit");b.requestFile=dle_root+"engine/ajax/editcomments.php";b.method="GET";b.element="comm-id-"+a;b.execute=true;b.onCompletion=whenCompletedCommentsEdit;b.sendAJAX("");return false}
function ajax_cancel_comm_edit(a){if(n_cache[a]!="")document.getElementById("comm-id-"+a).innerHTML=c_cache[a];return false}function whenCompletedSaveComments(){c_cache[comm_edit_id]=""}
function ajax_save_comm_edit(a,c){var b=new dle_ajax,d="";comm_edit_id=a;b.onShow("");d=dle_wysiwyg=="yes"?b.encodeVAR($("#dleeditcomments"+a).html()):b.encodeVAR(document.getElementById("dleeditcomments"+a).value);d="comm_txt="+d;b.setVar("id",a);b.setVar("area",c);b.setVar("action","save");b.requestFile=dle_root+"engine/ajax/editcomments.php";b.method="POST";b.element="comm-id-"+a;b.onCompletion=whenCompletedSaveComments;b.sendAJAX(d);return false}
function whenCommentsDeleted(a){a=parseInt(a);if(!isNaN(a)){$("html"+(!$.browser.opera?",body":"")).animate({scrollTop:$("#comment-id-"+a).position().top-70},700);setTimeout(function(){$("#comment-id-"+a).hide("blind",{},1400)},700)}}
function DeleteComments(a,c){DLEconfirm(dle_del_agree,dle_confirm,function(){var b=new dle_ajax;b.onShow("");var d="id="+a;b.setVar("dle_allow_hash",c);b.requestFile=dle_root+"engine/ajax/deletecomments.php";b.method="GET";b.onCompletion=whenCommentsDeleted;b.sendAJAX(d)})}
function doFavorites(a,c){var b=new dle_ajax;b.onShow("");var d="fav_id="+a;b.setVar("action",c);b.setVar("skin",dle_skin);b.requestFile=dle_root+"engine/ajax/favorites.php";b.method="GET";b.element="fav-id-"+a;b.sendAJAX(d);return false}function CheckLogin(){var a=new dle_ajax,c=a.encodeVAR(document.getElementById("name").value);a.onShow("");a.requestFile=dle_root+"engine/ajax/registration.php";a.method="POST";a.element="result-registration";a.sendAJAX("name="+c);return false}
function doCalendar(a,c,b){var d=new dle_ajax;d.onShow("");d.setVar("year",c);d.setVar("month",a);d.requestFile=dle_root+"engine/ajax/calendar.php";d.method="GET";d.effect=b;d.element="calendar-layer";d.sendAJAX("")}function ShowBild(a){window.open(dle_root+"engine/modules/imagepreview.php?image="+a,"","resizable=1,HEIGHT=200,WIDTH=200, top=0, left=0, scrollbars=yes")}
function doRate(a,c){var b=new dle_ajax;b.onShow("");var d="go_rate="+a;b.setVar("news_id",c);b.setVar("skin",dle_skin);b.requestFile=dle_root+"engine/ajax/rating.php";b.method="GET";b.element="ratig-layer";b.sendAJAX(d)}function dleRate(a,c){var b=new dle_ajax;b.onShow("");var d="go_rate="+a;b.setVar("news_id",c);b.setVar("skin",dle_skin);b.setVar("mode","short");b.requestFile=dle_root+"engine/ajax/rating.php";b.method="GET";b.element="ratig-layer-"+c;b.sendAJAX(d)}
function doAddComments(){var a=document.getElementById("dle-comments-form"),c=new dle_ajax;if(dle_wysiwyg=="yes"){document.getElementById("comments").value=$("#comments").html();c.setVar("editor_mode","wysiwyg")}if(a.comments.value==""||a.name.value==""){DLEalert(dle_req_field,dle_info);return false}c.onShow("");var b="post_id="+a.post_id.value;c.setVar("comments",c.encodeVAR(a.comments.value));c.setVar("name",c.encodeVAR(a.name.value));c.setVar("mail",c.encodeVAR(a.mail.value));c.setVar("skin",dle_skin);
a.sec_code&&c.setVar("sec_code",a.sec_code.value);if(a.allow_subscribe)a.allow_subscribe.checked==true?c.setVar("allow_subscribe","1"):c.setVar("allow_subscribe","0");c.requestFile=dle_root+"engine/ajax/addcomments.php";c.method="POST";c.execute=true;c.effect="blind";c.element="dle-ajax-comments";c.sendAJAX(b)}
function dle_copy_quote(a){dle_txt="";if(window.getSelection)dle_txt=window.getSelection();else if(document.selection)dle_txt=document.selection.createRange().text;if(dle_txt!="")dle_txt="[quote="+a+"]"+dle_txt+"[/quote]\n"}
function dle_ins(a){if(!document.getElementById("dle-comments-form"))return false;var c=document.getElementById("dle-comments-form").comments;if(dle_wysiwyg=="no")c.value+=dle_txt!=""?dle_txt:"[b]"+a+"[/b],\n";else tinyMCE.execInstanceCommand("comments","mceInsertContent",false,dle_txt!=""?dle_txt:"<b>"+a+"</b>,<br />",true)}
function ShowOrHide(a){var c=$("#"+a);a=document.getElementById("image-"+a)?document.getElementById("image-"+a):null;if(c.css("display")=="none"){c.show("blind",{},1000);if(a)a.src=dle_root+"templates/"+dle_skin+"/dleimages/spoiler-minus.gif"}else{c.hide("blind",{},1000);if(a)a.src=dle_root+"templates/"+dle_skin+"/dleimages/spoiler-plus.gif"}}
function ckeck_uncheck_all(){for(var a=document.pmlist,c=0;c<a.elements.length;c++){var b=a.elements[c];if(b.type=="checkbox")b.checked=a.master_box.checked==true?false:true}a.master_box.checked=a.master_box.checked==true?false:true}function confirmDelete(a){DLEconfirm(dle_del_agree,dle_confirm,function(){document.location=a})}function setNewField(a,c){if(a!=selField){fombj=c;selField=a}}
function dle_news_delete(a){DLEconfirm(dle_del_agree,dle_confirm,function(){document.location=dle_root+"index.php?do=deletenews&id="+a+"&hash="+dle_login_hash})}
function MenuNewsBuild(a,c){var b=[];b[0]="<a onclick=\"ajax_prep_for_edit('"+a+"', '"+c+'\'); return false;" href="#">'+menu_short+"</a>";if(dle_admin!="")b[1]='<a href="'+dle_root+dle_admin+"?mod=editnews&action=editnews&id="+a+'" target="_blank">'+menu_full+"</a>";if(allow_dle_delete_news)b[2]="<a onclick=\"dle_news_delete ('"+a+'\'); return false;" href="#">'+dle_del_news+"</a>";return b}
function DLEalert(a,c){$("#dlepopup").remove();$("body").append("<div id='dlepopup' title='"+c+"' style='display:none'><br />"+a+"</div>");$("#dlepopup").dialog({autoOpen:true,width:470,buttons:{Ok:function(){$(this).dialog("close");$("#dlepopup").remove()}}})}
function DLEconfirm(a,c,b){var d={};d[dle_act_lang[1]]=function(){$(this).dialog("close");$("#dlepopup").remove()};d[dle_act_lang[0]]=function(){$(this).dialog("close");$("#dlepopup").remove();b&&b()};$("#dlepopup").remove();$("body").append("<div id='dlepopup' title='"+c+"' style='display:none'><br />"+a+"</div>");$("#dlepopup").dialog({autoOpen:true,width:470,buttons:d})}
function DLEprompt(a,c,b,d){var e={};e[dle_act_lang[3]]=function(){$(this).dialog("close")};e[dle_act_lang[2]]=function(){if($("#dle-promt-text").val().length<1)$("#dle-promt-text").addClass("ui-state-error");else{var f=$("#dle-promt-text").val();$(this).dialog("close");$("#dlepopup").remove();d&&d(f)}};$("#dlepopup").remove();$("body").append("<div id='dlepopup' title='"+b+"' style='display:none'><br />"+a+"<br /><br /><input type='text' name='dle-promt-text' id='dle-promt-text' class='ui-widget-content ui-corner-all' style='width:97%; padding: .4em;' value='"+
c+"'/></div>");$("#dlepopup").dialog({autoOpen:true,width:470,show:"blind",hide:"blind",buttons:e})}var dle_user_profile="",dle_user_profile_link="";
function ShowPopupProfile(a){var c={};c[menu_profile]=function(){document.location=dle_user_profile_link};if(dle_group!=5)c[menu_send]=function(){document.location=dle_root+"index.php?do=pm&doaction=newpm&username="+dle_user_profile};if(dle_group==1)c[menu_uedit]=function(){$(this).dialog("close");window.open(""+dle_root+dle_admin+"?mod=editusers&action=edituser&user="+dle_user_profile+"","User","toolbar=0,location=0,status=0, left=0, top=0, menubar=0,scrollbars=yes,resizable=0,width=540,height=500")};
$("#dleprofilepopup").remove();$("body").append(a);$("#dleprofilepopup").dialog({autoOpen:true,show:"fade",hide:"fade",buttons:c,width:450});return false}
function ShowProfile(a,c){if(dle_user_profile==a&&document.getElementById("dleprofilepopup")){$("#dleprofilepopup").dialog("open");return false}var b=new dle_ajax;dle_user_profile=a;dle_user_profile_link=c;b.onShow("");b.setVar("name",a);b.setVar("skin",dle_skin);b.requestFile=dle_root+"engine/ajax/profile.php";b.method="GET";b.onCompletion=ShowPopupProfile;b.sendAJAX("");return false}
function FastSearch(){$("#story").attr("autocomplete","off");$("#story").blur(function(){$("#searchsuggestions").fadeOut()});$("#story").keyup(function(){var a=$(this).val();if(a.length==0)$("#searchsuggestions").fadeOut();else if(dle_search_value!=a&&a.length>3){clearInterval(dle_search_delay);dle_search_delay=setInterval(function(){dle_do_search(a)},600)}})}
function dle_do_search(a){clearInterval(dle_search_delay);$("#searchsuggestions").remove();$("body").append("<div id='searchsuggestions' style='display:none'></div>");$("#searchsuggestions").css({position:"absolute"});$("#searchsuggestions").position({my:"left top",at:"left bottom",of:"#story",collision:"fit flip"});$.post(dle_root+"engine/ajax/search.php",{query:""+a+""},function(c){$("#searchsuggestions").fadeIn();$("#searchsuggestions").html(c)});dle_search_value=a};