var CheckList = new Array() 

function Check(Description, FormValue, Type) {
	this.Description = Description;
	this.FormValue = FormValue;
	this.Type = Type;
} 

function PASS(form){

	var Missing = ""
		
	for (var i=1; i<=CheckList.length-1; i++) {

		var fieldvalue = CheckList[ i ].FormValue
		var fieldname = CheckList[ i ].Description
		var type = CheckList[ i ].Type
		var CheckValue = "form."+fieldvalue+".value";
		// get form field value
		x = eval(CheckValue)
		
		//check fo a valid float
		if (type=="float"){
			MyNumeric = "0123456789+-."
			validChars=1
			validNumbers=0
			for(var j=0; j <= x.length-1; j++){
				aChar = x.substring(j,j+1)
				if (MyNumeric.indexOf(aChar)==-1){
					validChars=0
					break;
				}
			}
			MyNumeric = "0123456789"
			for(j=0; j <= x.length-1; j++){
				aChar = x.substring(j,j+1)
				if (MyNumeric.indexOf(aChar)>-1){
					validNumbers=1
					break;
				}
			}
			if ((validChars==0) || (validNumbers==0)){
				x=""
			}
		}
		
		//check fo a value of a specified length
		if (typeof type=="number"){
			if (x.length<type){
				x=""
			}
		}
		
		//check for valid email
		if (type=="email"){
			if ((x.indexOf("@")==-1) || (x.indexOf(".")==-1) || (x.length<5)){
				x = ""
			}
		}
		
		// check for a string that does not contain numbers
		if(type=="nonum"){			
			y=0
			while (y<10){
				NumberFound=x.indexOf(y)
				if (NumberFound>-1){
					x=""
					y=1
				}
				y += 1
			}
		}
		
		// check for valid phone number
		if(type=="phone"){
			ExtraChars=" +()"
			if (x.length < 5){
				x=""
			}
			else{
				for(var j=0; j <= x.length-1; j++){
					aChar = x.substring(j,j+1)
					if ((ExtraChars.indexOf(aChar)==-1) && ((aChar < "0") || (aChar > "9"))){
						x=""
					}
				}
			}
		}
		
		// check for valid integer
		if(type=="integer"){
			for(j=0; j <= x.length-1; j++){
				aChar = x.substring(j,j+1)
				if (aChar < "0" || aChar > "9"){
					x=""
				}
			}
		}
		
		// build missing info string
		if (x==""){
			Missing=Missing+fieldname+"\r"
		}

	}

	if (Missing!=""){
		// the fields have not been filled in properly so display alert message
		alert("You have not included the following details: \r\r"+Missing+"\rPlease fill these in before proceeding.");
		return false;
	}
	else{
		// form is OK so pass it
		return true;
	}
}


