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(tinyMCE.get("dleeditnews"+a).getContent()):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(){var a=document.getElementById("news-id-"+s_id);(a=_get_obj_toppos(a))&&scroll(0,a-70)}
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(){var a=document.getElementById("comm-id-"+comm_id);(a=_get_obj_toppos(a))&&scroll(0,a-70)}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(tinyMCE.get("dleeditcomments"+a).getContent()):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 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("");c="name="+c;a.requestFile=dle_root+"engine/ajax/registration.php";a.method="POST";a.element="result-registration";a.sendAJAX(c);return false}
function doCalendar(a,c){var b=new dle_ajax;b.onShow("");b.setVar("year",c);b.setVar("month",a);b.requestFile=dle_root+"engine/ajax/calendar.php";b.method="GET";b.element="calendar-layer";b.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("");a="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(a)}function dleRate(a,c){var b=new dle_ajax;b.onShow("");a="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(a)}
function doAddComments(){var a=document.getElementById("dle-comments-form"),c=new dle_ajax;if(dle_wysiwyg=="yes"){document.getElementById("comments").value=tinyMCE.get("comments").getContent();c.setVar("editor_mode","wysiwyg")}if(a.comments.value==""||a.name.value==""){alert(dle_req_field);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.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,b="";if(dle_wysiwyg=="no")c.value+=dle_txt!=""?dle_txt:"[b]"+a+"[/b],\n";else{b=dle_txt!=""?dle_txt:"<b>"+a+"</b>,<br />";tinyMCE.execInstanceCommand("comments","mceInsertContent",false,b,true)}}
function ShowOrHide(a){var c=document.getElementById(a);a=document.getElementById("image-"+a)?document.getElementById("image-"+a):null;if(c)if(c.style)if(c.style.display=="none"){c.style.display="";if(a)a.src=dle_root+"templates/"+dle_skin+"/dleimages/spoiler-minus.gif"}else{c.style.display="none";if(a)a.src=dle_root+"templates/"+dle_skin+"/dleimages/spoiler-plus.gif"}else c.visibility="show"}
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){if(confirm(dle_del_agree))document.location=a}function dle_smiley(a){doInsert(" "+a+" ","",false);document.getElementById("dle_emo").style.visibility="hidden";document.getElementById("dle_emo").style.display="none";ie_range_cache=null}
function DlePageCompleted(){hideBusyLayer();var a=document.getElementById("dle-content");(a=_get_obj_toppos(a))&&scroll(0,a-70)}function DlePage(a){showBusyLayer();if(document.getElementById("dle-info").innerHTML!="")document.getElementById("dle-info").innerHTML="";var c=new dle_ajax;c.onShow("");c.requestFile=dle_root+"engine/ajax/pages.php";c.method="GET";c.execute=true;c.element="dle-content";c.onCompletion=DlePageCompleted;c.sendAJAX(a)}
function setNewField(a,c){if(a!=selField){fombj=c;selField=a}}
function UserMenu(a,c,b){var d=[];d[0]="<a "+a+" >"+menu_profile+"</a>";d[1]='<a href="'+dle_root+"index.php?do=pm&doaction=newpm&user="+c+'">'+menu_send+"</a>";d[2]='<a href="'+dle_root+"index.php?do=lastcomments&userid="+c+'">'+menu_fcomments+"</a>";if(b=="1")d[3]="<a onclick=\"window.open('"+dle_root+dle_admin+"?mod=editusers&action=edituser&id="+c+"', 'User','toolbar=0,location=0,status=0, left=0, top=0, menubar=0,scrollbars=yes,resizable=0,width=540,height=500'); return false;\" href=\"#\">"+menu_uedit+"</a>";return d}
function UserNewsMenu(a,c,b,d){var e=[];e[0]="<a "+a+" >"+menu_profile+"</a>";e[1]="<a "+c+" >"+menu_fnews+"</a>";e[2]='<a href="'+dle_root+"index.php?do=pm&doaction=newpm&username="+b+'">'+menu_send+"</a>";if(d=="1")e[3]="<a onclick=\"window.open('"+dle_root+dle_admin+"?mod=editusers&action=edituser&user="+b+"', 'User','toolbar=0,location=0,status=0, left=0, top=0, menubar=0,scrollbars=yes,resizable=0,width=540,height=500'); return false;\" href=\"#\">"+menu_uedit+"</a>";return e}
function dle_news_delete(a){if(confirm(dle_del_agree))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};