var mode;var login_email_box;var pwd_box;var register_email_box;var known_email;function do_forms(B,D){var A=new GridHelper(B,0,0,25,100);A.makeAndAddBigTextDiv("Please enter your login info.",0,0,1,4);A.makeAndAddBigTextDiv("Email:",1,0,1,2);login_email_box=A.makeAndAddWideTextBox(known_email,"",1,1,2,15);A.makeAndAddTextDiv("Password:",2,0);pwd_box=document.createElement("input");pwd_box.type="password";pwd_box.style.width=login_email_box.style.width;A.addBigCell(pwd_box,2,1,1,2);A.makeAndAddAButton("Login",do_login,3,0);var C=new GridHelper(B,0,A.getBottom()+25,25,100);C.makeAndAddBigTextDiv("OR Enter your email if you are a new user or have forgotten your password.",0,0,2,4);C.makeAndAddTextDiv("Email:",2,0);register_email_box=C.makeAndAddWideTextBox("","",2,1,2,15);C.makeAndAddAButton("Submit",do_register,3,0);C.makeAndAddBigTextDiv(D,5,0,2,4)}function layout(E,D){known_email=D;var A=/(MSIE (7|8))|(Firefox)/;if(!A.test(navigator.userAgent)){document.body.innerHTML="Summa Cash Flow Modeler does not support your browser version.<br>If you are using Internet Explorer, please upgrade to version 7";return }var C=new Header(document.body,25,25,[]);var B=document.createElement("div");document.body.appendChild(B);B.style.position="absolute";B.style.left=C.getLeft()+"px";B.style.top=C.getBottom()+25+"px";if(E=="not_submitted"){do_forms(B,"")}else{if(E=="submitted"){B.appendChild(document.createTextNode("Thank you.  We have sent you an email with a link you can use to proceed."))}else{if(E=="already_registered"){B.appendChild(document.createTextNode("Your email has already been registered.  The password has been reset, and a link to change the password has been sent to your email address."))}else{if(E=="successful_login"){location.replace("valuation_main.php?mode=choosing_project")}else{if(E=="failed_login"){do_forms(B,"That email/password pair is not recognized.")}else{alert("problem getting mode")}}}}}}function do_login(){var A=sha1Hash(pwd_box.value);location.replace("login.php?email="+login_email_box.value+"&pwd="+A+"&login=1")}function do_register(){location.replace("login.php?email="+register_email_box.value+"&submitted=1")};