var friendBox;function addToFriend(a){return addToFriends(a)}function myguestreset(){ge("myguests").style.display="none";Ajax.Post({url:"newsfeed.php",query:{act:"a_guest_reset"}});return false}function addToFriends(id,obj){if(friendBox==undefined){friendBox=new MessageBox({title:"Добавление в друзья",width:400})}var url,act;url="friends_ajax.php";act="request_form";friendBox.removeButtons();friendBox.addButton({label:"Отмена",style:"button_gray",onClick:function(){friendBox.hide()}});friendBox.addButton({label:"Добавить в друзья",onClick:function(){var form=ge("addFriendForm");if(!form){return}var params=serializeForm(form);Ajax.postWithCaptcha(url,params,{onSuccess:function(ajax,responseText){try{var response=eval("("+responseText+")");responseText=response.result||response.error||response.text}catch(e){}friendBox.content(responseText).removeButtons();friendBox.addButton({label:"Закрыть",onClick:function(){friendBox.hide()}});friendBox.show();hide(obj);setTimeout("friendBox.hide(600)",1200)}})}});friendBox.content('<div class="box_loader"></div>').show();Ajax.Post({url:url,query:{act:act,fid:id},onDone:function(ajaxObj,responseText){var text=responseText;try{var response=eval("("+responseText+")");if(response.error){friendBox.removeButtons().addButton({label:"Закрыть",style:"button_gray",onClick:function(){friendBox.hide()}})}friendBox.content(response.text).show();if(response.script){var script=response.script.replace(/^[\s\\n]+/g,"");eval(script)}}catch(e){}}});return false}var friendDeleteBox;function removeFriend(c,b,a){if(friendDeleteBox==undefined){friendDeleteBox=new MessageBox({title:"Удаление из списка друзей"})}friendDeleteBox.removeButtons();friendDeleteBox.addButton({onClick:function(){friendDeleteBox.hide(200)},style:"button_gray",label:"Отмена"}).addButton({onClick:function(){Ajax.Post({url:"friends_ajax.php",query:{fid:c,act:"decline_friend",hash:a},onDone:function(d,e){hide(b)}});friendDeleteBox.hide(200)},label:"Удалить"});friendDeleteBox.loadContent("friends_ajax.php",{act:"remove_box",fid:c}).show();return false}function showRateBox(){addCss("css/privacy.css");addCss("css/wiki.css");if(rateBox==undefined){rateBox=new MessageBox({title:getLang("global_rating_box_header"),bodyStyle:"padding:0px",width:"480px",progress:"rateProgress"})}rateBox.removeButtons();rateBox.addButton({onClick:function(){rateBox.hide(200)},label:box_close});rateBox.loadContent("rate.php",{act:"a_get_rate"},true).show();return false}var voteBox;function showVoteBox(){addCss("skin/def/css/privacy.css");if(voteBox==undefined){voteBox=new MessageBox({title:getLang("rate_voting"),bodyStyle:"padding:0px",width:"480px",progress:"voteProgress"})}voteBox.removeButtons();voteBox.addButton({style:"button_gray",onClick:function(){voteBox.hide(200)},label:global_cancel});voteBox.loadContent("rate.php",{act:"a_get_vote_box",id:ge("mid").value},true).show();return false}var giftBox,giftBoxTitle;function showGiftBox(a){giftBoxTitle=a;if(!giftBox){addCss("skin/def/css/al/gifts.css");addCss("skin/def/css/privacy.css");if(!window.Dropdown){attachScript("uiControls","js/lib/ui_controls.js");addCss("skin/def/css/ui_controls.css")}giftBox=new MessageBox({title:a,bodyStyle:"padding:0px",width:"654px",progress:"gifts_progress"})}giftBox.removeButtons();giftBox.addButton({onClick:function(){giftBox.hide(200)},label:box_close});giftBox.loadContent("gifts.php",{act:"a_get_gift_box",id:ge("mid").value},true).show();return false}var giftSendBox,selectedGift,giftPrice;function showGift(a,c,b,d){giftSendBox.show();selectedGift=a;giftPrice=b;if(window.userBalance<b){show("gift_error")}else{hide("gift_error")}ge("gift_loader").innerHTML='<img src="'+base_domain+"images/gifts/256/"+a+'.jpg" />';return false}function doSendGift(num){if(isVisible("send_progress")){return}hide("gift_msg_link");show("send_progress");var onComplete=function(ajaxObj,responseText){hide("send_progress");show("gift_msg_link");if(ajaxObj.status==400){show("gift_error");ge("gift_error").innerHTML=responseText;animate(ge("gift_error").firstChild,{backgroundColor:"#F9F6E7",borderColor:"#D4BC4C"},5000)}else{var result=eval("("+responseText+")");window.userBalance=result.balance;if(result.balance){show("left_balance_box");ge("left_balance_box").innerHTML=result.balance_html}else{hide("left_balance_box")}var profileBlock=ge("profile_gifts");if(profileBlock){profileBlock.innerHTML=result.profile_html}showGiftResult(result.result)}};Ajax.Send("gifts.php",{act:"do_send",to_users:ge("mid").value,giftType:ge("giftType").value,giftNumber:selectedGift,giftText:ge("gift_text").value,hash:giftHash},{onSuccess:onComplete,onFail:onComplete});return false}var giftResultBox;function showGiftResult(a){if(!giftResultBox){giftResultBox=new MessageBox({title:giftBoxTitle,width:"444px"});giftResultBox.addButton({label:box_close,onClick:giftResultBox.hide})}giftResultBox.content(a).show();setTimeout(function(){giftResultBox.hide(400)},1200)}var curGiftFilter="0";function giftsFilter(a){ge("giftTab"+curGiftFilter).className="t_filter_off";ge("giftTab"+a).className="t_filter_selected";curGiftFilter=a;show("gifts_progress");Ajax.Send("gifts.php",{act:"a_get_gifts",filter:a},function(b,c){ge("selectGift").innerHTML=c;hide("gifts_progress")})}activity_editor={active:false,menu_active:false,activity_text:"",activity_blur:false,activity_reblur:false,setup:function(a){this.activity_text=a},reset:function(){ge("edit_activity_text").value="";return false},show:function(){if(!this.active){historyAjaxHide();hide("profile_activity");hide("profile_empty_activity");this.hide_menu();show("activity_editor");if(ge("activity_text").firstChild){this.activity_text=ge("activity_text").firstChild.nodeValue}ge("edit_activity_text").value=this.activity_text;ge("edit_activity_text").focus();ge("edit_activity_text").select();this.activity_blur=true;setTimeout(function(){activity_editor.active=true},200)}else{ge("edit_activity_text").focus()}return false},hide:function(){if(!this.active){return}setTimeout(function(){activity_editor.active=false},200);this.activity_blur=false;hide("activity_editor");show((this.activity_text!="")?"profile_activity":"profile_empty_activity");return false},toggle_menu:function(a){if(browser.safari||browser.msie||browser.opera){this.activity_reblur=true}if(this.menu_active){return this.hide_menu()}else{return this.show_menu()}},show_menu:function(a){this.menu_active=true;ge("edit_activity_toggle").style.backgroundImage="url("+base_domain+"images/activity_on.gif)";ge("edit_activity_toggle").style.backgroundColor="#fff";ge("edit_activity_select").style.display="block";return false},hide_menu:function(){this.menu_active=false;ge("edit_activity_toggle").style.backgroundImage="url("+base_domain+"images/activity_off.gif)";ge("edit_activity_toggle").style.backgroundColor="#D8DFEA";hide("edit_activity_select");return false},activity_select:function(a){if(browser.safari||browser.msie||browser.opera){this.activity_reblur=true}this.hide_menu();ge("edit_activity_text").value=a.innerHTML;ge("edit_activity_text").focus();ge("edit_activity_text").select();return false},menu_over:function(a){a.style.backgroundColor="#45688E";a.style.color="#fff"},menu_out:function(a){a.style.backgroundColor="white";a.style.color="#000"},blur:function(a){if(browser.opera&&!a){setTimeout(function(){activity_editor.blur(1)},100);return false}if(this.activity_reblur){ge("edit_activity_text").focus();this.activity_reblur=false;return false}if(this.activity_blur){if(ge("edit_activity_text").value!=this.activity_text){this.submit_activity_set(ge("edit_activity_text").value)}else{this.hide()}}return true},activity_set:function(a){this.activity_text=a||"";this.reset();this.hide();if(a!=null&&a!=""){ge("activity_text").innerHTML=this.activity_text;ge("activity_time_link").innerHTML=activity_update_just_now}else{ge("activity_text").innerHTML=activity_cant_update}},submit_activity_set:function(d){if(d==null||d==""){return}var a=function(){ge("edit_activity_text").focus()};var c=function(){ge("edit_activity_text").style.backgroundImage=""};var f=function(h,g){c();activity_editor.activity_set(g)};var e=function(g){c();activity_editor.activity_set(null)};var b={onSuccess:f,onFail:e,onCaptchaShow:c,onCaptchaHide:a};ge("edit_activity_text").style.backgroundImage="url("+base_domain+"images/progress_candy_hor.gif)";Ajax.postWithCaptcha(ge("activitygroup").value>0?"/group.php":"/profile.php",{setactivity:d,activityhash:ge("activityhash").value,activitygroup:ge("activitygroup").value},b);return false},activity_cleared:function(){this.activity_text="";ge("activity_text").innerHTML="";this.hide();ge("activity_blank_nag").innerHTML=activity_deleted;setTimeout(function(){ge("activity_blank_nag").innerHTML=activity_change_status}.bind(this),2500)},submit_activity_clear:function(){this.activity_blur=false;ajax=new Ajax();ajax.onDone=function(a,b){ge("edit_activity_text").style.backgroundImage="";this.activity_cleared()}.bind(this);ajax.onFail=function(a){ge("edit_activity_text").style.backgroundImage="";this.activity_cleared()}.bind(this);ge("edit_activity_text").style.backgroundImage="url("+base_domain+"images/progress_candy_hor.gif)";ajax.post("/profile.php",{clearactivity:"1",activityhash:ge("activityhash").value});return false},handle_key_press:function(a){a=a||window.event;key_code=a.keyCode||a.which;if(key_code==this.KEYS.RETURN){if(ge("edit_activity_text").value!=""){this.submit_activity_set(ge("edit_activity_text").value)}return false}if(key_code==this.KEYS.ESC){this.hide();return false}return true},KEYS:{BACKSPACE:8,TAB:9,RETURN:13,ESC:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}};historyShown=false;function getActivityHistory(a){ajax=new Ajax();ajax.onDone=onGotHistory;ajax.onFail=historyAjaxHide;historyAjaxProgress();ajax.post("/profile.php",{activityhistory:"1",id:a})}function onGotHistory(a,b){historyAjaxShow();ge("historyContainer").innerHTML=b}function deleteHistoryItem(a){ajax=new Ajax();ajax.onDone=onGotHistory;ajax.onFail=historyAjaxHide;historyAjaxProgress(1);ajax.post("/profile.php",{deletehistoryitem:"1",iid:a,activityhash:ge("activityhash").value})}function historyAjaxProgress(a){if(!a){hide("historyContainer");hide("historyHeader")}show("historyProgress");show("history")}function historyAjaxShow(){historyShown=true;show("history");hide("historyProgress");show("historyHeader");show("historyContainer")}function historyAjaxHide(){historyShown=false;hide("history");hide("historyProgress");hide("historyHeader");hide("historyContainer")}var tab_masks={friendsCommon:1,friends:2,friendsOnline:4,albums:8,videos:16,questions:32,matches:64,notes:128,groups:256,myguests:512,personal:1024,education:2048,career:4096,places:8192,military:16384,opinions:32768,audios:65536,wall:131072,gifts:262144,optional:524288};var group_tab_masks={information:1,members:2,groupType:4,admins:8,groupEvents:16,officers:32,links:64,applied:128,photos:256,topics:512,wall:1024,albums:2048,videos:4096,audios:8192,recentNews:16384,voting:32768,apps:65536,description:131072};function collapseBox(b,a,i,g,j){var e=ge(b);if(!e){return}var k=(j)?group_tab_masks:tab_masks;var d=(j)?"group_closed_tabs":"closed_tabs";var h=geByClass("c",e)[0];if(!h){return}var f=isVisible(h)?"bShut":"bOpen";if(slideToggle(h,300,function(){if(!k[b]){return}var c=parseInt(getCookie("remix"+d));if(isVisible(h)){c=isNaN(c)?0:c&~k[b]}else{c=isNaN(c)?k[b]:c|k[b]}setCookie("remix"+d,c,360)})){a.parentNode.className=f}return false}function quickReply(g,b,f,e){var a=ge(g);if(!a){return}var d=geByClass("r",a)[0];if(!d){return}if(!isVisible(d)){slideDown(d,200,function(){ge("reply_field").focus()})}else{slideUp(d,200)}}function addFave(){ajax=new Ajax();ge("faveProgress").innerHTML="<IMG SRC='images/upload.gif'>";ajax.onDone=function(a,b){ge("addToFaves").innerHTML=b};ajax.onFail=function(a){};ajax.post("/fave.php",{act:"addPerson",mid:ge("mid").value,hash:ge("faveHash").value})}function deleteFave(){ajax=new Ajax();ge("faveProgress").innerHTML="<IMG SRC='images/upload.gif'>";ajax.onDone=function(a,b){ge("addToFaves").innerHTML=b};ajax.onFail=function(a){};ajax.post("/fave.php",{act:"deletePerson",mid:ge("mid").value,hash:ge("faveHash").value})}function addFaveGroup(){ajax=new Ajax();ge("faveProgress").innerHTML="<IMG SRC='images/upload.gif'>";ajax.onDone=function(a,b){ge("addToFaves").innerHTML=b};ajax.onFail=function(a){};ajax.post("/fave.php",{act:"addGroup",gid:ge("mid").value,hash:ge("faveHash").value})}function deleteFaveGroup(){ajax=new Ajax();ge("faveProgress").innerHTML="<IMG SRC='images/upload.gif'>";ajax.onDone=function(a,b){ge("addToFaves").innerHTML=b};ajax.onFail=function(a){};ajax.post("/fave.php",{act:"deleteGroup",gid:ge("mid").value,hash:ge("faveHash").value})};
