// JavaScript Document
function ValidateForm() {
   var errors = '';	
   		
		//val = document.frmRegistration.NRIC0.value
		
		
		
		
			
		myOption = -1;
		for (i=document.frmRegistration.rdoMode.length-1; i > -1; i--) {
		if (document.frmRegistration.rdoMode[i].checked) {
		myOption = i; i = -1;
		}
		}
	
		myOption2 = -1;
		for (i=document.frmRegistration.rdoPayment.length-1; i > -1; i--) {
		if (document.frmRegistration.rdoPayment[i].checked) {
		myOption2 = i; i = -1;
		}
		}
		
		if (document.frmRegistration.Course.selectedIndex == "") {
					errors += ' - Workshop Title \n';
					}
					
					
		if (document.frmRegistration.rdoMode[0].checked==false && document.frmRegistration.rdoMode[1].checked==false) {
			errors += ' - Sponsorship \n';
		}else{
					if (frmRegistration.rdoMode[0].checked==true) {
								if(document.frmRegistration.txtCompany.value == "" || document.frmRegistration.txtCompany.value == null ) {
									errors += ' - Company Name\n';
								}
								if(document.frmRegistration.txtDesignation.value == "" || document.frmRegistration.txtDesignation.value == null ) {
		 						errors += ' - Designation\n';
								}
					}  	
		
		}
		
		
		if(document.frmRegistration.txtContactPerson.value == "" || document.frmRegistration.txtContactPerson.value == null ) {
		   errors += ' - Contact Person\n';
		}
		
		
		if(document.frmRegistration.txtContactNo.value == "" || document.frmRegistration.txtContactNo.value == null ) {
		   errors += ' - Contact No. \n';
		}
		
		if (document.frmRegistration.txtEmail.value =="") {
		
		errors += ' - Email\n';
		} else {
			val = document.frmRegistration.txtEmail.value
			p=val.search('@');
		
			if (p<1 || p==(val.length-1)){
			 errors+='- Valid email address\n';
			} 
		}
		
		if(document.frmRegistration.txtAddress.value == "" || document.frmRegistration.txtAddress.value == null ) {
		   errors += ' - Address \n';
		}
		

		
		if(document.frmRegistration.Name1.value == "" || document.frmRegistration.Name1.value == null ) {
		   errors += ' - 1. Participant\'s Name \n';
		}
		
		if (frmRegistration.rdoMode[0].checked==true) {
					if(document.frmRegistration.Designation1.value == "" || document.frmRegistration.Designation1.value == null ) {
		 			  errors += ' - 1. Participant\'s Designation \n';
					}
		}  	
		
		
		
		if(document.frmRegistration.Name2.value == "" || document.frmRegistration.Name2.value == null ) {
		}else{
					
					
					if (frmRegistration.rdoMode[0].checked==true) {
						if(document.frmRegistration.Designation2.value == "" || document.frmRegistration.Designation2.value == null ) {
						  errors += ' - 2. Participant\'s Designation \n';
						}
					} 
					  	
		
		}
		if(document.frmRegistration.Name3.value == "" || document.frmRegistration.Name3.value == null ) {
		}else{
					
					if (frmRegistration.rdoMode[0].checked==true) {
						if(document.frmRegistration.Designation3.value == "" || document.frmRegistration.Designation3.value == null ) {
						  errors += ' - 3. Participant\'s Designation \n';
						}
					} 
					 	
		
		}
		
		
		if (document.frmRegistration.rdoPayment[0].checked==false && document.frmRegistration.rdoPayment[1].checked==false && document.frmRegistration.rdoPayment[2].checked==false && document.frmRegistration.rdoPayment[3].checked==false) {
			errors += ' - Mode of Payment \n';
		}

		
		
		if (errors){
			 alert('The following error(s) occurred:\n'+errors);
			 
			 return false;
		} else {
			return true;
		}   
		return false;
}












