function Login(b){if(b){Toggle("login",true);var frm=document.loginFrm,u=document.getElementById("indivdrop");frm.LoginName.value=u.value;frm.password.select()}else{var f=document.loginFrm;f.SubmitLogon.value="logoff";f.submit()}}function Cancel(event){Toggle("login",false)}function SubmitLogin(event){document.loginFrm.submit()}function SubmitLogin2(event){document.loginFrm2.submit();return true}function LoadRequestedUser(){var teamID=GetCookie("CurrentTeam"),tm=document.getElementById("teamdrop"),us=document.getElementById("indivdrop");if(teamID)tm.selectedIndex=GetOptionIndex(tm.options,teamID);if(RequestedUser&&RequestedUser.length>0){us.selectedIndex=GetOptionIndex(us.options,RequestedUser);if(us.selectedIndex==0)if(us.options[us.selectedIndex].value.toLowerCase()!=RequestedUser.toLowerCase())if(tm.selectedIndex!=0){tm.selectedIndex=0;TmChange();LoadRequestedUser();return}}ChangeUser();ChangeColorText()}function ChangeUser(){var us=document.getElementById("indivdrop");RequestedUser=us.options[us.selectedIndex].value;RequestedDisplayName=us.options[us.selectedIndex].text;var today=new Date;today.setMonth(today.getMonth()+1);SetCookie("CurrentUser",RequestedUser,today,null,null,false)}function TeamChange(event){ShowUpdating();setTimeout("TmChange()",100)}function TmChange(){var tm=document.getElementById("teamdrop"),us=document.getElementById("indivdrop"),tmid=tm.value,today=new Date;today.setMonth(today.getMonth()+1);SetCookie("CurrentTeam",tmid,today,null,null,false);var xml=GetXml("./xml.ashx?type=userddl&teamid="+tmid),ops=xml.getElementsByTagName("option");if(ops.length==0){alert("You do not have access to see any user on this team. Please select another team");tm.selectedIndex=0;TmChange();return}us.options.length=0;for(var i=0;i<ops.length;i++)us.options[i]=new Option(ops[i].textContent||ops[i].text,ops[i].getAttribute("value"));us.selectedIndex=GetOptionIndex(us.options,RequestedUser);IndividualChange();CloseUpdating()}function OpenReport(tp){Popup("./report.aspx?username="+escape(RequestedUser)+"&type="+tp,true,false,true,true,true,true,900,550)}function DemoSignin(){var f=document.loginFrm2;f.LoginName.value="logarun";f.password.value="logarun";f.submit()}function ChangeColor(event){var idx=_themes.indexOf(CurrentStyle);idx=(idx+1)%_themes.length;SetTheme(_themes[idx]);ChangeColorText()}function ChangeColorText(){var a=document.getElementById("clrswatch");if(a)a.innerHTML=CurrentStyle+" >>"}function LoginClick(){var user=document.getElementById("LoginName").value,drop=document.getElementById("LoginDrop");if(drop&&drop.options[drop.selectedIndex].value!="custom")user=drop.options[drop.selectedIndex].value;else if(user.match(/^\s*$/)||document.getElementById("Password").value.match(/^\s*$/)){alert("Please enter a username and password.");return false}document.getElementById("LoginName").value=user;document.getElementById("SubmitLogon").value="true";document.getElementById("frmLogon").submit();return true}