var error_bg = "#FFE052";
var normal_bg = "#FFFFFF";
var states = new Array(62);
states["none"] = "-- Please Select State --";
states["AL"] = "Alabama";
states["AK"] = "Alaska";
states["AZ"] = "Arizona";
states["AR"] = "Arkansas";
states["CA"] = "California";
states["CO"] = "Colorado";
states["CT"] = "Connecticut";
states["DE"] = "Delaware";
states["DC"] = "District of Columbia";
states["FL"] = "Florida";
states["GA"] = "Georgia";
states["HI"] = "Hawaii";
states["ID"] = "Idaho";
states["IL"] = "Illinois";
states["IN"] = "Indiana";
states["IA"] = "Iowa";
states["KS"] = "Kansas";
states["KY"] = "Kentucky";
states["LA"] = "Louisiana";
states["ME"] = "Maine";
states["MD"] = "Maryland";
states["MA"] = "Massachusetts";
states["MI"] = "Michigan";
states["MN"] = "Minnesota";
states["MS"] = "Mississippi";
states["MO"] = "Missouri";
states["MT"] = "Montana";
states["NE"] = "Nebraska";
states["NV"] = "Nevada";
states["NH"] = "New Hampshire";
states["NJ"] = "New Jersey";
states["NM"] = "New Mexico";
states["NY"] = "New York";
states["NC"] = "North Carolina";
states["ND"] = "North Dakota";
states["OH"] = "Ohio";
states["OK"] = "Oklahoma";
states["OR"] = "Oregon";
states["PA"] = "Pennsylvania";
states["RI"] = "Rhode Island";
states["SC"] = "South Carolina";
states["SD"] = "South Dakota";
states["TN"] = "Tennessee";
states["TX"] = "Texas";
states["UT"] = "Utah";
states["VT"] = "Vermont";
states["VA"] = "Virginia";
states["WA"] = "Washington";
states["WV"] = "West Virginia";
states["WI"] = "Wisconsin";
states["WY"] = "Wyoming";
states["PR"] = "Puerto Rico";
states["VI"] = "U.S. Virgin Islands";
states["MP"] = "Northern Mariana Is.";
states["GU"] = "Guam";
states["AS"] = "American Samoa";
states["PW"] = "Palau";
states["AA"] = "Armed Forces Americas";
states["AE"] = "Armed Forces Europe";
states["AP"] = "Armed Forces Pacific";
states["US"] = "United States Federal";
var provinces = new Array(13);
provinces["none" ] = "-- Please Select Province --";
provinces["AB"] = "Alberta";
provinces["BC"] = "British Columbia";
provinces["MB"] = "Manitoba";
provinces["NB"] = "New Brunswick";
provinces["NL"] = "Newfoundland/Labrador";
provinces["NS"] = "Nova Scotia";
provinces["NT"] = "Northwest Territories";
provinces["NU"] = "Nunavut";
provinces["ON"] = "Ontario";
provinces["PE"] = "Prince Edward Island";
provinces["QC"] = "Quebec";
provinces["SK"] = "Saskatchewan";
provinces["YT"] = "Yukon";
var selected_state = "";
function validateRegistration(f){
var proceed = true;
var reg_test = new RegExp(/^([a-zA-Z0-9_.\-+])+@(([a-zA-Z0-9\-])+.)+[a-zA-Z0-9]{2,4}$/);
var error_messagea = '';
//check required vars
if(f.CharacterCode.value == ''){
error_messagea += "Please enter a Furry Falls Secret Access Code. You can find the Furry Falls Secret Access Code on the foot of your plush toy.
";
f.CharacterCode.style.background = error_bg;
proceed = false;
} else {
f.CharacterCode.style.background = normal_bg;
}
if(f.uPassword.value == '' || f.uPassword.value.length < 6 || f.uPassword.value.length > 12){
error_messagea += "Please enter a password between 6 and 12 characters.
";
f.uPassword.style.background = error_bg;
proceed = false;
} else {
f.uPassword.style.background = normal_bg;
}
if(f.Password1.value == '') {
error_messagea += "Please confirm your password.
";
f.Password1.style.background = error_bg;
proceed = false;
} else {
f.Password1.style.background = normal_bg;
}
if (proceed) {
if(f.uPassword.value != f.Password1.value && f.Password1.value != ''){
error_messagea += "The two passwords do not match. Please retype.
";
f.Password1.style.background = error_bg;
f.Password1.value = '';
proceed = false;
} else {
f.Password1.style.background = normal_bg;
}
}
if(f.Email.value == '' ){
error_messagea += "Please enter your email address.
";
f.Email.style.background = error_bg;
proceed = false;
} else {
f.Email.style.background = normal_bg;
}
var email_check = '';
email_check = reg_test.test(f.Email.value);
if (email_check == false) {
error_messagea += "Please enter a valid email address (email@furryfalls.com).
";
f.Email.style.background = error_bg;
f.Email1.style.background = error_bg;
proceed = false;
} else {
f.Email.style.background = normal_bg;
if (f.Email1.value != '') {
f.Email1.style.background = normal_bg;
}
}
if(f.Email1.value == '' ){
error_messagea += "Please confirm your email address.
";
f.Email1.style.background = error_bg;
proceed = false;
} else {
f.Email1.style.background = normal_bg;
}
if (proceed) {
if(f.Email.value != f.Email1.value && f.Email1.value != ''){
error_messagea += "The two emails entered do not match. Please retype.
";
f.Email1.style.background = error_bg;
f.Email1.value = '';
proceed = false;
} else {
f.Email1.style.background = normal_bg;
}
}
//display error for account info section
if (error_messagea != '') {
document.getElementById('accountMessage').innerHTML = error_messagea;
$(document).ready(function () {$("#accountMessage").toggle() });
if (typeof document.body.style.maxHeight === "undefined")
{//if IE 6
document.body.setAttribute('style', 'height:100%;');
}
} else {
document.getElementById('accountMessage').style.display = 'none';
}
//if signup on behalf of child
var error_messagec = '';
if(f.SignupBehalf.checked){
if(!isValid(f.KidsName, "text")){
error_messagec += "Please enter the name of your child.
";
f.KidsName.style.background = error_bg;
proceed = false;
} else {
f.KidsName.style.background = normal_bg;
}
if (!isValid(f.Kyear_of_birth, "select"))
{
error_messagec += "Please tell us what year your child was born in.
";
f.Kyear_of_birth.style.background = error_bg;
proceed = false;
} else {
f.Kyear_of_birth.style.background = normal_bg;
}
if (!isValid(f.Kmonth_of_birth, "select"))
{
error_messagec += "Please tell us what month your child was born in.
";
f.Kmonth_of_birth.style.background = error_bg;
proceed = false;
} else {
f.Kmonth_of_birth.style.background = normal_bg;
}
if (!isValid(f.Kday_of_birth, "select"))
{
error_messagec += "Please tell us what day of the month your child was born on.
";
f.Kday_of_birth.style.background = error_bg;
proceed = false;
} else {
f.Kday_of_birth.style.background = normal_bg;
}
if(!isValid(f.KidsGender, "radio")){
error_messagec += "Please select the gender of your child
";
// f.KidsGender.focus();
proceed = false;
}
//display error for child info section
if (error_messagec != '') {
document.getElementById('childMessage').innerHTML = error_messagec;
$(document).ready(function () {$("childMessage").toggle() });
if (typeof document.body.style.maxHeight === "undefined")
{//if IE 6
document.body.setAttribute('style', 'height:100%;');
}
} else {
document.getElementById('childMessage').style.display = 'none';
}
}
var error_messagep = '';
if(!isValid(f.FirstName, "text")){
error_messagep += "Please enter your First Name.
";
f.FirstName.style.background = error_bg;
proceed = false;
} else {
f.FirstName.style.background = normal_bg;
}
if(!isValid(f.LastName, "text")){
error_messagep += "Please enter your Last Name.
";
f.LastName.style.background = error_bg;
proceed = false;
} else {
f.LastName.style.background = normal_bg;
}
if(!isValid(f.CountryCode, "select")){
error_messagep += "Please choose your country.
";
f.CountryCode.style.background = error_bg;
proceed = false;
} else {
f.CountryCode.style.background = normal_bg;
}
if(!f.SignupBehalf.checked){
if (!isValid(f.year_of_birth, "select"))
{
error_messagep += "Please tell us what year you were born in.
";
f.year_of_birth.style.background = error_bg;
proceed = false;
} else {
f.year_of_birth.style.background = normal_bg;
}
if (!isValid(f.month_of_birth, "select"))
{
error_messagep += "Please tell us what month you were born in.
";
f.month_of_birth.style.background = error_bg;
proceed = false;
} else {
f.month_of_birth.style.background = normal_bg;
}
if (!isValid(f.day_of_birth, "select"))
{
error_messagep += "Please tell us what day of the month you were born on.
";
f.day_of_birth.style.background = error_bg;
proceed = false;
} else {
f.day_of_birth.style.background = normal_bg;
}
if(!isValid(f.Gender, "radio")){
error_messagep += "Please select the your gender.
";
// f.KidsGender.focus();
proceed = false;
}
}
if(!isValid(f.Terms, 'checkbox')){
error_messagep += "You must agree to our terms and conditions before you can register.
";
f.Terms.focus();
proceed = false;
}
if (error_messagep != '') {
document.getElementById('personalMessage').innerHTML = error_messagep;
$(document).ready(function () {$("#personalMessage").toggle() });
if (typeof document.body.style.maxHeight === "undefined")
{//if IE 6
document.body.setAttribute('style', 'height:100%;');
}
} else {
document.getElementById('personalMessage').style.display = 'none';
}
if (!proceed) {
scroll(0,0);
}
f.KidsBirthDate.value = f.Kyear_of_birth.value + "-" + f.Kmonth_of_birth.value + "-" + f.Kday_of_birth.value;
f.DateOfBirth.value = f.year_of_birth.value + "-" + f.month_of_birth.value + "-" + f.day_of_birth.value;
return proceed;
}
function validatePACTFields(f)
{
// validate nickname
if (f.nickname.value.length == 0)
{
alert("Please enter a nickname.");
f.nickname.focus();
return false;
}
if ((f.nickname.value.length < 2) || (f.nickname.value.length > 12))
{
alert("The nickname must be between 2 and 12 letters and/or numbers.");
f.nickname.focus();
return false;
}
// validate email
if (f.email.value.length == 0)
{
alert("Please enter your email address.");
f.email.focus();
return false;
}
if (f.email.value != f.email1.value)
{
alert("The two emails do not match. Please retype.");
f.email.focus();
return false;
}
var i = 1;
var s = f.email.value;
var l = s.length;
while ((i < l) && (s.charAt(i) != "@"))
{
i++;
}
if ((i >= l) || (s.charAt(i) != "@"))
{
alert("The email address is invalid. Please enter your full email address (eg. name@server.com)");
f.email.focus();
return false;
}
else
{
i += 2;
}
while ((i < l) && (s.charAt(i) != "."))
{
i++;
}
if ((i >= l - 1) || (s.charAt(i) != "."))
{
alert("The email address is invalid. Please enter your full email address (eg. name@server.com)");
f.email.focus();
return false;
}
// validate password
if (f.password1.value.length == 0)
{
alert("Please enter a password.\n-it must be 8-12 numbers AND letters longn-it must contain BOTH numbers and letters.");
f.password1.focus();
return false;
}
var numberOfDigits = 0;
var numberOfLetters = 0;
var numberOfGarbageChars = 0;
s = f.password1.value;
for (i = 0; i < s.length; i++)
{
var c = s.charAt(i);
if ( ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) )
{
numberOfLetters++;
}
else if ((c >= "0") && (c <= "9"))
{
numberOfDigits++;
}
else
{
numberOfGarbageChars++;
}
}
if (numberOfGarbageChars > 0)
{
alert("The password may only contain letters (a-z A-Z) and numericals (0-9).");
f.password1.focus();
return false;
}
if (((f.password1.value.length < 8) || (f.password1.value.length > 12)) && ((numberOfDigits == 0) || (numberOfLetters == 0)))
{
alert("The password must be between 8 and 12 numbers and letters.");
f.password1.focus();
return false;
}
else if ((numberOfDigits == 0) || (numberOfLetters == 0))
{
alert("The password must contain both letters AND numbers.");
f.password1.focus();
return false;
}
else if ((f.password1.value.length < 8) || (f.password1.value.length > 12))
{
alert("The password must be between 8 and 12 characters.");
f.password1.focus();
return false;
}
if (f.password2.value.length == 0)
{
alert("Please retype your password in the second password box.");
f.password2.focus();
return false;
}
if (f.password1.value != f.password2.value)
{
alert("The two passwords do not match. Please retype.");
f.password1.focus();
return false;
}
return true; //confirmSignupWindow(f);
}
function validateTerms(f){
if (!isValid(f.terms, "checkbox"))
{
alert("Please acknowledge that you agree to the terms and conditions! You have to do this before you can activate your account.");
f.terms.focus();
return false;
}
if (!isValid(f.ru21, "checkbox"))
{
alert("If you are over 21, please tick the ?I am over 21? checkbox. We can?t let you play unless you are over 21 and you check it off.");
f.ru21.focus();
return false;
}
return true;
}
function isValid(obj, objType)
{
if (objType == "text")
{
if (obj.value.length == 0)
return false;
else
return true;
}
else if (objType == "select")
{
if (obj.options[0].selected)
return false;
else
return true;
}
else if (objType == "checkbox")
{
if (obj.checked)
return true;
else
return false;
}
else if(objType == "radio"){
if(!obj){
return false;
}
var radioLength = obj.length;
if(radioLength == undefined)
if(obj.checked)
return true;
else
return false;
for(var i = 0; i < radioLength; i++) {
if(obj[i].checked) {
return true;
}
}
return false;
}
return true;
}
function updateStates(){
if(document.registration_form.CountryCode.value == "US"){
document.forms['registration_form'].StateCode.options.length = 0;
var j = 0;
var set_state = j;
for (var i in states){
if(i == selected_state && selected_state){
document.forms['registration_form'].StateCode.options[j] = new Option(states[i], i, true);
}
else{
document.forms['registration_form'].StateCode.options[j] = new Option(states[i], i);
}
j++;
}
//document.forms['registration_form'].StateCode.selectedIndex = j;
document.getElementById("show_province").style.display = "none";
document.getElementById("show_state").style.display = "";
document.getElementById("state_province").innerHTML = "State";
document.getElementById("zip_postal").innerHTML = "Zip Code";
document.forms['registration_form'].StateCode.focus();
}
else if(document.registration_form.CountryCode.value == "CA"){
//alert("CountryCode is CA");
document.forms['registration_form'].StateCode.options.length = 0;
var j = 0;
var set_state = j;
for (var i in provinces){
if(i == selected_state && selected_state){
document.forms['registration_form'].StateCode.options[j] = new Option(provinces[i], i, true);
}
else{
document.forms['registration_form'].StateCode.options[j] = new Option(provinces[i], i);
}
j++;
}
//document.forms['registration_form'].StateCode.selectedIndex = j;
document.getElementById("state_province").innerHTML = "Province";
document.getElementById("zip_postal").innerHTML = "Postal Code";
document.getElementById("show_province").style.display = "none";
document.getElementById("show_state").style.display = "";
document.forms['registration_form'].StateCode.focus();
}
else{
document.getElementById("state_province").innerHTML = "State/Province";
document.getElementById("zip_postal").innerHTML = "Zip/Postal Code";
document.getElementById("show_state").style.display = "none";
document.getElementById("show_province").style.display = "";
document.forms['registration_form'].Province.focus();
}
return true;
}
function setState(){
selected_state = document.forms['registration_form'].StateCode.value;
}
function validateEditInfoForm(f) {
if (f.CountryCode[f.CountryCode.selectedIndex].value == "none")
{
alert("Please enter your CountryCode!");
f.CountryCode.focus();
return false;
}
if(f.CountryCode.value == "US"){
if (f.state[f.state.selectedIndex].value == "none")
{
alert("Please enter your State!");
f.state.focus();
return false;
}
}
else if(f.CountryCode.value == "CA"){
if (f.state[f.state.selectedIndex].value == "none")
{
alert("Please enter your Province!");
f.state.focus();
return false;
}
}
else if(!isValid(f.province, "text")){
alert("Please set your State/Province!");
f.province.focus();
return false;
}
if (!isValid(f.city, "text"))
{
alert("Please enter a city.");
f.city.focus();
return false;
}
if (!isValid(f.address1, "text"))
{
alert("Please enter your address.");
f.address1.focus();
return false;
}
if (!isValid(f.zip, "text"))
{
alert("Please enter your zip code or your postal code.");
f.zip.focus();
return false;
}
// if (f.timeZone.options[f.timeZone.selectedIndex].value == 'none')
// {
// alert("Please select a time zone.");
// f.timeZone.focus();
// return false;
// }
if (!isValid(f.phone, "text"))
{
alert("Please enter your phone number.");
f.phone.focus();
return false;
}
if (!isValid(f.year_of_birth, "select"))
{
alert("Please tell us what year you were born in.");
f.year_of_birth.focus();
return false;
}
if (!isValid(f.month_of_birth, "select"))
{
alert("Please tell us what month you were born in.");
f.month_of_birth.focus();
return false;
}
if (!isValid(f.day_of_birth, "select"))
{
alert("Please tell us what day of the month you were born on.");
f.day_of_birth.focus();
return false;
}
}
function behalfToggle(){
if(document.getElementById('SignupBehalf').checked){
document.getElementById('child_info').style.display = '';
document.getElementById('guardian_bday').innerHTML = 'Birth Date';
document.getElementById('guardian_gender').innerHTML = 'Gender';
if (typeof document.body.style.maxHeight === "undefined")
{//if IE 6
document.body.setAttribute('style', 'height:100%;');
}
}
else{
document.getElementById('child_info').style.display = 'none';
document.getElementById('guardian_bday').innerHTML = '*Birth Date';
document.getElementById('guardian_gender').innerHTML = '*Gender';
}
}