function MM_validateForm() { // JW 6-25-09
document.VAL_procceccing = true;
  var i,p,q,nm,test,tig,num,valTitle,zmin,zmax,zval,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; tig=args[i+1]; val=document.getElementById(args[i]);

    if (val) { 
valOBJ=val;
valTitle=val.title; 
nm=val.name; 
val=val.value; 
if (test!='R') {


	valOBJ.className='frmOK';
      	if (test.indexOf('isEmail')!=-1) {
	  		p=val.indexOf('@');
			if (p<1 || p==(val.length-1)) {
			errors+='- '+valTitle+' must contain an e-mail address.\n';
			valOBJ.className='frmError';
			} else {
			valOBJ.className='frmOK';
			}
	} else if (test.indexOf('CC')!=-1) {
fig = document.FF.acctype;

vIs='';
for (var v=0; v <= fig.length; v++) {
	if (fig[v].checked) {
		vIs =fig[v].value;
		break;
	}
}
		if (vIs!='free') {
			if (document.getElementById('ccNum').value.length < 1 || document.getElementById('ccNum').value == 'credit card number') {
			errors += '- Credit Card Number is required\n';
			}
			if (document.getElementById('expDate').value.length < 1 || document.getElementById('expDate').value == 'experation date (mm/yyyy)') {
			errors += '- Credit Card Experation is required\n';
			}
		}
      	} else if (test.indexOf('Length')!=-1) {
		  //alert(tig)
		  	if (val.length < tig) { 
			errors += '- '+valTitle+' must be at least '+tig+' characters.\n';
			valOBJ.className='frmError';
			} else {
			valOBJ.className='frmOK';
			} 
		} else if (test.indexOf('PassMatch')!=-1) {
		    vval=document.getElementById(tig);
		    if (vval.value != val) {
			 errors += '- Password and Confirm do not match.\n'; 
			valOBJ.className='frmError';
			} else {
			valOBJ.className='frmOK';
			}
		} else if (test.indexOf('ValDate')!=-1) {	
			if (!check_date(val)) {
			
			errors += '- '+valTitle+' must be a valid date (MM/DD/YYYY)\n';
			valOBJ.className='frmError';
			} else {
			valOBJ.className='frmOK';
			}
			//alert(check_date(val))
		} else if (test.indexOf('CharMatch-')!=-1) {
			if (val.length>Number(tig)) {
			tmpV = val.charAt(Number(tig));
			testV = test.substring(10,test.length)
			if (testV!=tmpV) { errors += '- '+valTitle+' does not mach a required formating.\n';
			valOBJ.className='frmError';
			} else {
			valOBJ.className='frmOK';
			}
			}
		} else if (test.indexOf('CharNOT-')!=-1) {
			//alert(tig)
			testVV = test.substring(8,test.length)
			testVV = testVV.toLowerCase()
			valtest = val.toLowerCase()
			//alert(testVV)
			//alert(valtest)
			if (valtest.indexOf(testVV)!=-1) {
			
				errors += '- '+tig+'.\n';
			valOBJ.className='frmError';
			} else {
			valOBJ.className='frmOK';
			}
   		 }  else if (test.indexOf('Checked')!=-1) {
		 	chkBox=document.getElementById(nm);
			if (!chkBox.checked) {
				errors += '- '+valTitle+'\n';
			valOBJ.className='frmError';
			} else {
			valOBJ.className='frmOK';
			}
   		 }  else if (test.indexOf('Selected')!=-1) {
		 //alert('#'+nm+'#')
		 	chkBox=document.getElementById(nm);
			if (chkBox.selectedIndex==0) {
				errors += '- '+valTitle+'\n';
			valOBJ.className='frmError';
			} else {
			valOBJ.className='frmOK';
			}
		 }  else if (test.indexOf('RisNum')!=-1) {
		 	if (isNaN(val)) {
			errors += '- '+valTitle+' must contain a number.\n';
			valOBJ.className='frmError';
			} else {
			valOBJ.className='frmOK';
			}
		}  else if (test.indexOf('inRange')!=-1) {
		p=test.indexOf(':');
          	zmin=test.substring(8,p);
		  zmax=test.substring(p+1);
          		if (num<zmin || zmax<num) {
		  	errors += '- '+val.title+' must contain a number between '+zmin+' and '+zmax+'.\n';
			valOBJ.className='frmError';
			} else {
			valOBJ.className='frmOK';
			}
		}

	} else if (test.charAt(0) == 'R') { 
	//alert(val.length)
	//alert(val + ':' + tig)
			if (val=="") {
			 errors += '- '+valTitle+' is required.\n'; 
			valOBJ.className='frmError';
			} else {

				if (tig.length > 0) {
						
					if (val==tig) {
						valOBJ.className='frmError';
						errors += '- '+valTitle+' is required.\n';
					} else {
						valOBJ.className='frmOK';
					}
				}
			
			}
	}
	}

  }
   if (errors) {
   alert('The following error(s) occurred:\n'+errors); // FOR
   }
  document.MM_returnValue = (errors == '');
} //function
