var vocReplyPrefix='Re:';var vocReplyHeader='{0} a écrit:';var idSplitLen=3;var uml10='Centre de formation';var uml20='Centre de formation';var uml30='Centre de formation';var uml40='Centre de formation';var uml50='Centre de formation';var uml60='Sur le banc';var uml70='XI de départ';var uml80='Capitaine';var uml90='Superstar';var uml100='Légende';var Builder={NODEMAP:{AREA:'map',CAPTION:'table',COL:'table',COLGROUP:'table',LEGEND:'fieldset',OPTGROUP:'select',OPTION:'select',PARAM:'object',TBODY:'table',TD:'table',TFOOT:'table',TH:'table',THEAD:'table',TR:'table'},node:function(elementName) {elementName=elementName.toUpperCase();var parentTag=this.NODEMAP[elementName]||'div';var parentElement=document.createElement(parentTag);try { // prevent IE "feature":http://dev.rubyonrails.org/ticket/2707parentElement.innerHTML="<" + elementName + "></" + elementName + ">";} catch(e) {}var element=parentElement.firstChild||null;if(element&&(element.tagName.toUpperCase()!=elementName))element=element.getElementsByTagName(elementName)[0];if(!element) element=document.createElement(elementName);if(!element) return;if(arguments[1])if(this._isStringOrNumber(arguments[1])||(arguments[1] instanceof Array)) {this._children(element,arguments[1]);} else {var attrs=this._attributes(arguments[1]);if(attrs.length) {try { // prevent IE "feature":http://dev.rubyonrails.org/ticket/2707parentElement.innerHTML="<" +elementName + " " +attrs + "></" + elementName + ">";} catch(e) {}element=parentElement.firstChild||null;if(!element) {element=document.createElement(elementName);for(attr in arguments[1])element[attr=='class' ? 'className':attr]=arguments[1][attr];}if(element.tagName.toUpperCase()!=elementName)element=parentElement.getElementsByTagName(elementName)[0];}}if(arguments[2])this._children(element,arguments[2]);return element;},_text:function(text) {return document.createTextNode(text);},ATTR_MAP:{'className':'class','htmlFor':'for'},_attributes:function(attributes) {var attrs=[];for(attribute in attributes)attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute]:attribute) +'="' + attributes[attribute].toString().escapeHTML() + '"');return attrs.join(" ");},_children:function(element,children) {if(typeof children=='object') { // array can hold nodes and textchildren.flatten().each(function(e) {if(typeof e=='object')element.appendChild(e)elseif(Builder._isStringOrNumber(e))element.appendChild(Builder._text(e));});} elseif(Builder._isStringOrNumber(children))element.appendChild(Builder._text(children));},_isStringOrNumber:function(param) {return(typeof param=='string'||typeof param=='number');},build:function(html) {var element=this.node('div');$(element).update(html.strip());return element.down();},dump:function(scope) {if(typeof scope!='object'&&typeof scope!='function') scope=window;//global scopevar tags=("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " +"BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " +"FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+"KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+"PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+"TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);tags.each(function(tag){scope[tag]=function() {return Builder.node.apply(Builder,[tag].concat($A(arguments)));}});}}Builder.dump();function getFriendListUrl(id) {return "/theclub/profiles/library/" + splitResourceId(id,3) + "/friends.jsonx";}function getActivityMeterUrl(id) {return "/theclub/profiles/library/" + splitResourceId(id,3) + "/activitymeter.jsonx";}var Messaging={friendsreqMode:false,messagebarMode:false,messageCounts:0,autoRefreshList:false,activateAutoUpdate:function() {setTimeout(Messaging.mailCountAutoUpdate,30000);},activateListUpdate:function() {Messaging.autoRefreshList=true;},initialize:function() {Event.observe($('messagingNewMessage'),'click',this.onNewMail.bind(this));Event.observe($('messagingDeleteMessage'),'click',this.onDeleteMail.bind(this));this.bindEvents();},initializeMessageBar:function() {this.messagebarMode=true;this.bindEvents();},initializeFriendsReq:function() {this.friendsreqMode=true;this.bindEvents();},bindEvents:function() {var that=this;if(this.messagebarMode) {$$('#messageBar li').each(function(el) { Event.observe(el,'click',that.onMailBarClick.bind(that));})}else if(this.friendsreqMode) {$$('#friendsReqList tbody .mailDate').each(function(el) { Event.observe(el,'click',that.onFriendReqClick.bind(that));})}else {Event.observe($('c_chkMessageMain'),'click',this.onToggleMail.bind(this));$$('#mailBox tbody .mailFrom').each(function(el) { Event.observe(el,'click',that.onMailClick.bind(that));})$$('#mailBox tbody .mailSubject').each(function(el) { Event.observe(el,'click',that.onMailClick.bind(that));})$$('#mailBox tbody .mailDate').each(function(el) { Event.observe(el,'click',that.onMailClick.bind(that));})}},onMailClick:function(e) {var t=(e.srcElement!==undefined) ? e.srcElement:e.target;if(t.tagName=='TD') t=Element.up(t);else {t=Element.up(t);t=Element.up(t);}t.removeClassName('mailUnread');t.addClassName('mailRead');var mid=t.id.gsub('mailmessage_','');new Ajax.Updater('messagePopup','/asp/theclub/messaging/message.aspx?msgid=' + mid,{ onSuccess:function() { $('messagePopup').show();Messaging.mailCountUpdate();} });},onMailBarClick:function(e) {var t=(e.srcElement!==undefined) ? e.srcElement:e.target;if(t.tagName!='LI') t=Element.up(t);var mid=t.id.gsub('mailmessage_','');new Ajax.Updater('messagePopup','/asp/theclub/messaging/message.aspx?msgid=' + mid,{ onSuccess:function() { $('messagePopup').show();Messaging.refreshList();} });},onFriendReqClick:function(e) {var t=(e.srcElement!==undefined) ? e.srcElement:e.target;if(t.tagName=='TD') t=Element.up(t);else {t=Element.up(t);t=Element.up(t);}var mid=t.id.gsub('mailmessage_','');new Ajax.Updater('messagePopup','/asp/theclub/messaging/message.aspx?msgid=' + mid,{ onSuccess:function() { $('messagePopup').show();Messaging.refreshList();} });},mailClose:function(idToShow) {$('messagePopup').hide();if(idToShow!==undefined&&idToShow!=null&&idToShow!='') $(idToShow).show();},_mailCountUpdate:function(t) {var nM=parseInt(t.responseText);if(isNaN(nM)) nM=0;if(nM>0) {$('menuInboxStatus').update("(" + t.responseText + ")");if(nM>Messaging.messageCounts&&Messaging.autoRefreshList) {Messaging.refreshList(false);$j('#messageBar').slideDown("slow");}}else {$('menuInboxStatus').update("");$j('#messageBar').slideUp("slow");}Messaging.messageCounts=nM;},mailCountUpdate:function(n) {try {if(typeof n=="undefined") {var a=new Ajax.Request('/theclub/library/tools/_messagecount.htmx',{ method:'get',onSuccess:this._mailCountUpdate.bind(this) });}else {$('menuInboxStatus').innerHTML=n;}} catch (e) { };},mailCountAutoUpdate:function() {try {Messaging.mailCountUpdate();setTimeout(Messaging.mailCountAutoUpdate,60000);} catch (e) { };},refreshList:function(updCounter) {if(updCounter===undefined||updCounter==null) updCounter=true;if(updCounter)Messaging.mailCountUpdate();if(Messaging.messagebarMode)new Ajax.Updater('messageBar','/theclub/library/tools/_notificationbar.htmx',{ onComplete:function() { Messaging.bindEvents() } });if(Messaging.friendsreqMode)new Ajax.Updater('friendsReqList','/theclub/library/tools/_friendsreq.htmx',{ onComplete:function() { Messaging.bindEvents() } });elsenew Ajax.Updater('messageList','/theclub/library/tools/_inbox.htmx',{ onComplete:function() { Messaging.bindEvents() } });},friendAcceptOld:function(id,ac,doReply) {$('messagePopup').hide();if(doReply===undefined||doReply==null) doReply=false;if(!doReply) {new Ajax.Updater('theClubMessagePopup','/asp/theclub/messaging/friendaccept.aspx?uid=' + id + '&uac=' + ac,{ onComplete:function() {$('theClubMessagePopup').show();setTimeout("$('theClubMessagePopup').hide()",1500);}});}else {new Ajax.Request('theClubMessagePopup','/asp/theclub/messaging/friendaccept.aspx?uid=' + id + '&uac=' + ac,{ onComplete:function() {Messaging.replyMail();}});}},friendAccept:function(id,ac,doReply) {if(doReply===undefined||doReply==null) doReply=false;if(!doReply) {Messaging.sendMail(true);$('messagePopup').hide();new Ajax.Updater('theClubMessagePopup','/asp/theclub/messaging/friendaccept.aspx?uid=' + id + '&uac=' + ac,{ onComplete:function() {$('theClubMessagePopup').show();setTimeout("$('theClubMessagePopup').hide()",1500);}});} else {$('messagePopup').hide();new Ajax.Request('theClubMessagePopup','/asp/theclub/messaging/friendaccept.aspx?uid=' + id + '&uac=' + ac,{ onComplete:function() {Messaging.replyMail();}});}},replyMail:function(id,ac) {if(id!==undefined&&id!=null&&ac!==undefined&&ac!=null) {new Ajax.Updater('theClubMessagePopup','/asp/theclub/messaging/replyfriendaccept.aspx?uid=' + id + '&uac=' + ac,{ onComplete:function() {$('theClubMessagePopup').show();}});return;}try {$('acceptFriend').hide();} catch (e) { }$('c_subject').readOnly=false;$('c_subject').value=vocReplyPrefix + ' ' + $F('c_subject');var strComment='\n\n' + vocReplyHeader.replace('{0}',$$('#c_from .recipientItem')[0].innerHTML.stripTags()) + '\n--------------------\n' + $('c_message').innerHTML;var textarea="<textarea rows='50' cols='100' id='c_messageTA'>" + strComment + "</textarea>";$('c_message').innerHTML=textarea;$('c_message').focus();if($('c_message').createTextRange) {var range=$('c_message').createTextRange();range.move('character',0);range.select();}else if($('c_message').selectionStart) {$('c_message').setSelectionRange(0,0);}$('messagingSendMessage').show();$('messagepopupReply').hide();$('messageDeleteMessage').hide();$('c_from').removeClassName('readonlyRecipientContainer').addClassName('activeRecipientContainer');$('d_from').hide();$('activeTo').show();$('addTo').show();$('toToRemove').remove();$j('.iconDelTo').removeClass('iconDelTo');Messaging.toggleRcptAddButton();},recipientDelete:function(target) {$('c_from').removeChild(target.up());Messaging.toggleRcptAddButton();},recipientDeleteTo:function(target) {$('c_to').removeChild(target.up());Messaging.toggleRcptAddButton();},recipientAdd:function() {new Ajax.Updater('addressBookPopup','/asp/theclub/messaging/addressbook.aspx?mode=new',{ onComplete:function() { $('addressBookPopup').show() } })},recipientAddTo:function() {new Ajax.Updater('addressBookPopup','/asp/theclub/messaging/addressbook.aspx?mode=reply',{ onComplete:function() { $('addressBookPopup').show() } })},addressAddToRecipient:function(target) {var userid=Element.readAttribute(target,'uid')var username=Element.readAttribute(target,'uname')var userac=Element.readAttribute(target,'uac')var i=IMG({ src:'/imgml/icons/trash.gif',width:12,height:12,onclick:'Messaging.recipientDelete(this)' })var s=SPAN({ 'class':'recipientItem',uid:userid,uac:userac },[(username + ' '),i]);$('c_from').insertBefore(s,$('recipientAdd'));if($j('span.recipientItem').size()>3)Messaging.toggleRcptAddButton();$('addressBookPopup').hide();},addressAddToRecipientTo:function(target) {var userid=Element.readAttribute(target,'uid')var username=Element.readAttribute(target,'uname')var userac=Element.readAttribute(target,'uac')var i=IMG({ src:'/imgml/icons/trash.gif',width:12,height:12,onclick:'Messaging.recipientDelete(this)' })var s=SPAN({ 'class':'recipientItemTo',uid:userid,uac:userac },[(username + ' '),i]);$('c_to').insertBefore(s,$('recipientAddTo'));if($j('span.recipientItemTo').size()>3)Messaging.toggleRcptAddButtonTo();$('addressBookPopup').hide();},toggleRcptAddButton:function() {try {var sl=$$('#c_from.activeRecipientContainer span');if(sl===undefined||sl==null) return;if(sl.length>1)$('recipientAdd').hide();else {$('recipientAdd').show();Messaging.recipientAdd();}} catch (e) { }},toggleRcptAddButtonTo:function() {var sl=$$('#c_from.activeRecipientContainer span');if(sl===undefined||sl==null) return;if(sl.length>1)$('recipientAddTo').hide();else {$('recipientAddTo').show();Messaging.recipientAdd();}},deleteMail:function(id) {var u='/asp/theclub/messaging/messagedelete.aspx?msgids=' + id;new Ajax.Request(u,{ onComplete:function() {$('messagePopup').hide();Messaging.refreshList();}})},onNewMail:function(fn,id,ac,type,divToHide) {if(divToHide===undefined||divToHide==null) divToHide=''var u=''if(fn!==undefined&&fn!=null&&fn!=''&&id!==undefined&&id!=null&&id!=''&&ac!==undefined&&ac!=null&&ac!='') {if(type===undefined||type==null) type=0u='/asp/theclub/messaging/message.aspx?fn=' + escape(fn) + '&uid=' + id + '&ac=' + ac + '&type=' + type + '&divID=' + divToHide;}else {if(type===undefined||type==null) type=0;u='/asp/theclub/messaging/message.aspx?type=' + type + '&divID=' + divToHide;}new Ajax.Updater('messagePopup',u,{ onSuccess:function() { $('messagePopup').show();if(divToHide!='') $(divToHide).hide();} });},onDeleteMail:function() {var ids=''var ml=$$('.checkBoxMailMessage');ml.each(function(el) {if(el.checked) {if(ids.length>0) ids += ',';ids += el.value;}});var u='/asp/theclub/messaging/messagedelete.aspx?msgids=' + ids;new Ajax.Request(u,{ onComplete:function() {Messaging.refreshList();}})},onToggleMail:function() {var v=$F('c_chkMessageMain');var c=true;if(v===undefined||v==null||v=='') c=false;$$('.checkBoxMailMessage').each(function(el) { el.checked=c });},sendMail:function(friendAcceptMail) {if(friendAcceptMail===undefined||friendAcceptMail==null) friendAcceptMail=false;var pu=$('messagePopup');if(pu===undefined||pu==null) return;if(!pu.visible()) return;var rcpListC=pu.down('#c_from');if(rcpListC===undefined||rcpListC==null) return;if(!friendAcceptMail&&!rcpListC.hasClassName('activeRecipientContainer')) return;var rcpList=$$('#messagePopup #c_from span ');var rcpListToReply=$$('#c_to>span.recipientItemTo[to="yes"]');var srcpList='';if(rcpListToReply.length>0) {rcpListToReply.each(function(e) {var userid=Element.readAttribute(e,'uid')var userac=Element.readAttribute(e,'uac')if(userid!==undefined&&userid!=null&&userid!=''&&userac!==undefined&&userac!=null&&userac!=''&&userac!='null') {if(srcpList.length>0) srcpList += ','srcpList += '{"uid":"' + userid + '","uac":"' + userac + '"}';}});}else {rcpList.each(function(e) {var userid=Element.readAttribute(e,'uid')var userac=Element.readAttribute(e,'uac')if(userid!==undefined&&userid!=null&&userid!=''&&userac!==undefined&&userac!=null&&userac!='') {if(srcpList.length>0) srcpList += ','srcpList += '{"uid":"' + userid + '","uac":"' + userac + '"}';}});}var sbj=this.escapeText($F('c_subject'));if(friendAcceptMail) {var msg=this.escapeText($('c_message').innerHTML);}else {var msg=this.escapeText($F('c_messageTA'));}var msgType=this.escapeText($F('c_messageType'));if(msgType!==undefined&&msgType!=null&&msgType==1) {msgType=',"type":"1" ';} else if(msgType!==undefined&&msgType!=null&&msgType==2) {msgType=',"type":"2" ';} else {msgType=' ';}var jsonData='{"subject":"' + sbj + '","message":"' + msg + '"' + msgType + ',"rcpt":[' + srcpList + ']}';var opt={ postBody:undefined,onComplete:undefined,parameters:"message=" + this.escapeText(jsonData) };opt.onComplete=Messaging.mailClose()new Ajax.Request('/asp/theclub/messaging/messagepost.aspx',opt);if(friendAcceptMail==false) {new Ajax.Updater('theClubMessagePopup','/asp/theclub/messaging/friendaccept.aspx?sent=True',{ onComplete:function() {$('theClubMessagePopup').show();setTimeout("$('theClubMessagePopup').hide()",1500);}});}},sendSMTPMail:function(idToShow) {var mK=Messaging.emailKind;if(mK===undefined||mK==null) mK=''var validator=new FormValidate([{ id:'c_emailto',type:'email',label:'l_from',message:"" },{ id:'c_subject',type:'any-text',label:'l_subject',message:""}]);if(validator.validate()) {var sbj=this.escapeText($F('c_subject'));var msg=this.escapeText($F('c_messageTA'));var to=this.escapeText($F('c_emailto'));var jsonData='{"subject":"' + sbj + '","message":"' + msg + '"' + ',"to":"' + to + '","mk":"' + mK + '"}';var opt={ postBody:undefined,onComplete:undefined,parameters:"message=" + this.escapeText(jsonData) };opt.onComplete=Messaging.mailClose(idToShow)new Ajax.Request('/asp/theclub/messaging/emailsend.aspx',opt);}},escapeText:function(s) {s=escape(s);return s;}};var FriendSearch={m_idToCheck:-1,m_functionType:'',ajaxCache:Object,onInputClick:function() {var c=$('c_friendNameSearch');if(c===undefined||c==null) return;if(c.hasClassName('toclean')) {c.removeClassName('toclean');c.value='';}},onFullSearchAjaxClick:function() {FriendSearch.doSearch(true);},onFullSearchClick:function() {FriendSearch.doSearch(false);},doSearch:function(ajax) {var c=$('c_friendNameSearch');var fn=$F('c_friendNameSearch');var ct=$F('c_friendCountry');var te=$F('c_friendTeam');var le=$F('c_friendLeague');var um=$F('c_friendActivity');var gwcf=$F('c_WCFantasy');var gwcp=$F('c_WCPredictor');var gwlp=$F('c_WLPredictor');var gtri=$F('c_Trivia');var qp='';if(c!==undefined&&c!=null&&c.hasClassName('toclean')==false&&fn!==undefined&&fn!=null&&fn!='') {qp='fn=' + escape(fn);}if(ct!==undefined&&ct!=null&&ct!='') {if(qp!='') qp += "&";qp += 'ct=' + ct;}if(te!==undefined&&te!=null&&te!='') {if(qp!='') qp += "&";qp += 'te=' + te;}if(le!==undefined&&le!=null&&le!='') {if(qp!='') qp += "&";qp += 'le=' + le;}if(um!==undefined&&um!=null&&um!='') {if(qp!='') qp += "&";qp += 'um=' + um;}if(gwcf!==undefined&&gwcf!=null&&gwcf=='on') {if(qp!='') qp += "&";qp += 'gwcf=1';}if(gwcp!==undefined&&gwcf!=null&&gwcp=='on') {if(qp!='') qp += "&";qp += 'gwcp=1';}if(gwlp!==undefined&&gwlp!=null&&gwlp=='on') {if(qp!='') qp += "&";qp += 'gwlp=1';}if(gtri!==undefined&&gtri!=null&&gtri=='on') {if(qp!='') qp += "&";qp += 'gtri=1';}if(qp.blank()==false) {if(ajax) {$j("div#searchButton .playnowButton").hide();$j("div#searchButton img").show();FriendSearch.ajaxCache=new Object();var u='/theclub/library/common/_searchresults.htmx?' + qp;$j.get(u,function(data) {$j("div#searchButton .playnowButton").show();$j("div#searchButton img").hide();if(data.blank()==false) {$j("#searchResultsPane").replaceWith(data);FriendSearch.ajaxCache["page_1"]=data;}});} else {var u='/theclub/myprofile/friends/search.htmx?' + qp;document.location.href=u;}}},changePage:function(params,page) {var data=FriendSearch.ajaxCache["page_" + page];if(data!=null&&data!=undefined) {$j("#searchResultsPane").replaceWith(data);} else {var u='/theclub/library/common/_searchresults.htmx?' + params + 'page=' + page;$j.get(u,function(data) {$j("#searchResultsPane").replaceWith(data);FriendSearch.ajaxCache["page_" + page]=data;});}},initForm:function() {var qs=window.location.toString();try {var qp=qs.toQueryParams();if(qp.fn!==undefined&&qp.fn!=null&&qp.fn!='') {$('c_friendNameSearch').value=unescape(qp.fn);$('c_friendNameSearch').removeClassName('toclean');}if(qp.ct!==undefined&&qp.ct!=null&&qp.ct!='') {var ct=$('c_friendCountry');for (var i=0;i<ct.options.length;i++) {if(ct.options[i].value.toLowerCase()==qp.ct.toLowerCase()) {ct.options[i].selected=true;break;}}}if(qp.te!==undefined&&qp.te!=null&&qp.te!='') {var te=$('c_friendTeam');for (var i=0;i<te.options.length;i++) {if(te.options[i].value.toLowerCase()==qp.te.toLowerCase()) {te.options[i].selected=true;break;}}}if(qp.le!==undefined&&qp.le!=null&&qp.le!='') {var le=$('c_friendLeague');for (var i=0;i<le.options.length;i++) {if(le.options[i].value.toLowerCase()==qp.le.toLowerCase()) {le.options[i].selected=true;break;}}}if(qp.um!==undefined&&qp.um!=null&&qp.um!='') {var um=$('c_friendActivity');for (var i=0;i<um.options.length;i++) {if(um.options[i].value.toLowerCase()==qp.um.toLowerCase()) {um.options[i].selected=true;break;}}}if(qp.gwcf!==undefined&&qp.gwcf=='1') {var gwcf=$('c_WCFantasy');gwcf.checked=true;}if(qp.gwcp!==undefined&&qp.gwcp=='1') {var gwcp=$('c_WCPredictor');gwcp.checked=true;}if(qp.gwlp!==undefined&&qp.gwlp=='1') {var gwlp=$('c_WLPredictor');gwlp.checked=true;}if(qp.gtri!==undefined&&qp.gtri=='1') {var gtri=$('c_Trivia');gtri.checked=true;}} catch (e) { }},initProfileMenu:function(id) {if(getUOpt('id')!='') {this.m_idToCheck=id;var pl=getUOpt("pl");if(pl=="1") return;var myId=getUOpt("id");var u=getFriendListUrl(myId);$('returnToMyClubPage').show();$j.getJSON(u,function(friends) {for (var i=0;i<friends.length;i++) {if(friends[i].i==id) {$('menuSendMail').show();$('menuRemoveAsFriend').show();return;}}$('menuAddAsFriend').show();});}},removeFriend:function(fn,id,ac) {if(fn===undefined||fn==null||fn==''||id===undefined||id==null||id==''||ac===undefined||ac==null||ac=='')return;var u='/theclub/library/common/friendremove.html?fn=' + escape(fn);u += '&uid=' + id;u += '&ac=' + ac;document.location.href=u;},removeFriendSubmit:function() {try {var qp=window.location.toString().toQueryParams();if(qp.fn!==undefined&&qp.fn!=null&&qp.fn!=''&&qp.uid!==undefined&&qp.uid!=null&&qp.uid!=''&&qp.ac!==undefined&&qp.ac!=null&&qp.ac!='') {var u='/theclub/library/common/_friendremovesubmit.htmx?fn=' + qp.fn;u += '&uid=' + qp.uid;u += '&ac=' + qp.ac;new Ajax.Request(u,{ method:"get",onSuccess:function() {$('friendRemoveQuestion').hide()$('friendRemoveSuccess').show()}})}} catch (e) { }},reportRemoveFriend:function() {var qp=window.location.toString().toQueryParams();if(qp.fn!==undefined&&qp.fn!=null&&qp.fn!=''&&qp.uid!==undefined&&qp.uid!=null&&qp.uid!=''&&qp.ac!==undefined&&qp.ac!=null&&qp.ac!='') {var u='/theclub/library/common/friendremovereport.html?fn=' + qp.fn;u += '&uid=' + qp.uid;u += '&ac=' + qp.ac;document.location.href=u;}},removeFriendFillInfos:function() {try {var qp=window.location.toString().toQueryParams();if(qp.fn!==undefined&&qp.fn!=null&&qp.fn!='') {$('friendRemoveName').update(unescape(qp.fn));}} catch (e) { }},removeFriendReportSubmit:function() {try {var qp=window.location.toString().toQueryParams();if(qp.fn!==undefined&&qp.fn!=null&&qp.fn!=''&&qp.uid!==undefined&&qp.uid!=null&&qp.uid!=''&&qp.ac!==undefined&&qp.ac!=null&&qp.ac!='') {var u='/theclub/library/common/_friendremovereportsubmit.htmx';u += '?uid=' + qp.uid;u += '&report=' + escape($F('c_friendRemoveReportText'));new Ajax.Request(u,{ method:"get",onSuccess:function() {$('friendRemoveReportFormQuestion').hide()$('friendRemoveReportSuccess').show()}})}} catch (e) { }},ChallengeInit:function(myId,ac) {FriendSearch.Challenge(myId,ac,'challengeWCFantasy');FriendSearch.Challenge(myId,ac,'challengeWLpredictor');FriendSearch.Challenge(myId,ac,'challengeWCpredictor');FriendSearch.Challenge(myId,ac,'challengeTrivia');},Challenge:function(myId,ac,strFunction) {m_functionType=strFunction;if(myId!='') {if(ac!==undefined&&ac!=null&&ac!='') {var u="/asp/theclub/games/challenge.aspx?strac=" + ac + "&functionType=" + m_functionType;new Ajax.Request(u,{ method:'get',asynchronous:false,onComplete:FriendSearch.displayChallengeButton });}} return;},displayChallengeButton:function(originalResponse) {if((originalResponse.responseText)=="YES") {$(m_functionType).show();$j('#' + m_functionType + ' a.ChallengeButton').show();$j('#' + m_functionType + ' a.InviteButton').hide();}else {$(m_functionType).show();$j('#' + m_functionType + ' a.InviteButton').show();$j('#' + m_functionType + ' a.ChallengeButton').hide();}}}var UserServices={activateService:function(form,container,service) {if($('c_' + service + 'TOS').checked) {var opt='';for (i=0;i<form.elements.length;i++) {if(form.elements[i].checked) {opt += '&' + form.elements[i].name + '=1';}}var ajax=new Ajax.Updater({ success:container },'/theclub/myprofile/games/_activate.htmx',{ method:'get',parameters:'activate=true&service=' + service + opt });} else {$('l_' + service + 'TOS').setStyle({ color:'red' });$(service + 'Error').setStyle({ display:'block' });}},showGameResults:function(service,datafile) {new Ajax.Request(datafile,{method:'get',onSuccess:function(originalRequest) {try {var j=eval('(' + originalRequest.responseText + ')')$(service + 'Points').update(j.points);$(service + 'Rank').update(j.rank);var performance=Number(j.last_rank) - Number(j.rank);if(performance>0) {$(service + 'Performance').setStyle({ color:'green' });$(service + 'Performance').update('<img src="/imgml/theclub/move_up.png" alt=""/>+' + performance);} else if(performance<0) {$(service + 'Performance').setStyle({ color:'red' });$(service + 'Performance').update('<img src="/imgml/theclub/move_down.png" alt=""/>' + performance);}$('myGame_' + service + 'Score').show();} catch (e) { }}});new Ajax.Request('/theclub/library/tools/_gamesdeadlines.html',{method:'get',onSuccess:function(originalRequest) {var j=eval('(' + originalRequest.responseText + ')');var d=j[service];if(d) {$(service + 'Deadline').update(d);$('myGame_' + service + 'Deadline').show();}}});},initMenuHeader:function(userFolder,selfProfile) {var c=Cookie.get('FIFAComClub');if(selfProfile!='true'&&this.getUserFolder(c.toQueryParams().id)==userFolder) {document.location='/theclub/myprofile/index.htmx';}new Ajax.Request('/theclub/profiles/library/' + userFolder + 'activitymeter.jsonx',{method:'get',onSuccess:function(originalRequest) {var j=eval('(' + originalRequest.responseText + ')');$('hActivitymeterValue').update(j.tot);$('hActivitymeterLabel').update(eval('uml' + j.tot));if(j.tot==0) {$('hActivitymeterBar').setStyle({ width:'1px' });$('hActivitymeterBar').setStyle({ background:'none' });} else$('hActivitymeterBar').setStyle({ width:j.tot + '%' });$('hActivitymeterContainer').show();if(j.tot==100) {$('cockade').update('<img src="/imgml/icons/theclub/cockade.png" alt=""/>');}}});},getUserFolder:function(userid) {return splitResourceId(userid,3) + "/";},updateActivityMeterTable:function() {var c=Cookie.get('FIFAComClub');var userFolder=this.getUserFolder(c.toQueryParams().id);new Ajax.Request('/theclub/profiles/library/' + userFolder + 'activitymeter.jsonx',{method:'get',onSuccess:function(originalRequest) {var j=eval('(' + originalRequest.responseText + ')');$('activityMeterTable_av').update(j.av);$('activityMeterTable_nl').update(j.nl);$('activityMeterTable_pr').update(j.pr);$('activityMeterTable_cm').update(j.cm);$('activityMeterTable_fs').update(j.fs);$('activityMeterTable_wlp').update(j.wlp);$('activityMeterTable_wcp').update(j.wcp);$('activityMeterTable_wcf').update(j.wcf);$('activityMeterTable_tr').update(j.tr);$('activityMeterTable_tot').update(j.tot);}});}}var CommentsCounter={zeroComment:"",oneComment:"",moreComments:"",count:function(ids,zeroComment,oneComment,moreComments) {CommentsCounter.zeroComment=zeroComment;CommentsCounter.oneComment=oneComment;CommentsCounter.moreComments=moreComments;var c=Cookie.get('FIFAComClub');var screenName=c.toQueryParams().un;var uids=new Object();for (var i=0;i<ids.length;i++) {if(uids[ids[i].toString()]==undefined) {uids[ids[i].toString()]="";CommentsCounter.getData(ids[i],screenName);}}},getData:function(id,screenName) {$j.get("/newscentre/allcomment/" + splitResourceId(id,idSplitLen) + "/index.html",null,function(data) {var index=0;var comments=$j("div.nickname",$j(data));index=comments.index(comments.filter("[title='" + screenName + "']:first"));var output;var className;if(index<=0) {output=CommentsCounter.zeroComment;className="noNewComments";} else if(index==1) {output=CommentsCounter.oneComment;className="newComments";} else {output=CommentsCounter.moreComments.replace("{0}",index.toString());className="newComments";}$j('.newsid_' + id + ' .commentCount').each(function() {$j(this).html(output);$j(this).addClass(className);$j(this).show();});});}};function userAwards(idCurUser) {var xmlPaths={WCFF:"/xml/games/worldcupfantasyfootball/leaderboard.xml",WCP:"/xml/games/worldcuppredictor/leaderboard.xml",WLP:"/xml/games/worldleaguespredictor/leaderboard.xml"};for (key in xmlPaths) {var gameAbbr=[key];$j.ajax({type:"GET",url:xmlPaths[key],dataType:"xml",async:false,success:function(xml) {$j(xml).find('user').each(function() {var id=$j(this).attr('id');var pos=$j(this).attr('pos');var rndpos=$j(this).attr('rndpos');var xmlPath=$j('xmlPaths');if(id==idCurUser&&(pos=='1'||rndpos=='1')) {if(!$j(this).parent().is('overall')) {$j('<img src="/imgml/icons/theclub/' + gameAbbr + '.gif" alt="' + gameAbbr + ' WINNER" title="' + gameAbbr + ' WINNER" class="awardIcon" />').appendTo('#awardsList');}}});}});}}function avatarLink() {var sizeAvatar=($j("#avatarImage").width());if(sizeAvatar=='1') {$j('#avatarLink').attr("href","/theclub/myprofile/profile/avatar/index.htmx");}else {$j('#avatarLink').attr("href","/theclub/myprofile/index.htmx");}}var myId=getUOpt("id");var FriendsList={friends:undefined,pageSize:undefined,currentPage:0,totalPages:0,viewedPages:undefined,template:"",umTemplate:"",toolsTemplate:"",init:function(userId,pageSize,teaser) {var u=getFriendListUrl(userId);$j.getJSON(u,function(data) {FriendsList.friends=data;FriendsList.pageSize=pageSize;if(data==null||data==""||data.length==0) {$j(".friendsList").hide();$j("#nofriends").show();} else {FriendsList.template=$j(".friendsList").html();var um=$j(".friendsList li .friendUserometer")if(um.length>0)FriendsList.umTemplate=um.html();var tools=$j(".friendsList .friendsListTools");if(tools.length>0)FriendsList.toolsTemplate=tools.html();$j(".friendsList").html("");if(teaser) {$j(".friendSummary #friendsCount").text(data.length);$j(".friendSummary").show();$j(".myFriendSearchHP").show();for (var j=0;j<data.length&&j<pageSize;j++) {var r=Math.floor(Math.random() * data.length);var sw=data[j];data[j]=data[r];data[r]=sw;}}if(teaser==false) {if(data.length>pageSize) {$j(".friendListNavigation").show();$j(".friendListNavigationTotal #friendsCount").text(data.length);}}FriendsList.totalPages=Math.ceil(data.length / pageSize);FriendsList.viewedPages=new Array(FriendsList.totalPages);FriendsList.gotoPage(0);}})},prevPage:function() {if(FriendsList.currentPage>0)FriendsList.gotoPage(FriendsList.currentPage - 1);},nextPage:function() {if(FriendsList.currentPage<FriendsList.totalPages - 1)FriendsList.gotoPage(FriendsList.currentPage + 1);},gotoPage:function(page) {$j(".friendsList li").hide();for (var i=page * FriendsList.pageSize;i<(page + 1) * FriendsList.pageSize&&i<FriendsList.friends.length;i++)$j(".friendsList li:eq(" + i + ")").show();if(page>0)$j(".friendListNavigationPrev").show();else$j(".friendListNavigationPrev").hide();if(page<FriendsList.totalPages - 1)$j(".friendListNavigationNext").show();else$j(".friendListNavigationNext").hide();FriendsList.currentPage=page;if(FriendsList.viewedPages[page]!=true) {FriendsList.viewedPages[page]=true;for (var i=page * FriendsList.pageSize;i<(page + 1) * FriendsList.pageSize&&i<FriendsList.friends.length;i++) {var buf=FriendsList.template;if(i % 2==1)buf=buf.replace("@@class","lastInRow");elsebuf=buf.replace("@@class","");buf=buf.replace(/@@profile/g,FriendsList.friends[i].l);buf=buf.replace(/@@avatar/g,FriendsList.friends[i].av);buf=buf.replace(/@@screenname/g,FriendsList.friends[i].nk);buf=buf.replace(/@@flag/g,FriendsList.friends[i].ct);$j(".friendsList").append(buf);if(FriendsList.umTemplate!=""||FriendsList.toolsTemplate!="") {var um=getActivityMeterUrl(FriendsList.friends[i].i);$j.getJSON(um,function(id) {return function(data) {if(FriendsList.umTemplate!="") {var userometer=$j(".friendsList li:eq(" + id + ") .friendUserometer");userometer.html(FriendsList.umTemplate.replace("{0}",data.tot));userometer.show();}if(FriendsList.toolsTemplate!="") {var tools=$j(".friendsList li:eq(" + id + ") .friendsListTools");var buf=FriendsList.toolsTemplate.replace(/@@screenname/,data.sn);buf=buf.replace(/@@id/,FriendsList.friends[id].i);buf=buf.replace(/@@ac/,data.ac);tools.html(buf)tools.show();}};} (i));}$j(".friendsList li:eq(" + i + ")").show();}}}}var Register={m_frmValidate:undefined,initQuickRegister:function(){this.m_frmValidate=new FormValidate([{id:'c_registerFirstName',type:'any-text',label:'l_registerFirstName',message:""},{id:'c_registerLastName',type:'any-text',label:'l_registerLastName',message:""},{id:'c_registerEmail',type:'email',label:'l_registerEmail',message:""}]);},initRegister:function(frmValidate){this.m_frmValidate=frmValidate;var ar=new Ajax.Request("/theclub/library/tools/captcha.htmx?t="+Math.random(),{method:'get',onComplete:this.captchaCB.bind(this)});try{var qp=window.location.toString().toQueryParams();if(qp.fn!==undefined&&qp.fn!=null&&qp.fn!=''&&qp.ln!==undefined&&qp.ln!=null&&qp.ln!=''&&qp.em!==undefined&&qp.em!=null&&qp.em!=''){$('c_firstName').value=qp.fn;$('c_lastName').value=qp.ln;$('cf_email').value=qp.em;}}catch(e){}if($('c_country').selectedIndex==0){new Ajax.Request('/library/tools/clientcountrydetect.htmx?outputType=geoid',{method:'get',onSuccess:function(r){var c=$('c_country');for(i=0;i<c.length;i++){if(c.options[i].value==r.responseText){c.selectedIndex=i;break;}}}});}},captchaCB:function(t){ $('c_regCodeEncoded').value=t.responseText;this.captchaRefresh();},captchaRefresh:function(){ $('c_regCodeImage').src="/theclub/library/tools/captcha.htmx?t="+Math.random()+"&c="+$F('c_regCodeEncoded');$('c_regCodeImage').show();},verifyScreenName:function(){var sc=$F('c_screenName')if(sc===undefined||sc==null||sc.length<6||sc.length>=12){$('c_screenName').addClassName('validateError');$('l_screenName').addClassName('validateError');return;}var addInfo ='';if($F('c_country')!='')addInfo +="&ct="+$F('c_country')if($F('c_yyyyBirth')!='')addInfo +="&yy="+$F('c_yyyyBirth')new Ajax.Updater('screennameCheck','/theclub/library/tools/screennamecheck.htmx?sc='+escape(sc)+addInfo,{method:'get'});},validateQuickRegister:function() {var FWCmode=escape($F('FWCmode'));if(FWCmode=='true')document.location.href='/worldcup/organisation/ticketing/applyfor/registration/index.html?fn=' + escape($F('c_registerFirstName')) + '&ln=' + escape($F('c_registerLastName')) + '&em=' + escape($F('c_registerEmail'))elsedocument.location.href='/theclub/registration/index.html?fn=' + escape($F('c_registerFirstName')) + '&ln=' + escape($F('c_registerLastName')) + '&em=' + escape($F('c_registerEmail'))},validateRegister:function(){if($F('c_agree')==null){$('d_errList').update("<ul><li>" + $F('c_agreeErrorText') + "</li></ul>");$('d_errPanel').show();$('d_errPanel').focus();window.scrollTo(0,0);return false;}if(this.m_frmValidate.validate()){$('d_errPanel').hide();$('grayoverlay').style.display='block';$('lightbox').style.display='block';return true;}$('d_errList').update(this.m_frmValidate.getValidationErrorList()+' ');$('d_errPanel').show();$('d_errPanel').focus();window.scrollTo(0,0);return false;},onEmailValidateCB:function(t){if(t.responseText=='true'){$('err_emailInUse').show();$('d_errorPanel').show();$('c_email').value=$F('c_registerEmail');$('c_password').focus();window.scrollTo(0,0);}else{document.location.href='/theclub/registration/index.html?fn='+escape($F('c_registerFirstName'))+'&ln='+escape($F('c_registerLastName'))+'&em='+escape($F('c_registerEmail'));}},checkPassword:function(){if($('c_password1').value.length>=6&&$('c_password1').value.length<=12&&!$('c_password1').value.match(/[^a-zA-Z0-9\_\-\'\.]/)&&($('c_password2').value==''||$('c_password2').value==$('c_password1').value)){$('passwordCheckcont').className='ok';}else{$('passwordCheckcont').className='ko';}},useSuggestedScreenName:function(suggestion){$('c_screenName').value=suggestion;},activationEmailResend:function(){var u="/theclub/registration/resendactivationemail.htmx?uid="+getUOpt("id")+"&ac="+getUOpt("ac")new Ajax.Request(u,{method:'get',onSuccess:function(){$('activationEmailSent').show();$('activationEmailText').hide();$('activationEmailButtons').hide();$('buttonProfile').show();}});},proceedWithoutActivation:function(){try{var qp=window.location.toString().toQueryParams();var u="/theclub/myprofile/index.htmx";if(qp.url!==undefined&&qp.url!=null&&qp.ulr!='')u=unescape(qp.url)document.location.href=u;}catch(e){}}}var LoginFormHandler=Class.create();LoginFormHandler.prototype ={formValidator:undefined,initialize:function(){Event.observe($('btn_login'),'click',this.validate.bind(this));this.formValidator=new FormValidate([{id:'c_email',type:'email',label:'l_email',message:""},{id:'c_password',type:'any-text',label:'l_password',message:""}]);},validate:function(evt){if(!this.formValidator.validate()){Event.stop(evt);}}}var ProfileEditFormHandler=Class.create();ProfileEditFormHandler.prototype ={formValidator:undefined,initialize:function(firstNameErrMsg,lastNameErrMsg,countryErrMsg,genderErrMsg){this.formValidator=new FormValidate([{id:'c_firstName',type:'any-text',label:'l_firstName',message:firstNameErrMsg},{id:'c_lastName',type:'any-text',label:'l_lastName',message:lastNameErrMsg},{id:'c_country',type:'option',label:'l_country',message:countryErrMsg},{id:'c_gender',type:'option',label:'l_gender',message:genderErrMsg}]);Event.observe($('btn_Save'),'click',this.validate.bind(this));},validate:function(evt){if(!this.formValidator.validate()){$('d_errPanel').update(this.formValidator.getValidationErrorList()+' ');$('d_errPanel').show();$('d_errPanel').focus();window.scrollTo(0,0);Event.stop(evt);}}}
