var memberLabel="";var LoginLabel="";var ErrorMessageLabel="";var loggedSection;var notLoggedSection;var btnJoin;var MemberInfo="";function IsAuthenticated(){return connectorGetCookie("cds_clubmember_id")!=""}function IsAuthenticated_OnLoad(){if(IsAuthenticated()){btnJoin.style.visibility="hidden";btnJoin.style.display="none";document.getElementById("ConnectorErrorMessage").style.display="none";document.getElementById("ConnectorErrorMessage").style.visibility="hidden";notLoggedSection.style.visibility="hidden";notLoggedSection.style.display="none";loggedSection.style.visibility="visible";loggedSection.style.display="block";document.getElementById("userLoginLabel").firstChild.nodeValue=memberLabel}else{loggedSection.style.visibility="hidden";loggedSection.style.display="none"}}function GetUserName(){if(MemberInfo==""){var a=new SOAPClientParameters();var b=SOAPClient.invoke(cirqueClubSoapServicesUrl,"IsAuthenticated",a,false);if(b.IsAuthenticated){MemberInfo=b.FirstName+" "+b.LastName}}return MemberInfo}function ClubPopup_OnClick(){if(IsAuthenticated()){document.getElementById("userName").firstChild.nodeValue=GetUserName()}}function MemberLogout_CallBack(){jQuery(".cirqueClubPopUpBtn").fadeOut("fast");jQuery(".cirqueClubPopUp").fadeOut("fast");loggedSection.style.visibility="hidden";loggedSection.style.display="none";notLoggedSection.style.visibility="visible";notLoggedSection.style.display="block";document.getElementById("userLoginLabel").firstChild.nodeValue=LoginLabel;window.location.reload()}function SetMemberDisplay(a){btnJoin.style.visibility="hidden";btnJoin.style.display="none";document.getElementById("ConnectorErrorMessage").style.display="none";document.getElementById("ConnectorErrorMessage").style.visibility="hidden";notLoggedSection.style.visibility="hidden";notLoggedSection.style.display="none";loggedSection.style.visibility="visible";loggedSection.style.display="block";document.getElementById("userName").firstChild.nodeValue=a.FirstName+" "+a.LastName;document.getElementById("userLoginLabel").firstChild.nodeValue=memberLabel}function SetLoginErrorDisplay(){var a=document.getElementById("ConnectorErrorMessage");btnJoin.style.visibility="visible";btnJoin.style.display="block";notLoggedSection.style.visibility="visible";notLoggedSection.style.display="block";loggedSection.style.visibility="hidden";loggedSection.style.display="none";a.firstChild.nodeValue=ErrorMessageLabel;a.style.display="block";a.style.visibility="visible"}function Logout(){var a=new SOAPClientParameters();SOAPClient.invoke(cirqueClubSoapServicesUrl,"Logout",a,true,MemberLogout_CallBack);btnJoin.style.visibility="visible";btnJoin.style.display="block"}function Login(){var a=new SOAPClientParameters();document.getElementById("ConnectorEmail").value;a.add("email",document.getElementById("ConnectorEmail").value);a.add("encryptedPwd",MD5(document.getElementById("ConnectorPassword").value));var b=SOAPClient.invoke(cirqueClubSoapServicesUrl,"Login",a,false);if(b!=null){if(!b.IsAuthenticated&&b.RedirectUrl!=""&&b.RedirectUrl!=null){document.location.href=b.RedirectUrl}else{if(b.IsAuthenticated){SetMemberDisplay(b);window.location.reload()}else{SetLoginErrorDisplay()}}}else{SetLoginErrorDisplay()}}function connectorGetCookie(a){if(document.cookie.length>0){c_start=document.cookie.indexOf(a+"=");if(c_start!=-1){c_start=c_start+a.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1){c_end=document.cookie.length}return unescape(document.cookie.substring(c_start,c_end))}}return""};
