/*
// Code required by number picker - do not remove
*/
window.onload = function(){
var elemSpan = document.createElement("span");
elemSpan.id = "spanOutput";
elemSpan.className = "spanTextDropdown";
document.body.appendChild(elemSpan);
document._store.picknum.obj =
SetProperties(document._store.picknum,
document._store.faxnum,document._store.range,'http://www.faxfx.net/fxuser/numberpickerXML.php',
true,true,true,true,"Number not available",true,"<img src='http://www.faxfx.net/images/timeIcon.gif'> Searching ...",false,null);
}
/*
// helpers code - from here downward you can remove the code - but it is not recommended 
// as it provides client side authentication and reduces the amount of requests sent
// to the server - and saves time as the response is immediate
*/
function trim(str) {
var s = new String(str);
while (s.length > 1 && s.charAt(0) == ' ') s = s.substring(1, s.length);
while (s.length > 1 && s.charAt(s.length - 1) == ' ') s = s.substring(0, s.length - 1);
if (s.length == 1 && s.charAt(0) == ' ') s = "";
return s;
} //trim()
function compare(arg){
return (this.toString()==arg.toString());
}
function check(){
var errors = new Array();
var erm = "Please fix the following errors so that you can signup:\n\n";
errors[1] = "First Name cannot be empty";
errors[2] = "Last Name cannot be empty";
errors[3] = "Cell Number cannot be empty";
errors[4] = "Cell Number must be numeric";
errors[5] = "Fax Number must be numeric";
errors[6] = "Email address cannot be empty";
errors[7] = "Email address does not match the supplied confirmation email"; errors[8] = "Your email address appears incorrect. Please re-enter.";
errors[9] = "Invalid email format. Address required.";
errors[10] = "Invalid email format. Domain required.";
errors[11] = "Invalid email format. Domain appears incorrect.";
errors[12] = "The email address contains invalid characters.";
var er = "";
var err = ''; var balert=false;
var tmpVar = trim(document._store.fname.value);
if (tmpVar.length == 0) err += '1|';
var tmpVar = trim(document._store.lname.value);
if (tmpVar.length == 0) err += '2|';
var tmpVar = trim(document._store.cellnum.value);
if (tmpVar.length == 0) err += '3|';
else if ((tmpVar-tmpVar) != 0) err += '4|';
var tmpVar = trim(document._store.faxnum.value);
if(tmpVar.length != 0 && (tmpVar-tmpVar) != 0) err += '5|';
var tmpEm = trim(document._store.email.value); if (tmpEm.length == 0) err += '6|';
var tmpCm = trim(document._store.cmail.value);
if (tmpCm.length == 0 || tmpEm.toString() != tmpCm.toString() ) err += '7|';
// er = err.split("|")
em = trim(document._store.email.value);
err += split(em,'@','.');
er = err.split("|")
if(er.length > 0){
for (i=0; i < er.length; i++){
if ( er[i] ){ balert=true; erm += errors[er[i]] + "\n" }
} }
if(balert)
{
alert(erm);
return false;
}
return true;
}
function split(sx,a,d){
var err = '';
var s = new String();
var q = new String();
if((sx.indexOf(a)==-1)){ err += '8|';}
q=sx.substring(0,sx.search(a));
if(q==''){err += '9|';}
err += cc(q);
s=sx.substring(sx.length+1,sx.search(a)+1);
err += cc(s);
if(s.indexOf(d)==-1){err += '10|';}
if(s.lastIndexOf(d)==s.length-1){err +='11|';}
return err;
} //split(sx,c,d)
function cc(sc){
var s = new String(sc);
var err = '';
for (i=0; i < sc.length; i++){
if(sc.charAt(i)==' '||sc.charAt(i)=='"'||sc.charAt(i)=='@'||sc.charAt(i)=='%') err +='12|';
}
return err;
}
