var viewedPromoInfos=new Array();function setSCVarsAndRedirect(assetName,assetType,wellPosition,url){var clickedPromoInfo=new Object();clickedPromoInfo.assetId=assetName;clickedPromoInfo.type=assetType;clickedPromoInfo.position=wellPosition;trackClickedPromos(clickedPromoInfo);window.location=url;}
function setViewedPromoInfos(assetName,assetType,wellPosition){var promoInfoIndex=viewedPromoInfos.length;viewedPromoInfos[promoInfoIndex]=new Object();viewedPromoInfos[promoInfoIndex].assetId=assetName;viewedPromoInfos[promoInfoIndex].type=assetType;viewedPromoInfos[promoInfoIndex].position=wellPosition;}
function trim(s){var whitespace=" \t\n\r";var i=0;while((i<s.length)&&(whitespace.indexOf(s.charAt(i))!=-1))i++;var j=s.length;while((j>i)&&(whitespace.indexOf(s.charAt(j-1))!=-1))j--;return s.substr(i,j-i);}
function isEmailValid(emailStr){var emailPat=/^(.+)@(.+)$/;var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";var validChars="\[^\\s"+specialChars+"\]";var quotedUser="(\"[^\"]*\")";var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;var atom=validChars+'+';var word="("+atom+"|"+quotedUser+")";var userPat=new RegExp("^"+word+"(\\."+word+")*$");var domainPat=new RegExp("^"+atom+"(\\."+atom+")*$");var matchArray=emailStr.match(emailPat);if(matchArray==null)return false;var user=matchArray[1]
var domain=matchArray[2]
if(user.match(userPat)==null)return false;var IPArray=domain.match(ipDomainPat)
if(IPArray!=null){for(var i=1;i<=4;i++){if(IPArray[i]>255)return false;}
return true;}
var domainArray=domain.match(domainPat)
if(domainArray==null)return false;var atomPat=new RegExp(atom,"g");var domArr=domain.match(atomPat);var len=domArr.length;if(domArr[domArr.length-1].length<2||domArr[domArr.length-1].length>4)return false;if(len<2)return false;return true;}
function resetForm(){document.getElementById("signup_error").style.display="none";document.getElementById("errors").style.display="none";document.getElementById("firstNameError").style.display="none";document.getElementById("lastNameError").style.display="none";document.getElementById("emailError").style.display="none";document.getElementById("passwordLengthError").style.display="none";document.getElementById("mismatchPasswordError").style.display="none";document.getElementById("termsError").style.display="none";}
function checkForm(){var hasErrors=false;if(trim(document.signupForm.firstName.value).length==0){document.getElementById("firstNameError").style.display="list-item";hasErrors=true;}
if(trim(document.signupForm.lastName.value).length==0){document.getElementById("lastNameError").style.display="list-item";hasErrors=true;}
if(!isEmailValid(document.signupForm.userName.value)){document.getElementById("emailError").style.display="list-item";hasErrors=true;}
if((trim(document.signupForm.password.value).length<4)||(trim(document.signupForm.password.value).length>10)){document.getElementById("passwordLengthError").style.display="list-item";hasErrors=true;}else if(document.signupForm.password.value!=document.signupForm.password2.value){document.getElementById("mismatchPasswordError").style.display="list-item";document.signupForm.password2.value="";hasErrors=true;}
if(!document.signupForm.terms.checked){document.getElementById("termsError").style.display="list-item";hasErrors=true;}
return!hasErrors;}
var submitting=false;function submitForm(){resetForm();if(checkForm()){if(!submitting){displayWaitIndicator();setTimeout("document.signupForm.submit()",0);submitting=true;}}else{document.getElementById("errors").style.display="block";}}
function displayWaitIndicator(){var siButton=document.getElementById("submit_button");var waitWheel=document.getElementById("waitWheel");if(siButton!=null){siButton.style.display="none";}
if(waitWheel!=null){waitWheel.style.display="block";}}