function validateAndPost(){
    var str = "";
    if(!isName(document.frmContact.txtName.value)){
       str += "Please supply a Name.\n";
    }
	if(!isEmail(document.frmContact.txtEmail.value)){
       str += "Please supply a correct Email address.\n";
    }
	if(!isPhone(document.frmContact.txtTel.value)){
       str += "Please supply a correct Telephone number.\n";
    }
	if(str.length > 0){
	   alert(str);
    } 
    else{
	   document.frmContact.submit();
    }
}
function validateAndPostOrder(){
    var str = "";
    if(!isName(document.frmOrder.txtName.value)){
       str += "Please supply a Name.\n";
    }
	if(!isEmail(document.frmOrder.txtEmail.value)){
       str += "Please supply a correct Email address.\n";
    }
	if(!isPhone(document.frmOrder.txtTel.value)){
       str += "Please supply a correct Telephone number.\n";
    }
	 if(!isName(document.frmOrder.txtMessage.value)){
       str += "Please supply at least one image Id.\n";
    }
	if(str.length > 0){
	   alert(str);
    } 
    else{
	   document.frmOrder.submit();
    }
}

function isName(strName){
	if(strName.length < 3){												//Checking the length of the e-mail address
		return false;
	}
	return true;														// If we got here the number is OK. 
}

function isEmail(strEmail){
	if(strEmail.length < 3 || strEmail.length > 255){				//Checking the length of the e-mail address
		return false;
	}
	if(strEmail.indexOf("@") < 0){										//Checking the format of the e-mail address
		return false;
	}
	if(strEmail.indexOf(".") < 0){										//Checking the format of the e-mail address
		return false;
	}
	return true;														// If we got here the number is OK. 
}

function isPhone(strPhone){ 
	if(strPhone.length < 6 || strPhone.length > 32){ 					// Number is to short or to long
		return false; 
	}
	if(isNaN(strPhone)){												// If not numeric then return false
		return false;
	}
	return true; 														// If we got here the number is OK. 
}


