/*======================================================================*\
|| #################################################################### ||
|| # vBulletin 3.7.1
|| # ---------------------------------------------------------------- # ||
|| # Copyright ©2000-2008 Jelsoft Enterprises Ltd. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| #################################################################### ||
\*======================================================================*/
var vB_UserList_Highlighters=new Object();vBulletin.events.systemInit.subscribe(function(){var B,A=null;if(vBulletin.elements.vB_UserList_Highlighter){for(B=0;B<vBulletin.elements.vB_UserList_Highlighter.length;B++){A=vBulletin.elements.vB_UserList_Highlighter[B][0];vB_UserList_Highlighters[A]=new vB_UserList_Highlighter(A)}vBulletin.elements.vB_UserList_Highlighter=null}if(vBulletin.elements.vB_UserList_Saver){for(B=0;B<vBulletin.elements.vB_UserList_Saver.length;B++){new vB_UserList_Saver(vBulletin.elements.vB_UserList_Saver[B][0])}vBulletin.elements.vB_UserList_Saver=null}});function vB_UserList_Saver(A){this.ajax_request=null;this.prefix=A;this.change_form=YAHOO.util.Dom.get(this.prefix+"_change_form");YAHOO.util.Event.on(this.change_form,"submit",this.handle_form_submit,this,true);this.add_form=YAHOO.util.Dom.get(this.prefix+"_add_form");YAHOO.util.Event.on(this.add_form,"submit",this.handle_form_submit,this,true)}vB_UserList_Saver.prototype.handle_form_submit=function(G){YAHOO.util.Event.stopEvent(G);var F=YAHOO.util.Event.getTarget(G);if(F.tagName!="FORM"){F=F.form}var B=null;var C=null;var H=YAHOO.util.Dom.get("incomingaction_reject");if(F.userlist.value=="buddy"){B="buddylist";C=false}else{if(F.userlist.value=="incoming"&&H.checked==true){B="incomingreqs";C=true}}if(B&&F.id.match(/_change_form$/)){for(var E=0;E<vB_UserList_Highlighters[B].items.length;E++){if(B=="buddylist"){if(vB_UserList_Highlighters[B].items[E].origfriend==true&&vB_UserList_Highlighters[B].items[E].friendcheck.checked==false){if(!confirm(vbphrase.remove_from_userlist_confirm)){return false}break}}if(vB_UserList_Highlighters[B].items[E].usercheck.checked==C){if(!confirm(vbphrase.remove_from_userlist_confirm)){return false}break}}}var A=F.id.replace(/_form$/,"_progress");YAHOO.util.Dom.setStyle(A,"display","");var D=new vB_Hidden_Form(F.action);if(YAHOO.util.Connect._submitElementValue&&YAHOO.util.Connect._submitElementValue.match(/^makefriends=/)){D.add_variable("makefriends",1)}D.add_variable("ajax",1);D.add_variables_from_object(F);this.ajax_request=YAHOO.util.Connect.asyncRequest("POST",F.action,{success:this.handle_ajax_response,failure:this.handle_ajax_failure,timeout:vB_Default_Timeout,scope:this,argument:[A,F.id]},SESSIONURL+"securitytoken="+SECURITYTOKEN+"&"+D.build_query_string())};vB_UserList_Saver.prototype.handle_ajax_failure=function(A){vBulletin_AJAX_Error_Handler(A);YAHOO.util.Event.removeListener(this.change_form,"submit",this.handle_form_submit);YAHOO.util.Event.removeListener(this.add_form,"submit",this.handle_form_submit);YAHOO.util.Dom.get(A.argument[1]).submit()};vB_UserList_Saver.prototype.handle_ajax_response=function(E){if(E.responseXML){var F,D,B,A,C=null;YAHOO.util.Dom.setStyle(E.argument[0],"display","none");F=E.responseXML.getElementsByTagName("error");if(F.length){YAHOO.util.Dom.get(this.prefix+"_error_message").innerHTML=F[0].firstChild.nodeValue;YAHOO.util.Dom.setStyle(this.prefix+"_error","display","block");return }else{YAHOO.util.Dom.setStyle(this.prefix+"_error","display","none")}if(this.add_form&&this.add_form.username){this.add_form.username.value=""}buddycountobj=YAHOO.util.Dom.get("buddycount");if(buddycountobj){buddycountobj.innerHTML=E.responseXML.getElementsByTagName("buddycount")[0].firstChild.nodeValue}D=E.responseXML.getElementsByTagName("userlist");if(D.length){for(B=0;B<D.length;B++){A=D[B].getAttribute("type");if(vB_UserList_Highlighters[A]){vB_UserList_Highlighters[A].deactivate()}C=YAHOO.util.Dom.get(A);if(C&&D[B].firstChild){YAHOO.util.Dom.setStyle(A+"_container","display","block");YAHOO.util.Dom.setStyle(A+"_change_form","display","block");C.innerHTML=D[B].firstChild.nodeValue}else{if(C&&D[B]){YAHOO.util.Dom.setStyle(A+"_container","display","none");YAHOO.util.Dom.setStyle(A+"_change_form","display","none");C.innerHTML=""}}vB_UserList_Highlighters[A]=new vB_UserList_Highlighter(A)}}}};function vB_UserList_Highlighter(E){var D,B,F,A,C;this.parentid=E;this.parent=YAHOO.util.Dom.get(E);this.items=new Array();F=this.parent.getElementsByTagName("label");if(F.length){for(D=0;D<F.length;D++){if(YAHOO.util.Dom.hasClass(F[D],"avatar_label")){A=F[D].getElementsByTagName("img");if(A.length){for(B=0;B<A.length;B++){if(A[B].id&&A[B].id.substr(0,8+this.parentid.length)==(this.parentid+"_avatar_")){C=new vB_UserList_UserObject(A[B].id.substr(8+this.parentid.length),this.parentid);this.items.push(C)}}}}}}this.check_all_checkbox=YAHOO.util.Dom.get(this.parentid+"_checkall");YAHOO.util.Event.on(this.check_all_checkbox,"click",this.check_all,this,true);this.show_avatars_checkbox=YAHOO.util.Dom.get(this.parentid+"_showavatars");YAHOO.util.Event.on(this.show_avatars_checkbox,"click",this.show_avatars,this,true);this.show_avatars()}vB_UserList_Highlighter.prototype.deactivate=function(){for(var A=0;A<this.items.length;A++){this.items[A].deactivate()}};vB_UserList_Highlighter.prototype.check_all=function(){var B,A;if(this.items.length){for(B=0;B<this.items.length;B++){this.items[B].usercheck.checked=this.check_all_checkbox.checked;this.items[B].shade_avatar()}}else{var A=this.parent.getElementsByTagName("input");for(B=0;B<A.length;B++){if(A[B].type=="checkbox"){A[B].checked=this.check_all_checkbox.checked}}}};vB_UserList_Highlighter.prototype.show_avatars=function(){if(this.items.length&&this.show_avatars_checkbox){if(this.show_avatars_checkbox.checked){YAHOO.util.Dom.replaceClass(this.parent,"userlist_hideavatars","userlist_showavatars");console.info("checked")}else{YAHOO.util.Dom.replaceClass(this.parent,"userlist_showavatars","userlist_hideavatars");console.info("not checked")}}};function vB_UserList_UserObject(A,B){this.avatar=YAHOO.util.Dom.get(B+"_avatar_"+A);YAHOO.util.Event.on(this.avatar,"click",this.avatar_click,this,true);this.usercheck=YAHOO.util.Dom.get(B+"_usercheck_"+A);if(this.usercheck.tagName=="INPUT"&&this.usercheck.getAttribute("type")=="checkbox"){YAHOO.util.Event.on(this.usercheck,"click",this.usercheck_click,this,true);this.shade_avatar()}this.friendcheck=YAHOO.util.Dom.get(B+"_friendcheck_"+A);if(this.friendcheck){YAHOO.util.Event.on(this.friendcheck,"click",this.set_friend,this,true);this.friend=this.friendcheck.checked;this.origfriend=this.friendcheck.checked}}vB_UserList_UserObject.prototype.shade_avatar=function(){YAHOO.util.Dom.setStyle(this.avatar,"opacity",(this.usercheck.checked?1:0.25));if(this.friendcheck){this.friendcheck.checked=(this.usercheck.checked?this.friend:false)}};vB_UserList_UserObject.prototype.avatar_click=function(A){YAHOO.util.Event.stopEvent(A);if(this.usercheck.tagName=="SELECT"){this.usercheck.focus()}else{this.usercheck.checked=!this.usercheck.checked;this.shade_avatar()}};vB_UserList_UserObject.prototype.usercheck_click=function(A){this.shade_avatar()};vB_UserList_UserObject.prototype.set_friend=function(A){this.friend=this.friendcheck.checked;if(this.friend){this.usercheck.checked=true;this.shade_avatar()}};vB_UserList_UserObject.prototype.deactivate=function(){YAHOO.util.Event.removeListener(this.avatar,"click",this.avatar_click);YAHOO.util.Event.removeListener(this.usercheck,"click",this.usercheck_click);YAHOO.util.Event.removeListener(this.friendcheck,"click",this.set_friend)};