var vocReplyPrefix='Re:';var vocReplyHeader='{0} wrote:';var idSplitLen=3;var uml10='In Training';var uml20='In Training';var uml30='In Training';var uml40='In Training';var uml50='In Training';var uml60='On the Bench';var uml70='Starting XI';var uml80='Captain';var uml90='Superstar';var uml100='Legend';var cookieDomain='.fifa.com';var baseUrl='http://www.fifa.com';var siteLang='en';var idSplitLen=3;var numWordsComment=100;var commentsPerPage=10;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,friendshipAcceptedMessage:"",activateAutoUpdate:function() {setTimeout(Messaging.mailCountAutoUpdate,30000);},activateListUpdate:function() {Messaging.autoRefreshList=true;},initialize:function(friendshipAcceptedMessage) {Messaging.friendshipAcceptedMessage=friendshipAcceptedMessage;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();},reminderClose:function() {$('messagePopupRemainder').hide();},_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.replace(/\n/g,"").replace(/<br>/gi,"\n");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) {$j(target).parent().remove();Messaging.toggleRcptAddButton();},recipientDeleteTo:function(target) {$j(target).parent().remove();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,friendRequestMail) {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="";if(Messaging.friendshipAcceptedMessage.length>0)msg=Messaging.friendshipAcceptedMessage.replace("{username}",Cookie.get('FIFAComClub').toQueryParams().un) + "\n\n--------------------\n";msg += $('c_message').innerHTML;msg=this.escapeText(msg);}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);}});}if(friendRequestMail) {wAnalytics.theClub.onFriendRequest();} else {wAnalytics.theClub.onMessageSend();}},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=$j('#c_friendNameSearch');var fn=$j('#c_friendNameSearch').val();var ct=$j('#c_friendCountry').val();var te=$j('#c_friendTeam').val();var le=$j('#c_friendLeague').val();var um=$j('#c_friendActivity').val();var gwcf=$j('#c_WCFantasy').is(':checked');var gwcp=$j('#c_WCPredictor').is(':checked');var gwlp=$j('#c_WLPredictor').is(':checked');var gtri=$j('#c_Trivia').is(':checked');var qp='';if(c!==undefined&&c!=null&&c.hasClass('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) {if(qp!='') qp += "&";qp += 'gwcf=1';}if(gwcp) {if(qp!='') qp += "&";qp += 'gwcp=1';}if(gwlp) {if(qp!='') qp += "&";qp += 'gwlp=1';}if(gtri) {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) {},Challenge:function(myId,ac,strFunction) {m_functionType=strFunction;if(myId!=''&&myId!=Cookie.get('FIFAComClub').toQueryParams().id) {var u="/asp/theclub/games/challenge.aspx?strid=" + myId + "&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 CommentsCounter={zeroComment:"",oneComment:"",moreComments:"",count:function(ids,zeroComment,oneComment,moreComments) {},getData:function(id,screenName) {}};function userAwards(idCurUser) {var xmlPaths={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:"",init:function(userId,pageSize,teaser,template,self) {var u=getFriendListUrl(userId);if(self) {var now=new Date()u=u + "?" + now.getTime();}$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=template;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);var userometer=$j(".friendsList li:eq(" + i + ") .friendUserometer");var tools=$j(".friendsList li:eq(" + i + ") .friendsListTools");if(userometer.size()>0||tools.size()>0) {var um=getActivityMeterUrl(FriendsList.friends[i].i);$j.getJSON(um,function(userometer,tools,userid) {return function(data) {if(userometer.size()>0) {userometer.html(userometer.html().replace("{0}",data.tot));userometer.show();}if(tools.size()>0) {var buf=tools.html();buf=buf.replace("@@screenname",data.sn);buf=buf.replace("@@id",userid);buf=buf.replace("@@ac",data.ac);tools.html(buf)tools.show();}};} (userometer,tools,FriendsList.friends[i].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:""}]);if(!($j("#c_referrer")&&$j("#c_referrer").val())) {$j("#c_referrer").val(document.referrer);}},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')) {if($('c_country').selectedIndex==0) {new Ajax.Request('/esicontent/library/clientcountrydetect.html',{ method:'get',onSuccess:function(r) {try {var j=eval('(' + r.responseText + ')');var c=$('c_country');for (i=0;i<c.length;i++) {if(c.options[i].value==j.id) {c.selectedIndex=i;break;}}} catch (e) { }}});}}},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')) + '&rf=' + escape($F('c_referrer'))elsedocument.location.href='/theclub/registration/index.html?fn=' + escape($F('c_registerFirstName')) + '&ln=' + escape($F('c_registerLastName')) + '&em=' + escape($F('c_registerEmail')) + '&rf=' + escape($F('c_referrer'))},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);}}}function simple_tooltip(target_item,tooltip_name,xoffs,yoffs) {if(xoffs==undefined) xoffs=0;if(yoffs==undefined) yoffs=0;var my_tooltip=$j(tooltip_name);$j(target_item).mouseenter(function() {var pos=$j(target_item).position();my_tooltip.css({ left:pos.left + Number(xoffs),top:pos.top + Number(yoffs) });my_tooltip.css({ opacity:0.9,display:"none" }).fadeIn(400);}).mouseleave(function() {my_tooltip.fadeOut(400);});}var slideTour=function(direction) {var currentPosition=0;var slideWidth=650;var slides=$j('.slide');var numberOfSlides=slides.length;direction=direction||"left";$j('#slidesContainer').css('overflow','hidden');slides.wrapAll('<div id="slideInner"></div>').css({'float':direction,'width':slideWidth});$j('#slideInner').css('width',slideWidth * numberOfSlides);$j('#slideshow').prepend('<span class="control" id="leftControl">Clicking moves left</span>').append('<span class="control" id="rightControl">Clicking moves right</span>');manageControls(currentPosition);$j('.control').bind('click',function() {currentPosition=($j(this).attr('id')=='rightControl') ? currentPosition + 1:currentPosition - 1;manageControls(currentPosition);if(direction=="right") {$j('#slideInner').animate({"marginRight":slideWidth * (-currentPosition)});}else {$j('#slideInner').animate({"marginLeft":slideWidth * (-currentPosition)});}});function manageControls(position) {if(position==0) { $j('#leftControl').hide() } else { $j('#leftControl').show() }if(position==numberOfSlides - 1) { $j('#rightControl').hide() } else { $j('#rightControl').show() }}$j("#slideInner .slide").each(function(i) {$j(this).addClass("page" + (i));});}
