function CheckFields(frm) {
 			
			var doc = document.getElementById(frm); // Form ID
			var errbg = "#F4ECD0"; // Error bg color
			var errtext = "black"; // Error text color
			var dbg = "white"; // Default bg color
			var dtext = "black"; // Default text color

		switch (frm) {
			// select page select.asp
			case "dfselect" :
			doc.StartNode.style.background = dbg;
			doc.EndNode.style.background = dbg;
			doc.TravelDate.style.background = dbg;
				
				if (doc.TravelDate.value == "") {
					doc.TravelDate.style.color = errtext;
					doc.TravelDate.style.background = errbg;
					doc.TravelDate.focus();
					}		
				if (doc.EndNode.value == 0) {
					doc.EndNode.style.color = errtext;
					doc.EndNode.style.background = errbg;
					doc.EndNode.focus();
					}		
				if (doc.StartNode.value == 0) {
					doc.StartNode.style.color = errtext;
					doc.StartNode.style.background = errbg;
					doc.StartNode.focus();
					}	
				return false;
			break;
			
			//route.asp
			case "dfProceedPayment" :
			doc.invEmail.style.background = dbg;
			doc.invPhone.style.background = dbg;
			doc.invLName.style.background = dbg;
			doc.invFName.style.background = dbg;
			
				if (doc.invPhone.value == '') {
					doc.invPhone.style.color = errtext;
					doc.invPhone.style.background = errbg;
					doc.invPhone.focus();
					}
				if (! /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(doc.invEmail.value) && doc.invEmail.value != "")  {
					doc.invEmail.style.color = errtext;
					doc.invEmail.style.background = errbg;
					doc.invEmail.value = "Invalid Email Format";
					doc.invEmail.focus();
					}
				if (doc.invEmail.value == '') {
					doc.invPhone.style.color = errtext;
					doc.invPhone.style.background = errbg;
					doc.invPhone.focus();
					}
				if (doc.invLName.value == '') {
					doc.invLName.style.color = errtext;
					doc.invLName.style.background = errbg;
					doc.invLName.focus();
					}			
				if (doc.invFName.value == '') {
					doc.invFName.style.color = errtext;
					doc.invFName.style.background = errbg;
					doc.invFName.focus();
					}	
				if ((doc.invFName.value != '') && (doc.invLName.value != '') && (doc.invEmail.value != '') && ( /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(doc.invEmail.value)) && (doc.invPhone.value != '')) {
				 return true;
				} else {
					return false;
				}
			break;
			
			// login.asp
			case "dfSignUp" :
			doc.memUserName.style.background = dbg;
			doc.memPassword.style.background = dbg;
			doc.ConfirmPassword.style.background = dbg;
			doc.memFName.style.background = dbg;
			doc.memLName.style.background = dbg;
			doc.memEmail.style.background = dbg;
			doc.memPhone.style.background = dbg;
			
				//var doc = doc;
				//var signUp = new Array("memUserName","memPassword","ConfirmPassword","memFName","memLName","memEmail"); 
				
				//var i = 0;
					//while( i < signUp.length) { 
						//doc+"."+signUp[i]+".style.background=white";
						//i++;
					//}
				if (doc.memPhone.value == '') {
					doc.memPhone.style.color = errtext;
					doc.memPhone.style.background = errbg;
					doc.memPhone.focus();
					}
				if (doc.memEmail.value == '') {
					doc.memEmail.style.color = errtext;
					doc.memEmail.style.background = errbg;
					doc.memEmail.focus();
					}
				if (doc.memLName.value == '') {
					doc.memLName.style.color = errtext;
					doc.memLName.style.background = errbg;
					doc.memLName.focus();
					}
				if (doc.memFName.value == '') {
					doc.memFName.style.color = errtext;
					doc.memFName.style.background = errbg;
					doc.memFName.focus();
					}
				if (doc.ConfirmPassword.value == '') {
					doc.ConfirmPassword.style.color = errtext;
					doc.ConfirmPassword.style.background = errbg;
					doc.ConfirmPassword.focus();
					}
				if (doc.memPassword.value == '') {
					doc.memPassword.style.color = errtext;
					doc.memPassword.style.background = errbg;
					doc.memPassword.focus();
					}
				if (doc.memUserName.value == '') {
					doc.memUserName.style.color = errtext;
					doc.memUserName.style.background = errbg;
					doc.memUserName.focus();
					}	
				if (doc.memUserName.value != '' && doc.memPassword.value != '' && doc.ConfirmPassword.value != '' && doc.memFName.value != '' && doc.memLName.value != '' && doc.memEmail.value != '') {
	
				 return true;
				} else {
					return false;
				}
			break;
			
			// login.asp
			case "dfmemLogin" :
			doc.memUserName.style.background = dbg;
			doc.memPassword.style.background = dbg;
				
				if (doc.memPassword.value == '') {
					doc.memPassword.style.color = errtext;
					doc.memPassword.style.background = errbg;
					doc.memPassword.focus();
					}
				if (doc.memUserName.value == '') {
					doc.memUserName.style.color = errtext;
					doc.memUserName.style.background = errbg;
					doc.memUserName.focus();
					}	
				if (doc.memUserName.value != '' && doc.memPassword.value != '') {
				 return true;
				} else {
					return false;
				}
			break;
			
			// login.asp
			case "dfmemForgotPass" :
			doc.memUserName.style.background = dbg;
			doc.memEmail.style.background = dbg;
				
				if (doc.memEmail.value == '') {
					doc.memEmail.style.color = errtext;
					doc.memEmail.style.background = errbg;
					doc.memEmail.focus();
					}
				
				if (doc.memUserName.value == '') {
					doc.memUserName.style.color = errtext;
					doc.memUserName.style.background = errbg;
					doc.memUserName.focus();
					}	

				if (doc.memUserName.value != '' || doc.memEmail.value != '') {
				 return true;
				} else {
					return false;
				}
			break;
		
		}
		//close switch
	}
//close main function	
				
