/*
Copyright All rights reserved to David Cho
You can't use or modify this file without David Cho's permision.
Find more information at quadrant76@hotmail.com
*/
document.oncontextmenu=function a(){ return false; }
document.ondragstart=function a(){ return false; }
document.onselectstart=function a(){ return false; }
function setup() {
window.location.replace('setuponlineaccount.php');
}
function function29() {
setTimeout("window.location.replace('logout.php')",300000);
}
function function20() {
window.location.replace('logout.php');
}
function function5() {
	document.write(function4);
	setTimeout("window.location.replace('index.php')",12000);
}
function userinuse2() {
	document.write(function4);
	setTimeout("window.location.replace('setuponlineaccount.php')",12000);
}
function function6() {
document.write(function11);
}
function function7() {
document.write(function4);
}
function function8() {
window.location.replace('index.php');
}
function function9() {
window.location.replace('failed.php');
}
function success() {
window.location.replace('contactustosetupmail.php');
}
function failed() {
window.location.replace('contactustosetup.php');
}
function function12() {
window.location.replace('statement.php');
}
function activationfailed() {
window.location.replace('activationproblem.php');
}
function usernameinuse() {
window.location.replace('usernameisinuse.php');
}
function validateFormOnSubmit(theForm) {
var reason = "";
  reason += validatepassword(theForm.password);
  reason += validateuser_id(theForm.user_id);   
  if (reason != "") {
    alert("Some fields need correction:\n" + reason);
    return false;
  }
  return true;
}
function validateuser_id(fld) {
    var error = "";
    if ((fld.value.length < 5) || (fld.value.length >10)) {
        fld.style.background = '#CCFF99';
		fld.focus();
        error = "Please check your UserID.\n"
    } else {
        fld.style.background = 'White';
    }
    return error;  
}
function validatepassword(fld) {
    var error = "";
    var illegalChars = /[\W_]/;
    if ((fld.value.length < 5) || (fld.value.length >10)) {
        fld.style.background = '#CCFF99';
		fld.focus();
        error = "Please check your Password.\n";
    } else {
        fld.style.background = 'White';
    }
    return error;
}
function validateFormOnSubmit2(theForm) {
var reason = "";
  reason += validatepassword(theForm.password);
  reason += validateuser_id(theForm.user_id);
  reason += validatecountry(theForm.country);
  reason += validatepostal_code(theForm.postal_code);
  reason += validateprovince(theForm.province);
  reason += validatecity(theForm.city);
  reason += validateaddress(theForm.address);
  reason += validateaccount_number(theForm.account_number);
  reason += validateshareholder_lastname(theForm.shareholder_lastname);
  reason += validatekey(theForm.key);         
  if (reason != "") {
    alert("Some fields need correction:\n" + reason);
    return false;
  }
  return true;
}
function validatekey(fld) {
    var error = "";
    var illegalChars = /[\W_]/;
    if ((fld.value.length < 5) || (fld.value.length >10)) {
        fld.style.background = '#CCFF99';
		fld.focus();
        error = "Please check your Activation code.\n";
    } else {
        fld.style.background = 'White';
    }
    return error;
}
function validateshareholder_lastname(fld) {
    var error = "";
    var illegalChars = /[\W_]/;
    if (fld.value == "") {
        fld.style.background = '#CCFF99';
		fld.focus();
        error = "Please enter shareholder's lastname.\n";
    } else if ((fld.value.length < 2) || (fld.value.length > 30)) {
        error = "Please check your shareholder's lastname.\n";
        fld.style.background = '#CCFF99';
		fld.focus();
    } else {
        fld.style.background = 'White';
    }
   return error;
} 
function validateaccount_number(fld) {
    var error = "";
    var illegalChars = /[\W_]/;
    if (fld.value == "") {
        fld.style.background = '#CCFF99';
		fld.focus();
        error = "Please enter your account number.\n";
    } else if ((fld.value.length < 5) || (fld.value.length > 12)) {
        error = "Please check your account_number.\n";
        fld.style.background = '#CCFF99';
		fld.focus();
    } else {
        fld.style.background = 'White';
    }
   return error;
}
function validateaddress(fld) {
    var error = "";    
    if (fld.value == "") {
        fld.style.background = '#CCFF99';
		fld.focus();
        error = "You didn't enter your address.\n";
    } else if (fld.value.length < 4) {
        error = "Please check your address. Your address is too short.\n";
        fld.style.background = '#CCFF99';
		fld.focus();
    }  else if (!((fld.value.search(/(a-z)+/)) && (fld.value.search(/(0-9)+/)))) {
        error = "Please check your address. Make sure your house number are included.\n";
        fld.style.background = '#CCFF99';
		fld.focus();
    } else {
        fld.style.background = 'White';
    }
   return error;
} 
function validatecity(fld) {
    var error = "";
    var illegalChars = /[\W_]/;
    if (fld.value == "") {
        fld.style.background = '#CCFF99';
		fld.focus();
        error = "Please enter your city.\n";
    } else if ((fld.value.length < 2) || (fld.value.length > 30)) {
        error = "Please check your city.\n";
        fld.style.background = '#CCFF99';
		fld.focus();
    } else {
        fld.style.background = 'White';
    }
   return error;
} 
function validateprovince(fld) {
    var error = "";
    if ((fld.value.length < 2) || (fld.value.length >25)) {
        fld.style.background = '#CCFF99';
		fld.focus();
        error = "Please check your province/state.\n"
    } else {
        fld.style.background = 'White';
    }
    return error;  
}
function validatepostal_code(fld) {
    var error = "";
    if ((fld.value.length < 3) || (fld.value.length >10)) {
        fld.style.background = '#CCFF99';
		fld.focus();
        error = "Please check your postal/zip code.\n"
    } else {
        fld.style.background = 'White';
    }
    return error;  
}
function validatecountry(fld) {
    var error = "";
    if ((fld.value.length < 3) || (fld.value.length >25)) {
        fld.style.background = '#CCFF99';
		fld.focus();
        error = "Please check your country.\n"
    } else {
        fld.style.background = 'White';
    }
    return error;  
}
function validateuser_id(fld) {
    var error = "";
    if ((fld.value.length < 5) || (fld.value.length >10)) {
        fld.style.background = '#CCFF99';
		fld.focus();
        error = "Please check your UserID.\n"
    } else {
        fld.style.background = 'White';
    }
    return error;  
}
function validatepassword(fld) {
    var error = "";
    var illegalChars = /[\W_]/;
    if ((fld.value.length < 5) || (fld.value.length >10)) {
        fld.style.background = '#CCFF99';
		fld.focus();
        error = "Please check your Password.\n";
    } else {
        fld.style.background = 'White';
    }
    return error;
}
function11="<tr><td><div style='width:100%; text-align:center'><a href='' target='_self' style='text-decoration:none; color:#888888; font-size:8pt; font-family:Arial, Helvetica, sans-serif'>Copyright 2008 PSFC. All rights reserved.</a><br /><a href='http://www.chojunhyun.com' target='_blank' style='text-decoration:none; color:#AAAAAA; font-size:8pt; font-family:Arial, Helvetica, sans-serif'>Designed by David Cho</a> <a href='http://www.w3.org/' target='_blank' style='text-decoration:none; color:#AAAAAA; font-size:8pt; font-family:Arial, Helvetica, sans-serif'> Verified as XHTML 1.0 Transitional by W3C</a></div></td></tr>";
function4="<style type='text/css'> *{margin:0 0 0 0; padding:0 0 0 0;} html {height:100%;}body {height:100%;} #wrap {width:100%; height:100%; text-align:center;} #content2 {width:800px;} .button2 {float:left; margin: 10px 0 0 200px; clear:both;} #content {width:500px; height:350px; text-align:center; margin: -50px 0 0 0; *margin:0 0 0 0} .button2 {float:left; margin: 10px 0 0 200px; clear:both;} .button{float:left; margin: 10px 0 0 210px; clear:both; padding:0 10px 0 10px;} select{float:left; margin-bottom:10px; width:200px; border:#cccccc solid 1px; font-family:Tahoma; font-size:10pt;} fieldset {width:500px; border-left:0px; border-right:0px; padding:10px 0 10px 0;} label {width:150px; float:left; text-align:right; margin: 0 10px 10px 50px; clear:both; font-family:Tahoma; font-size:10pt; color:#000000;} .input-box {float:left; margin-bottom:10px; width:200px; border:#cccccc solid 1px; font-family:Tahoma; font-size:10pt;} .contact2 {float:left; width:300px; margin:10px 0 10px 110px; text-align:left; font-family:Arial, Helvetica, sans-serif; font-size:9pt} .red{color:#FF0000;} #error2 {font-family:Arial, Helvetica, sans-serif; font-size:14pt; text-decoration:underline; text-align:center; padding-bottom:10px; color:#FF0000;} #error{font-family:Arial, Helvetica, sans-serif; font-size:12pt;} #error3{font-family:Arial, Helvetica, sans-serif; font-size:14pt; text-decoration:underline; text-align:center; padding-bottom:10px; color:#0066CC; margin:0 0 0 -10px;}</style>";
