// JavaScript Document
function isNumber (val) { 
	val = val.replace(/ /g,"");
	if (val.length > 0) { return !isNaN((val)*(-1)*(-1));} else {return false;}
} 
function isDecimal (val) { 
    regDec = /\./;
	if (isNumber(val)) {return regDec.test(val)} else {return false}
}
function isInteger (val) {
    if (isNumber(val)) {return !isDecimal(val)} else {return false}
}
function isUserName (val) {
  	val = val.replace(/ /g,"");
  	if (val.length < 4) {return false} else {return true} 
}
function isPassword (val) {
  	val = val.replace(/ /g,"");
  	if (val.length < 4) {return false} else {return true} 
}
function isName (val) {
	val = val.replace(/ /g,"");
 	if (val.length < 2) {return false} else {return true} 
}
function isFirstName (val) {
	val = val.replace(/ /g,"");
 	if (val.length < 2) {return false} else {return true} 
}
function isLastName (val) {
	val = val.replace(/ /g,"");
 	if (val.length < 2) {return false} else {return true} 
}
function isAddress (val) {
	val = val.replace(/ /g,"");
 	if (val.length < 2) {return false} else {return true} 
}
function isCity (val) {
	val = val.replace(/ /g,"");
 	if (val.length < 2) {return false} else {return true} 
}
function isZip (val) {
	val = val.replace(/ /g,"");
 	if (val.length < 2) {return false} else {return true} 
}
function isEmail (val) {
	val = val.replace(/ /g,"");
 	if (val.length < 2) {return false} else {return true} 
}
function isTitle (val) {
	val = val.replace(/ /g,"");
 	if (val.length < 2) {return false} else {return true} 
}
function isPhone (val) {
	val = val.replace(/\(/g,"");
	val = val.replace(/\)/g,"");
	val = val.replace(/\+/g,"");
    val = val.replace(/ /g,"");
	val = val.replace(/-/g,"");
 	if ((val.length < 5) || (!isInteger(val))) {return false} else {return true} 
}

function showError (n) {
 	var el = document.getElementById(n)
 	el.style.backgroundColor = "red";
 	el.style.color = 'white';
}

function repainError (n,b,c) {
 	var el = document.getElementById(n)
 	el.style.backgroundColor = b;//"#ECECD5";
 	el.style.color = c; //'#000000';
}