window.addEvent("domready",function(){var D=new Tips(".tips");if(user_id!=""&&$("privmsgs-unread")){var F=function(){getData("privmsgs",{})};F.periodical(privmsgs_interval);$$(".privmsgs-unread").addEvent("click",function(I){I.stop();privmsgID=this.href.replace(/.+\privmsg_id=(\d+)$/,"$1");closePrivmsg(privmsgID);getData("privmsgs_read",{privmsg_id:privmsgID})})}if($("login-open")&&$("login-close")){$("login-open").addEvent("click",function(I){I.stop();$("dark").setStyle("display","block");$("login").setStyle("display","block")});$("login-close").addEvent("click",function(I){I.stop();$("dark").setStyle("display","none");$("login").setStyle("display","none")});document.addEvent("keyup",function(I){if(I.code==27){$("dark").setStyle("display","none");$("login").setStyle("display","none")}})}if($("logout")){$("logout").addEvent("click",function(I){if(!confirm(lng.confirm_logout)){I.stop()}})}if($("search_text")){$("search_text").addEvent("blur",function(I){if(this.value==""){this.value=lng.l_search_desc}});$("search_text").addEvent("focus",function(I){if(this.value==lng.l_search_desc){this.value=""}})}$$("DIV.box-special-2 DIV.item").addEvent("mouseover",onItem);$$("DIV.box-special-2 DIV.item").addEvent("mouseout",offItem);if($("slider-timer")){var G=new Scroller("slider-timer",{area:300,velocity:0.05});G.start()}if($("slider-wrapper")){var C=new Fx.Scroll("slider-wrapper",{wait:false,duration:300,transition:Fx.Transitions.Quad.easeInOut});$("slider-l").addEvent("click",function(I){new Event(I).stop();if($("slider-content-"+sliderBack)){C.toElement("slider-content-"+sliderBack);sliderBack--;sliderNext--}});$("slider-r").addEvent("click",function(I){new Event(I).stop();var J=parseInt($("slider-end").value);if($("slider-content-"+(sliderNext+J))){C.toElement("slider-content-"+sliderNext);sliderBack++;sliderNext++}})}$$("IMG.zoom-image").each(function(I){I.zoom=new Fx.Morph(I,{duration:"short",transition:Fx.Transitions.Sine.easeOut,link:"cancel"});I.addEvents({mouseenter:function(K){var J=K.target;J.zoom.start({width:getNaturalWidth(this),height:getNaturalHeight(this),"margin-top":-20,"margin-bottom":-20})},mouseleave:function(K){var J=K.target;J.zoom.start({width:J.get("width"),height:J.get("height"),"margin-top":0,"margin-bottom":0})}})});$$(".slider-2 .item").addEvent("mouseover",function(I){this.className="item-on"});$$(".slider-2 .item").addEvent("mouseout",function(I){this.className="item"});if($("rating-gals")){$$("#rating-gals LI A").addEvent("click",function(I){I.stop();loader();galleryID=this.href.replace(/.+\&gallery_id=(\d+)\&.+/,"$1");rate=this.innerHTML;getData("rating_gals",{gallery_id:galleryID,rate:rate})})}if($("rating-photos")){$$("#rating-photos LI A").addEvent("click",function(I){I.stop();loader();photoID=this.href.replace(/.+\&photo_id=(\d+)\&.+/,"$1");rate=this.innerHTML;getData("rating_photos",{photo_id:photoID,rate:rate})})}$$(".photogals-del").addEvent("click",function(I){galleryID=this.href.replace(/.+\/(\d+)$/,"$1");if(!confirm(lng.confirm_photos_gals_del.substitute({title:$("photogals-title-"+galleryID).get("text")}))){I.stop()}});$$(".photos-del").addEvent("click",function(I){I.stop();lnk=this;photoID=lnk.href.replace(/.+\&photo_id=(\d+)$/,"$1");if(confirm(lng.confirm_photos_del)){loader();getData("photos_del",{photo_id:photoID})}});$$(".poster-del").addEvent("click",function(I){posterID=this.href.replace(/.+\/(\d+)$/,"$1");if(!confirm(lng.confirm_poster_del.substitute({title:$("poster-title-"+posterID).get("text")}))){I.stop()}});if($("place_address_map")){$("place_address_map").addEvent("blur",function(I){q=this.getProperty("value").replace(/,/g,"");q=escape(getURI(q));getExternalData("http://maps.google.com/maps/geo?q="+q+"&output=json&key=ABQIAAAA6skFfwC15UOVvF211mznrBRdkwc5aBtwgigaOkRWqi55KNVHBRRWER5JIliy8_f9kCCY58wLFuu3Bg",function(K){$("error_gmap").setStyle("display","none");if(K.Placemark!=undefined){var L=K.Placemark[0].Point.coordinates[1];var J=K.Placemark[0].Point.coordinates[0];document.form.place_latitude.value=L;document.form.place_longitude.value=J;loadGMap(L,J)}else{$("map").setStyle("display","none");$("error_gmap").set("text",lng.error_google_maps);$("error_gmap").setStyle("display","block")}})})}$$(".places-del").addEvent("click",function(I){placeID=this.href.replace(/.+\/(\d+)$/,"$1");if(!confirm(lng.confirm_places_del.substitute({title:$("place-title-"+placeID).get("text")}))){I.stop()}});$$("A.rating-posts").addEvent("click",function(I){I.stop();lnk=this;streamID=lnk.href.replace(/.+\&stream_id=(\d+)\&.+/,"$1");postID=lnk.href.replace(/.+\&post_id=(\d+)\&.+/,"$1");rate=lnk.href.replace(/.+\&rate=(.+)$/,"$1");loader();getData("rating_posts",{stream_id:streamID,post_id:postID,rate:rate})});$$("A.rating-posts-comments").addEvent("click",function(I){I.stop();lnk=this;commentID=lnk.href.replace(/.+\&comment_id=(\d+)\&.+/,"$1");rate=lnk.href.replace(/.+\&rate=(.+)$/,"$1");loader();getData("rating_posts_comments",{comment_id:commentID,rate:rate})});$$("A.subscribe-posts").addEvent("click",function(I){I.stop();loader();lnk=this;streamID=lnk.href.replace(/.+\&stream_id=(\d+)$/,"$1");getData("stream_subscribe",{stream_id:streamID})});if($("complaint")){formComplaint=document.form_complaint;$$(".stream-posts-complaint-open").addEvent("click",function(I){I.stop();lnk=this;streamID=lnk.href.replace(/.+\&stream_id=(\d+).+/,"$1");postID=lnk.href.replace(/.+\&post_id=(\d+)/,"$1");postTitle=$("post-title-"+postID).get("text");formComplaint.stream_id.value=streamID;formComplaint.post_id.value=postID;$("complaint-to").set("html",lng.h_streams_posts_complaints_add.substitute({title:postTitle}));openComplaint()});$("form-complaint").addEvent("submit",function(I){I.stop();loader();formComplaint.submit.value=lng.submit_send_loading;formComplaint.submit.disabled=true;getData("posts_complaints_add",{stream_id:formComplaint.stream_id.value,post_id:formComplaint.post_id.value,complaint_text:formComplaint.complaint_text.value})});$("complaint-close").addEvent("click",function(I){I.stop();openComplaint()})}$$(".stream-posts-del").addEvent("click",function(I){postID=this.href.replace(/.+\/(\d+)$/,"$1");if(!confirm(lng.confirm_streams_posts_del.substitute({title:$("post-title-"+postID).get("text")}))){I.stop()}});$$(".stream-del").addEvent("click",function(I){streamID=this.href.replace(/.+\/(\d+)$/,"$1");if(!confirm(lng.confirm_streams_del.substitute({title:$("stream-title-"+streamID).get("text")}))){I.stop()}});$$("A.rating-entries").addEvent("click",function(I){I.stop();lnk=this;entryID=lnk.href.replace(/.+\&entry_id=(\d+)\&.+/,"$1");rate=lnk.href.replace(/.+\&rate=(.+)$/,"$1");loader();getData("rating_entries",{entry_id:entryID,rate:rate})});$$("A.rating-users").addEvent("click",function(I){I.stop();lnk=this;userID=lnk.href.replace(/.+\&user_id=(\d+)\&.+/,"$1");rate=lnk.href.replace(/.+\&rate=(.+)$/,"$1");loader();getData("rating_users",{user_id:userID,rate:rate})});if($("on-photo")){$("on-photo").addEvent("click",function(I){I.stop();loader();galleryID=this.href.replace(/.+\&gallery_id=(\d+)\&.+/,"$1");photoID=this.href.replace(/.+\&photo_id=(\d+)$/,"$1");getData("on_photo",{gallery_id:galleryID,photo_id:photoID})})}if($("onphotos-del")){$("onphotos-del").addEvent("click",function(I){I.stop();if(checkForm()){$("onphotos").submit()}})}$$(".poster-action").addEvent("click",function(I){I.stop();loader();lnk=this;posterID=lnk.href.replace(/.+\&poster_id=(\d+)$/,"$1");getData("poster_action",{poster_id:posterID})});$$(".places-subcats").addEvent("click",function(J){J.stop();var I=this.href.replace(/.+\/(\w+)$/,"$1");$$(".text-main").each(function(K){K.style.display="none"});$$(".pimp-light-on").each(function(K){K.className="pimp-light"});$("place-"+I).style.display="block";this.parentNode.className="pimp-light-on";if(I=="map"){loadGMap(latitude,longitude)}});$$(".places-visitor").addEvent("click",function(I){I.stop();loader();link=this;placeID=link.href.replace(/.+\&place_id=(\d+)$/,"$1");getData("places_visitors",{place_id:placeID})});if($("rating-places")){$$("#rating-places LI A").addEvent("click",function(I){I.stop();loader();placeID=this.href.replace(/.+\&place_id=(\d+)\&.+/,"$1");rate=this.innerHTML;getData("rating_places",{place_id:placeID,rate:rate})})}if($("add-comment")){$("add-comment").addEvent("submit",function(I){I.stop();commentID=0;addComment("add-comment")})}$$(".comments-reply-open").addEvent("click",function(I){I.stop();commentID=this.href.replace(/.+reply\_id=(\d+).+/,"$1");viewCommentReply(commentID)});$$(".comments-reply").addEvent("submit",function(I){I.stop();commentID=this.name.replace(/comments_reply_(\d+)/,"$1");addComment("comments-reply-"+commentID)});$$(".comments-edit-open").addEvent("click",function(I){I.stop();commentID=this.href.replace(/.+edit\_id=(\d+).+/,"$1");viewCommentEdit(commentID)});$$(".comments-edit").addEvent("submit",function(I){I.stop();editComment("comments-edit-"+commentID)});$$(".comments-del").addEvent("click",function(I){I.stop();commentID=this.href.replace(/.+\?del_id=(\d+)#.+/,"$1");if(confirm(lng.confirm_comments_del)){loader();getData("comments_del",{table_name:$("add-comment").table_name.value,field_name:$("add-comment").field_name.value,comment_id:commentID})}});$$(".gallery-view").addEvent("click",function(I){I.stop();photoNum=this.href.replace(/.+\/(\d+)$/,"$1");$("gallery-photo").src=$("gallery-photo").src.replace(/(.+)\/\d+_ave(.+)/,"$1/"+photoNum+"_ave$2");$("gallery-photo").parentNode.href=$("gallery-photo").parentNode.href.replace(/(.+)\/\d+\.(.+)/,"$1/"+photoNum+".$2")});if($("users-more-open")){var B=new Fx.Slide("users-more").hide();$("users-more-open").addEvent("click",function(I){I.stop();B.toggle();if(!B.open){this.className="icon-more-off";this.set("text",lng.l_users_more_off)}else{this.className="icon-more";this.set("text",lng.l_users_more)}})}if($("more-open")){$("more").setStyle("height","auto");var E=new Fx.Slide("more").hide();var A=$("more-open").get("text");$("more-open").addEvent("click",function(I){I.stop();E.toggle();if(!E.open){this.className=this.className.replace(/$/,"-off");this.set("text",lng.l_more_off);if($("no-more")){$("no-more").setStyle("display","none")}}else{this.className=this.className.replace("-off","");this.set("text",A);if($("no-more")){$("no-more").setStyle("display","block")}}})}if($("users-search-open")){slideUsersSearch=new Fx.Slide("users-search").hide();$("users-search-open").addEvent("click",function(I){I.stop();slideUsersSearch.toggle();if(!slideUsersSearch.open){this.className="icon-more-off"}else{this.className="icon-more"}})}$$(".icon-friends-add").addEvent("click",function(I){I.stop();loader();lnk=this;friendID=lnk.href.replace(/.+\&friend_id=(\d+)$/,"$1");getData("friends_add",{friend_id:friendID})});$$(".icon-friends-del").addEvent("click",function(I){I.stop();loader();lnk=this;friendID=lnk.href.replace(/.+\&friend_id=(\d+)$/,"$1");getData("friends_del",{friend_id:friendID})});if($("friends-del")){$("friends-del").addEvent("click",function(I){I.stop();if(checkForm()){$("friends").submit()}})}$$(".friends-wait").addEvent("click",function(I){I.stop();loader();lnk=this;friendID=lnk.href.replace(/.+\&friend_id=(\d+)\&.+/,"$1");c=lnk.href.replace(/.+\&control=(.+)$/,"$1");getData("friends_wait",{friend_id:friendID,control:c})});$$(".icon-black-add").addEvent("click",function(I){I.stop();loader();lnk=this;blackID=lnk.href.replace(/.+\&black_id=(\d+)$/,"$1");getData("black_add",{black_id:blackID})});$$(".icon-black-del").addEvent("click",function(I){I.stop();loader();lnk=this;blackID=lnk.href.replace(/.+\&black_id=(\d+)$/,"$1");getData("black_del",{black_id:blackID})});if($("black-del")){$("black-del").addEvent("click",function(I){I.stop();if(checkForm()){$("black").submit()}})}if($("privmsgs-select-all")||$("privmsgs-unselect")){$$("#privmsgs-select-all","#privmsgs-unselect").addEvent("click",function(L){L.stop();var J=$$(".privmsgs");var K=(this.id=="privmsgs-select-all")?true:false;for(var I=0;I<J.length;I++){J[I].checked=K}if(this.id=="privmsgs-select-all"){this.id="privmsgs-unselect";this.set("text",lng.l_unselect)}else{this.id="privmsgs-select-all";this.set("text",lng.l_select_all)}})}if($("privmsgs-del")){$("privmsgs-del").addEvent("click",function(I){I.stop();if(checkForm()){$("privmsgs").submit()}})}if($("privmsgs-send")){$("privmsg_text").addEvent("keyup",function(I){if(I.control&&I.code==13){sendPrivmsg()}});$("privmsgs-send").addEvent("submit",function(I){I.stop();sendPrivmsg()});$("privmsgs-cancel").addEvent("click",function(I){window.close()})}$$(".privmsgs-open").addEvent("click",function(I){I.stop();openPrivmsg(this)});$$(".lnk-profile").addEvent("click",function(I){if(user_id==""){I.stop();msg(lng.error_users_access)}});$$(".lnk-posts-add").addEvent("click",function(I){if(access.posts_add==""){I.stop();msg(lng.error_streams_posts_add)}});$$(".lnk-streams-add").addEvent("click",function(I){if(access.streams_add==""){I.stop();msg(lng.error_streams_add)}});$$(".lnk-opener").addEvent("click",function(I){I.stop();opener.location.href=this.href;opener.window.focus()});$$(".entries-del").addEvent("click",function(I){entryID=this.href.replace(/.+\/(\d+)$/,"$1");if(!confirm(lng.confirm_users_entries_del)){I.stop()}});if($("friends-list")){$("friends-list").setStyle("height","auto");var H=new Fx.Slide("friends-list").hide();$("friends-list-open").addEvent("click",function(I){I.stop();H.toggle();if(!H.open){this.className="icon-msg-more-off"}else{this.className="icon-msg-more"}})}});function resultData(D,C){if(C!=null){switch(D){case"top_users":$("top-body").innerHTML="";if(!C.error){if(!C.msg){var B=new Element("div",{"class":"body-users"}).inject("top-body");C.top_users.each(function(I){var K=new Element("div",{"class":"item"}).inject(B);K.addEvent("mouseover",onItem);K.addEvent("mouseout",offItem);var J=new Element("div",{"class":"photo"}).inject(K);var H=new Element("a",{href:I.user_path}).inject(J);new Element("img",{src:I.avatar.mini_path,alt:I.username}).inject(H);var M=new Element("div",{"class":"title"}).inject(K);var G=new Element("a",{href:I.user_path}).set("text",I.username).inject(M);var L=new Element("div",{"class":"desc"}).inject(K);var F=new Element("div",{"class":I.style}).inject(L);new Element("span").set("text",I.user_status_text).inject(F);new Element("div",{"class":"empty"}).inject(K)})}else{$("top-body").innerHTML='<p class="msg">'+C.msg+"</p>"}}else{msg(C.error)}break;case"top_photos":$("top-body").innerHTML="";if(!C.error){if(!C.msg){var B=new Element("div",{"class":"body-photos"}).inject("top-body");C.top_photos.each(function(H){var I=new Element("div",{"class":"item"}).inject(B);I.addEvent("mouseover",onItem);I.addEvent("mouseout",offItem);var G=new Element("div",{"class":"photo"}).inject(I);var F=new Element("a",{href:H.photo_path}).inject(G);new Element("img",{src:H.photo_pre_path,alt:H.gallery_title+" ("+H.photo_num+")"}).inject(F);var J=new Element("div",{"class":"title"}).set("html",H.rating_ave+"<br />"+H.rating_voters).inject(I);new Element("div",{"class":"empty"}).inject(I)})}else{$("top-body").innerHTML='<p class="msg">'+C.msg+"</p>"}}else{msg(C.error)}break;case"top_poster":$("top-body").innerHTML="";if(!C.error){if(!C.msg){var B=new Element("div",{"class":"body-poster"}).inject("top-body");C.top_poster.each(function(H){var I=new Element("div",{"class":"item"}).inject(B);I.addEvent("mouseover",onItem);I.addEvent("mouseout",offItem);var G=new Element("div",{"class":"photo"}).inject(I);var F=new Element("a",{href:H.poster_path}).inject(G);new Element("img",{src:H.photo_mini_path,alt:H.poster_title}).inject(F);var J=new Element("div",{"class":"title"}).inject(I);new Element("a",{href:H.poster_path}).set("text",H.poster_title).inject(J);new Element("div",{"class":"empty"}).inject(I)})}else{$("top-body").innerHTML='<p class="msg">'+C.msg+"</p>"}}else{msg(C.error)}break;case"users_views":$("visitors-body").innerHTML="";if(!C.error){if(!C.msg){var B=new Element("div",{"class":"body-users"}).inject("visitors-body");C.visitors.each(function(K){var J=new Element("div",{"class":"item"}).inject(B);J.addEvent("mouseover",onItem);J.addEvent("mouseout",offItem);var I=new Element("div",{"class":"photo"}).inject(J);var H=new Element("a",{href:K.user_path}).inject(I);new Element("img",{src:K.avatar.mini_path,alt:K.username}).inject(H);var M=new Element("div",{"class":"title"}).inject(J);var G=new Element("a",{href:K.user_path}).set("text",K.username).inject(M);var L=new Element("div",{"class":"desc"}).inject(J);var F=new Element("div",{"class":"user-date"}).inject(L);new Element("span").set("text",K.date_add).inject(F);var F=new Element("div",{"class":"status icon-status-"+K.user_status}).inject(J);new Element("div",{"class":"empty"}).inject(J)})}else{$("visitors-body").innerHTML='<p class="msg">'+C.msg+"</p>"}}else{msg(C.error)}break;case"rating_posts":loader();if(!C.error){$("rating-posts-"+postID).set("text",C.post_rating);if(C.user_streams_votes!=undefined){$("user-streams-votes").set("text",C.user_streams_votes);$("user-streams-votes-graphic").setStyle("width",C.user_streams_votes_percent+"%")}lnk.className+="-on";if($("rating-stream")){$("rating-stream").set("text",C.stream_rating)}msg(C.done)}else{msg(C.error)}break;case"rating_posts_comments":loader();if(!C.error){$("rating-posts-comments-"+commentID).set("text",C.comment_rating);if(C.user_streams_votes!=undefined){$("user-streams-votes").set("text",C.user_streams_votes);$("user-streams-votes-graphic").setStyle("width",C.user_streams_votes_percent+"%")}lnk.className="icon-"+rate+"-on";msg(C.done)}else{msg(C.error)}break;case"posts_complaints_add":loader();if(!C.error.main){openComplaint();formComplaint.complaint_text.value="";formComplaint.submit.value=lng.submit_send;formComplaint.submit.disabled=false;msg(C.done)}else{msg(C.error)}break;case"places_list":loader();if(!C.error){$("place_id").innerHTML='<option value="0">'+lng.l_none+"</option>";for(var A=0;A<C.places.length;A++){new Element("option",{value:C.places[A].place_id}).set("text",C.places[A].place_title).inject("place_id")}}else{msg(C.error)}break;case"rating_gals":loader();if(!C.error){$("rating-gals-box").innerHTML="";new Element("img",{src:"/tpl/img/rating_"+C.rating_ave_round+".gif",alt:C.rating_title}).inject("rating-gals-box");msg(C.done)}else{msg(C.error)}break;case"rating_photos":loader();if(!C.error){$("rating-photos-box").innerHTML="";new Element("img",{src:"/tpl/img/rating_dark_"+C.rating_ave_round+".gif",alt:C.rating_title}).inject("rating-photos-box")}else{msg(C.error)}break;case"rating_entries":loader();if(!C.error){$("rating-entries-"+entryID).set("text",C.entry_rating);if(C.user_streams_votes!=undefined){$("user-streams-votes").set("text",C.user_streams_votes);$("user-streams-votes-graphic").setStyle("width",C.user_streams_votes_percent+"%")}lnk.className+="-on";msg(C.done)}else{msg(C.error)}break;case"rating_users":loader();if(!C.error){$("rating-users-"+userID).set("text",C.user_rating);if(C.user_streams_votes!=undefined){$("user-streams-votes").set("text",C.user_streams_votes);$("user-streams-votes-graphic").setStyle("width",C.user_streams_votes_percent+"%")}lnk.className+="-on";msg(C.done)}else{msg(C.error)}break;case"photos_del":loader();if(!C.error){$("photo_num").value=$("photo_num").value-1;$("photo_line1_"+photoID).destroy();$("photo_line2_"+photoID).destroy();$("photo_line3_"+photoID).destroy();var E=$$("TD.num");for(var A=0;A<E.length;A++){E[A].set("text",(A+1))}msg(C.done)}else{msg(C.error)}break;case"stream_subscribe":loader();if(!C.error){lnk.set("text",C.subscribe_title);lnk.parentNode.set("class",C.subscribe_class);msg(C.done)}else{msg(C.error)}break;case"on_photo":loader();if(!C.error){$("on-photo-box").set("text",lng.l_on_photo_list+" ");C.onphoto_list.each(function(F){var G=new Element("a",{href:F.user_path}).set("text",F.username).inject("on-photo-box");$("on-photo-box").innerHTML+=" "})}else{msg(C.error)}break;case"poster_action":loader();if(!C.error){if($("poster-action-box-"+posterID)){$("poster-action-box-"+posterID).set("class",C.style)}$("poster-action-"+posterID).set("text",C.poster_action);msg(C.done)}else{msg(C.error)}break;case"friends_add":loader();if(!C.error){lnk.set("text",C.title);lnk.className="icon-friends-del";msg(C.done)}else{msg(C.error)}break;case"friends_del":loader();if(!C.error){lnk.set("text",C.title);lnk.className="icon-friends-add";msg(C.done)}else{msg(C.error)}break;case"friends_wait":loader();if(!C.error){$("friends-wait-"+friendID).destroy();$("friends-wait-count").set("text",$("friends-wait-count").get("text")-1);if($("friends-wait-count").get("text")==0){$("friends-wait").destroy()}msg(C.done)}else{msg(C.error)}break;case"black_add":loader();if(!C.error){lnk.set("text",C.title);lnk.className="icon-black-del";msg(C.done)}else{msg(C.error)}break;case"black_del":loader();if(!C.error){lnk.set("text",C.title);lnk.className="icon-black-add";msg(C.done)}else{msg(C.error)}break;case"privmsgs_add":loader();if(!C.error){f.privmsg_text.value="";closePrivmsg();window.close()}else{msg(C.error);f.send.value=lng.submit_send;f.send.disabled=false}break;case"places_visitors":loader();if(!C.error){link.set("text",C.title);msg(C.done)}else{msg(C.error)}break;case"rating_places":loader();if(!C.error){$("rating-places-box").innerHTML="";new Element("img",{src:"/tpl/img/rating_black_"+C.place_rating_ave_round+".gif",alt:C.place_rating_title}).inject("rating-places-box");$("rating-places-"+placeID).set("text",C.place_rating_ave);$("rating-voters-places-"+placeID).set("text",C.place_rating_voters)}else{msg(C.error)}break;case"places_photos_del":loader();if(!C.error){$("photo_num").value=$("photo_num").value-1;$("photo_line1_"+photoID).destroy();$("photo_line2_"+photoID).destroy();$("photo_line3_"+photoID).destroy();var E=$$("TD.num");for(var A=0;A<E.length;A++){E[A].set("text",(A+1))}msg(C.done)}else{msg(C.error)}break;case"comments_add":loader();if(!C.error){addElementComment(C)}else{msg(C.error)}f.add_comment.value=lng.submit_send;f.add_comment.disabled=false;break;case"comments_edit":loader();if(!C.error){$("comments-text-"+commentID).set("text",f.comment_text.value);msg(C.done)}else{msg(C.error)}f.edit_comment.value=lng.submit_save;f.edit_comment.disabled=false;break;case"comments_del":loader();if(!C.error){$("comment-"+commentID).destroy();$("comment-"+commentID+"-sep").destroy();msg(C.done)}else{msg(C.error)}break;case"privmsgs":if(!C.error){if(C.privmsg!=null){$("privmsgs-unread-username").set("html",C.privmsg.username_html);$("privmsgs-unread-avatar").set("html",C.privmsg.avatar_html);$("privmsgs-unread-date").set("text",C.privmsg.privmsg_date);$("privmsgs-unread-text").set("html",C.privmsg.privmsg_text);if(C.privmsg.privmsg_from_userid>0){$("privmsgs-unread-reply-box").setStyle("display","block")}else{$("privmsgs-unread-reply-box").setStyle("display","none")}$("privmsgs-unread-reply").set("href",C.privmsg.positive_path);$("privmsgs-unread-reply").set("class",C.privmsg.style_positive);$("privmsgs-unread-reply").set("text",C.privmsg.l_submit_positive);$("privmsgs-unread-close").set("href",C.privmsg.negative_path);$("privmsgs-unread-close").set("class",C.privmsg.style_negative);$("privmsgs-unread-close").set("text",C.privmsg.l_submit_negative);if($("privmsgs-unread").getStyle("display")=="none"){$("privmsgs-unread-reply").addEvent("click",function(F){F.stop();openPrivmsg(this)});$("privmsgs-unread-close").addEvent("click",function(F){F.stop();privmsgID=this.href.replace(/.+\privmsg_id=(\d+)$/,"$1");closePrivmsg(privmsgID);getData("privmsgs_read",{privmsg_id:privmsgID})})}$("privmsgs-unread").setStyle("display","block");$("user-b").setStyle("display","none")}}else{msg(C.error)}break;case"privmsgs_read":if(!C.error){}else{msg(C.error)}break;default:alert("Такого ajax-действия не существует.")}}else{}}function loadTOP(A){$("top-body").innerHTML='<div class="loader-special"><div>'+lng.l_loading+"</div></div>";getData("top_"+A,{})}function loadUsersViews(A){$("visitors-body").innerHTML='<div class="loader-special"><div>'+lng.l_loading+"</div></div>";getData("users_views",{user_id:document.visitors.user_id.value,when:A})}function loadPlaces(A){loader();getData("places_list",{pl_cat_id:A})}function addComment(B){f=$(B);var A={};A["comment-text-"+commentID]=[{code:"empty",text:lng.error_comments_text}];if(checkFormFields(A)){loader();f.add_comment.value=lng.submit_send_loading;f.add_comment.disabled=true;comment_text=f.comment_text.value.replace(/\n/g,"\\n");getData("comments_add",{table_name:$("add-comment").table_name.value,field_name:$("add-comment").field_name.value,id:$("add-comment").id.value,to_id:f.to_id.value,comment_text:comment_text})}}function addElementComment(E){if($("msg_comments")){$("msg_comments").destroy()}var D=new Element("div",{id:"comment_"+E.comments.comment_id,"class":"item-comments"}).inject($("comments_list"));var H=new Element("div",{"class":"wrapper"}).inject(D);var G=new Element("div",{"class":"comments-body"}).inject(H);new Element("p").set("html",E.comments.comment_text).inject(G);var F=new Element("div",{"class":"info"}).inject(D);new Element("a",{href:E.comments.user_path,name:"comment-"+E.comments.comment_id}).set("text",E.comments.username).inject(F);new Element("span").set("text",E.comments.date_add).inject(F);var B=new Element("div",{"class":"photo"}).inject(D);var C=new Element("a",{href:E.comments.user_path}).inject(B);new Element("img",{src:E.comments.avatar.mini_path,alt:E.comments.username}).inject(C);new Element("div",{"class":"empty"}).inject(D);var A=new Element("div",{"class":"sep"}).inject($("comments_list"));new Element("div").inject(A);if(f.to_id.value>0){viewCommentReply(f.to_id.value)}f.comment_text.value=""}function viewCommentReply(A){if($("comments-reply-"+A+"-box").style.display=="none"){$("comments-reply-"+A+"-open").className="pimp-main-mini";$("comments-reply-"+A+"-box").style.display="block";$("comment-text-"+A).focus()}else{$("comments-reply-"+A+"-open").className="pimp-mini";$("comments-reply-"+A+"-box").style.display="none"}}function viewCommentEdit(A){if($("comments-edit-"+A+"-box").style.display=="none"){$("comments-edit-"+A+"-open").set("class","pimp-main-mini");$("comments-edit-"+A+"-box").style.display="block";$("comment-text-edit-"+A).focus()}else{$("comments-edit-"+A+"-open").set("class","pimp-mini");$("comments-edit-"+A+"-box").style.display="none"}}function editComment(B){f=$(B);var A={};A["comment-text-edit-"+commentID]=[{code:"empty",text:lng.error_comments_text}];if(checkFormFields(A)){loader();f.edit_comment.value=lng.submit_save_loading;f.edit_comment.disabled=true;getData("comments_edit",{table_name:$("add-comment").table_name.value,field_name:$("add-comment").field_name.value,comment_id:f.comment_id.value,comment_text:f.comment_text.value});viewCommentEdit(commentID)}}function commentsDel(){$$(".comments_del").addEvent("click",function(A){A.stop();commentsDelConfirm(this.id)})}function commentsDelConfirm(D){if(confirm(lng.conform_comments_del)){var B=D.replace(/comments\_del\_/,"");var A="/inc/ajax.php?lang="+lang+"&action=comments_del";var C=new Json.Remote(A,{onComplete:function(F){if(!F.comments.error){$("comment_"+B+"").innerHTML="";msg(F.comments.done);if($("comments_list").getChildren().length==1){var E=$("comments_list").getChildren();E[0].className+=" end"}}else{msg(F.comments.error)}}}).send({comment_id:B})}}function onItem(){var B=$$("DIV.box-special-2 DIV.item");for(var A=0;A<B.length;A++){B[A].className=B[A].className.replace(" item-on","")}this.className+=" item-on"}function offItem(){this.className=this.className.replace(" item-on","")}function addElementUpload(I){var G=++$(I+"_num").value;var F=new Element("tr").inject(I+"s_list");var D=new Element("td",{rowspan:2,width:"40","class":"num"}).set("text",G).inject(F);var H=new Element("td").inject(F);new Element("input",{type:"file",name:I+"[]",size:20,id:I+"_"+G,"class":"upload"}).inject(H);var E=new Element("tr").inject(I+"s_list");var B=new Element("td",{colspan:2}).inject(E);var J=new Element("input",{type:"text",name:I+"_title[]",size:"20",maxlength:"100",value:lng.l_title,id:I+"_title_"+G,"class":"title m",events:{blur:function(){if(this.value==""){this.className+=" m";this.value=lng.l_title}},focus:function(){if(this.value==lng.l_title){this.className="title";this.value=""}}}}).inject(B);var C=new Element("tr").inject(I+"s_list");new Element("td").inject(C);var A=new Element("td",{colspan:3,"class":"space"}).inject(C);new Element("div",{id:"error_"+I+"_"+G,"class":"error",styles:{display:"none"}}).inject(A)}function openComplaint(){if($("complaint").getStyle("display")=="none"){scrollWindow.toTop();$("dark").setStyle("display","block");$("complaint").setStyle("display","block")}else{$("dark").setStyle("display","none");$("complaint").setStyle("display","none")}}function closePrivmsg(A){if(opener==null){$("privmsgs-unread").setStyle("display","none");$("user-b").setStyle("display","block")}else{opener.$("privmsgs-unread").setStyle("display","none");opener.$("user-b").setStyle("display","block")}}function sendPrivmsg(){f=document.privmsgs_send;var A={privmsg_text:[{code:"empty",text:lng.error_users_privmsgs_text}]};if(checkFormFields(A)){loader();f.submit.value=lng.submit_send_loading;f.submit.disabled=true;getData("privmsgs_add",{privmsg_to_userid:f.privmsg_to_userid.value,reply_to:f.reply_to.value,privmsg_text:f.privmsg_text.value})}}function openPrivmsg(A){if(user_status_privmsgs!=0&&user_status_privmsgs!=""){openWin(500,300,A.href)}else{msg(lng.error_users_privmsgs_status)}}tinyMCE.init({mode:"textareas",editor_selector:"mceEditor",theme:"advanced",plugins:"media,safari,fullscreen",theme_advanced_buttons1:"bold,italic,underline,|,link,unlink,|,image,media,|,undo,redo",theme_advanced_buttons2:"",theme_advanced_buttons3:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",external_image_list_url:"/inc/photos_list.php",language:"ru"});tinyMCE.init({mode:"textareas",editor_selector:"mceSimple",theme:"advanced",theme_advanced_buttons1:"link,unlink,|,undo,redo",theme_advanced_buttons2:"",theme_advanced_buttons3:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",language:"ru"});function checkFormFields(fields){var errorText="";var result=true;var error=false;$each(fields,function(field,index){$each(field,function(check){switch(check.code){case"zero":cond="$(index).get('value') == 0";break;case"empty":cond="$(index).get('value') == ''";break;case"empty_editor":cond="tinyMCE.activeEditor.getContent() == ''";break;case"uri":cond="/[а-яА-Я#'\" ]/.test($(index).get('value'))";break;case"photo":cond="$(index).value != '' && !/jpg|jpeg|gif|png$/i.test($(index).value)";break;case"photo_web":cond="($(index).value != '' && !/jpg|jpeg|gif|png$/i.test($(index).value)) || ($(index + '_web').value != lng['l_url'] && !/jpg|jpeg|gif|png$/.test($(index + '_web').value))";break;case"upload_count":var uploads=$$("INPUT."+index);var count_uploads=0;for(var x=0;x<uploads.length;x++){if(uploads[x].value!=""){count_uploads++}}cond="count_uploads == 0";break;case"email":cond="$(index).get('value') != '' && !/^[.-_A-Za-z0-9]+?@[.-A-Za-z0-9]+?.[A-Za-z0-9]{2,6}$/.test($(index).get('value'))";break;case"checked":cond="!$(index).checked";break;case"sex":cond="!$(index + '_1').get('checked') && !$(index + '_2').get('checked')";break;case"pwd_confirm":cond="$(index).get('value') != '' && $(index).get('value') != $(index + '_confirm').get('value')";break;default:cond=check.code}if(eval(cond)){error=true;errorText+=check.text+"<br />"}});if(error){result=false}error=false});if(errorText!=""){msg(errorText);scrollWindow.toTop()}return result};