var detect=navigator.userAgent.toLowerCase();var OS,browser,version,total,thestring;var OriginalPhoto=false;var pageWidth,pageHeight;function getBrowserInfo(){if(checkIt("konqueror")){browser="Konqueror";OS="Linux"}else{if(checkIt("safari")){browser="Safari"}else{if(checkIt("firefox")){browser="Firefox"}else{if(checkIt("omniweb")){browser="OmniWeb"}else{if(checkIt("opera")){browser="Opera"}else{if(checkIt("webtv")){browser="WebTV"}else{if(checkIt("icab")){browser="iCab"}else{if(checkIt("msie")){browser="Internet Explorer"}else{if(!checkIt("compatible")){browser="Netscape Navigator";version=detect.charAt(8)}else{browser="An unknown browser"}}}}}}}}}if(!version){version=detect.charAt(place+thestring.length)}if(!OS){if(checkIt("linux")){OS="Linux"}else{if(checkIt("x11")){OS="Unix"}else{if(checkIt("mac")){OS="Mac"}else{if(checkIt("win")){OS="Windows"}else{OS="an unknown operating system"}}}}}}function checkIt(a){place=detect.indexOf(a)+1;thestring=a;return place}Event.observe(window,"load",initialize,false);Event.observe(window,"load",getBrowserInfo,false);var lightbox=Class.create();lightbox.prototype={yPos:0,xPos:0,initialize:function(a){this.content=a.rel;Event.observe(a,"click",this.activate.bindAsEventListener(this),false);a.onclick=function(){return false}},activate:function(){this.getScroll();if(OriginalPhoto){this.prepareIE(pageHeight,"auto");this.hideSelects("visible")}else{this.prepareIE("100%","hidden");this.hideSelects("hidden")}this.setScroll(0,0);this.displayLightbox("block")},prepareIE:function(a,d){var c=document.getElementsByTagName("body")[0];c.style.height=a;c.style.overflow=d;var b=document.getElementsByTagName("html")[0];b.style.height=a;b.style.overflow=d},hideSelects:function(b){var d=document.getElementsByTagName("select");var a=d.length;for(var c=0;c<d.length;c++){d[c].style.visibility=b}},getScroll:function(){if(self.pageYOffset){this.yPos=self.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){this.yPos=document.documentElement.scrollTop}else{if(document.body){this.yPos=document.body.scrollTop}}}},setScroll:function(a,b){window.scrollTo(a,b)},displayLightbox:function(a){$("overlay").style.display=a;$(this.content).style.display=a;if(a!="none"){this.actions()}},actions:function(){var c=document.getElementsByClassName("lbAction");var a=c.length;for(var b=0;b<a;b++){Event.observe(c[b],"click",this[c[b].rel].bindAsEventListener(this),false);c[b].onclick=function(){return false}}},deactivate:function(){this.prepareIE("auto","auto");this.hideSelects("visible");this.displayLightbox("none");this.setScroll(0,this.yPos)}};function initialize(){addLightboxMarkup();getPageSize();var b=document.getElementsByClassName("lbOn");var a=b.length;for(var c=0;c<a;c++){valid=new lightbox(b[c])}}function getPageSize(){var d,a;if(window.innerHeight&&window.scrollMaxY){d=document.body.scrollWidth;a=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){d=document.body.scrollWidth;a=document.body.scrollHeight}else{d=document.body.offsetWidth;a=document.body.offsetHeight}}var c,e;if(self.innerHeight){c=self.innerWidth;e=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){c=document.documentElement.clientWidth;e=document.documentElement.clientHeight}else{if(document.body){c=document.body.clientWidth;e=document.body.clientHeight}}}if(a<e){pageHeight=e}else{pageHeight=a}if(d<c){pageWidth=c}else{pageWidth=d}var b=new Array(pageWidth,pageHeight,c,e);return b}function addLightboxMarkup(){var b=document.getElementsByTagName("body")[0];var a=document.createElement("div");a.id="overlay";b.appendChild(a)}function closeLightBox(){Element.replace($("lightboxinner"),'<div id="lightboxinner"></div>');$("close").click()}function loadLightBox(fun){if(!$("loadimg")){Element.replace($("lightboxinner"),'<div id="lightboxinner"><span id="loadimg"><img src="/images/common/loading.gif" /></span></div>')}var a_lightbox=$("a_lightbox");a_lightbox.click();eval(fun)}function getGroupPlane(d,a){var b="/common/get_group_plane";var c="friend_id="+d+"&flag="+a+TOKEN;new Ajax.Request(b,{method:"get",parameters:c,onComplete:function(e){Element.remove($("loadimg"))}});return false}function submitFriendGroup(c,g,a){var b=c.nextSibling.nextSibling;var e=c.previousSibling;var f=loadBeg(c,b);var d=$RF("group_id");if(!d){$T(e,"请选择分组！");loadEnd(f,b);return false}push_feat("submitFriendGroup");new Ajax.Request("/message/submit_friend_group",{method:"post",parameters:"friend_id="+g+"&group_id="+d+TOKEN,onComplete:function(k){loadEnd(f,b);var j=k.responseText;a=parseInt(a);if(a==1){closeLightBox();var i=$("group_"+g);Element.replace(i,"<span class='cf00'>好友分组："+j+"</span>")}else{if(a==2){var h=$F("cur_group");h=parseInt(h);d=parseInt(d);if(h!=-1&&d!=h){window.location.reload()}else{closeLightBox()}}else{if(a==3){closeLightBox();window.location.reload()}}}}});return false}function addGroup(){var a=$("new_group").innerHTML;var b=$("groups");new Insertion.Bottom(b,a)}function saveGroup(d,a){if(d.value){var b=-1;var e=d.value;a=parseInt(a);var c="g_id="+b+"&g_name="+e+TOKEN;push_feat("saveGroup");new Ajax.Request("/friends/submit_group_name",{parameters:c,onComplete:function(i){var h=parseInt(i.responseText);e=showText(e);var g=d.parentNode;g.id="e_"+h;g.className="t_sp2 dib w170";d.previousSibling.value=h;d.nextSibling.onclick=function(){removeGroupOnPlane(h,a)};Element.replace(d,'<span class="vb">'+e+"</span>");if(a==2){var f='<a id="g_tab_'+h+'" class="bc" href="/friends/index/'+h+'" title="'+e+'">'+e+"</a>";new Insertion.After($("group_tab"),f)}}})}else{cancelGroup(d)}return false}function cancelGroup(a){Element.remove(a.parentNode)}function removeGroupOnPlane(b,a){if(!confirm("如果删除此分组，分组中的好友将自动移动至“未分组”。是否删除此分组？")){return false}if($("cur_group")){var e=$F("cur_group");e=parseInt(e)}else{e=-1}var d=$CV("group_id");d=parseInt(d);var c="g_id="+b+TOKEN;push_feat("removeGroupOnPlane");new Ajax.Request("/friends/remove_group",{method:"post",parameters:c,onComplete:function(g){a=parseInt(a);b=parseInt(b);if(a==1){if(b==d){Element.remove($("e_"+b));var f=document.getElementsByName("group_id");f[0].checked=true}else{Element.remove($("e_"+b))}}if(a==2){if(b==e){window.location.href="/friends/index"}else{if(b==d){Element.remove($("e_"+b));Element.remove($("g_tab_"+b));var f=document.getElementsByName("group_id");f[0].checked=true}else{Element.remove($("e_"+b));Element.remove($("g_tab_"+b))}}}}});return false}function addFriend(d,e,a,c){var b=loadBegBig(d,"48","23");push_feat("addFriend");new Ajax.Request("/common/add_friend",{method:"post",parameters:"user_base_id="+e+TOKEN,onComplete:function(g){loadEnd(b);var f=parseInt(g.responseText);a=parseInt(a);if(a==1){if(f==1){c.innerHTML="<a title='删除好友' href='javascript:void(0);' class='f12a' onclick='removeFriend("+e+","+a+',$("'+c.id+"\"));'>删除好友</a>";loadLightBox(getGroupPlane(e,3))}else{if(f==2){c.innerHTML="<span title='等待确认' class='cc'>等待确认</span>"}}}else{if(a==2){c.innerHTML="<span class='cf00'>已同意</span>";loadLightBox(getGroupPlane(e,1))}else{if(a==3){if(f==1){Element.remove(c);loadLightBox(getGroupPlane(e,1))}else{if(f==2){c.innerHTML="<span title='等待确认' class='cc'>等待确认</span>"}}}}}}});return false}function removeFriend(c,a,b){if(!confirm("确定删除好友吗?")){return false}push_feat("removeFriend");new Ajax.Request("/common/remove_friend",{method:"post",parameters:"user_base_id="+c+TOKEN,onComplete:function(e){var d=parseInt(e.responseText);window.location.reload()}});return false}function ignoreFriend(b,c,a){push_feat("ignoreFriend");new Ajax.Request("/common/ignore_friend",{method:"post",parameters:"user_base_id="+c+TOKEN,onComplete:function(d){a.innerHTML='<span class="cf00">已忽略该好友请求！</span>'}})}function refuseFriend(b,c,a){push_feat("refuseFriend");new Ajax.Request("/common/refuse_friend",{method:"post",parameters:"user_base_id="+c+TOKEN,onComplete:function(d){a.innerHTML='<span class="cf00">已拒绝该好友请求！</span>'}})}function editGroup(a){var b="lightboxinner";new Ajax.Request("/friends/edit_group",{method:"get",parameters:"g_id="+a+"&id="+b+TOKEN,onComplete:function(c){Element.remove($("loadimg"))}})}function submitGroupName(d,a){var e=$F("group_name");var b=$("p_new_group");var c=d.previousSibling;if(!e){$T(c,"请输入分组名称！");return false}push_feat("submitGroupName");new Ajax.Request("/friends/submit_group_name",{method:"post",parameters:"g_id="+a+"&g_name="+encodeURIComponent(e)+TOKEN,onComplete:function(h){var g=h.responseText;closeLightBox();if(parseInt(g)==0){window.location.reload()}else{e=showText(e);if(parseInt(a)>0){var f=$("link_"+a);f.innerHTML=e}else{window.location.href="/friends/group/"+g}}}});return false}function removeGroup(a){if(!confirm("如果删除此分组，分组中的好友将自动移动至“未分组”。是否删除此分组？")){return false}push_feat("removeGroup");var b=$F("curr_group");b=parseInt(b);new Ajax.Request("/friends/remove_group",{method:"post",parameters:"g_id="+a+TOKEN,onComplete:function(c){a=parseInt(a);if(b==a){window.location.href="/friends/group"}else{Element.remove($("g_"+a))}}});return false}function getMemberPlane(b){var d=-1;if($("curr_group")){d=$F("curr_group")}var c=-1;if($("m_id")){c=$F("m_id")}var a="";if($("send_to_ids")){a=$F("send_to_ids")}new Ajax.Request("/common/get_member_plane",{method:"get",parameters:"curr_group="+d+"&flag="+b+"&m_id="+c+"&send_to_ids="+a+TOKEN,onComplete:function(){Element.remove($("loadimg"))}})}function moveFriends(b){var g=$("f_cancel");var d=loadBeg(b,g);var c=$CV("mem[]");var k=$("f_tip");if(!c){$T(k,"请选择！");loadEnd(d,g);return false}c=c.split(",");var a=[];var j=[];var h=c.length;var e;for(var f=0;f<h;f++){e=c[f].split("|");a[f]=e[0];j[f]=e[1]}push_feat("moveFriends");var l=$F("curr_group");new Ajax.Request("/friends/move_friends",{method:"post",parameters:"ids="+a+"&group_id="+l+TOKEN,onComplete:function(i){window.location.reload()}})}function recommendMeet(b){var h=$("f_cancel");var d=loadBeg(b,h);var c=$CV("mem[]");var l=$("f_tip");if(!c){$T(l,"请选择！");loadEnd(d,h);return false}c=c.split(",");var a=[];var k=[];var j=c.length;var f;for(var g=0;g<j;g++){f=c[g].split("|");a[g]=f[0];k[g]=f[1]}push_feat("recommendMeet");var e=$F("m_id");new Ajax.Request("/meets/recommend_meet",{method:"post",parameters:"ids="+a+"&m_id="+e+TOKEN,onComplete:function(n){loadEnd(d);var m=parseInt(n.responseText);if(m==-1){myConfirm("该活动已删除，是否转至活动列表页？","/meets/")}else{var i=$("recommend_num");i.innerHTML=parseInt(i.innerHTML)+j;closeLightBox()}}});return false}function showRobot(){var b=$("show_div");var a=b.innerHTML;a=a.replace(/COPYID/,"copy_tip");new Insertion.Bottom("lightboxinner",a);Element.remove($("loadimg"))}function getBirthPlane(a,b){new Ajax.Request("/message/get_birth_plane",{method:"get",parameters:"send_to_id="+a+"&notice_id="+b+TOKEN,onComplete:function(){Element.remove($("loadimg"))}})};