	function isValidPattern_Email(str)
	{
		var regEx = /^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/i;		
		return regEx.test(str);
	}
	
	function isValidPattern_Digits(str)
	{
		var regEx = new RegExp("[^0-9]","ig");
	
		return !regEx.test(str);
	}

		var digits = "0123456789";
		// non-digit characters which are allowed in phone numbers
		var phoneNumberDelimiters = "()- ";
		// characters which are allowed in international phone numbers
		// (a leading + is OK)
		var validWorldPhoneChars = phoneNumberDelimiters + "+";
		// Minimum no of digits in an international phone no.
		var minDigitsInIPhoneNumber = 10;
		
		function isInteger(s)
		{   var i;
			for (i = 0; i < s.length; i++)
			{   
				// Check that current character is number.
				var c = s.charAt(i);
				if (((c < "0") || (c > "9"))) return false;
			}
			// All characters are numbers.
			return true;
		}
		function trim(s)
		{   var i;
			var returnString = "";
			// Search through string's characters one by one.
			// If character is not a whitespace, append to returnString.
			for (i = 0; i < s.length; i++)
			{   
				// Check that current character isn't whitespace.
				var c = s.charAt(i);
				if (c != " ") returnString += c;
			}
			return returnString;
		}
		function stripCharsInBag(s, bag)
		{   var i;
			var returnString = "";
			// Search through string's characters one by one.
			// If character is not in bag, append to returnString.
			for (i = 0; i < s.length; i++)
			{   
				// Check that current character isn't whitespace.
				var c = s.charAt(i);
				if (bag.indexOf(c) == -1) returnString += c;
			}
			return returnString;
		}
		
		function checkInternationalPhone(strPhone){
		var bracket=3
		strPhone=trim(strPhone)
		if(strPhone.indexOf("+")>1) return false
		if(strPhone.indexOf("-")!=-1)bracket=bracket+1
		if(strPhone.indexOf("(")!=-1 && strPhone.indexOf("(")>bracket)return false
		var brchr=strPhone.indexOf("(")
		if(strPhone.indexOf("(")!=-1 && strPhone.charAt(brchr+2)!=")")return false
		if(strPhone.indexOf("(")==-1 && strPhone.indexOf(")")!=-1)return false
		s=stripCharsInBag(strPhone,validWorldPhoneChars);
		return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
		}
	
	function validateForm()
	{
		/*var course = document.frmRegistration.selCourse.value;*/
		var dropdown = document.frmRegistration.mydropdown.value;
		var eduLevel = document.frmRegistration.selEduLevel.value;
		/*var gradYear = document.frmRegistration.selGradYear.value;*/
		var program = document.frmRegistration.selProgram.value;
		var firstName = document.frmRegistration.txtFirstName.value;
		var lastName = document.frmRegistration.txtLastName.value;
		var state = document.frmRegistration.selState.value;
		var country = document.frmRegistration.selCountry.value;
		var phone = document.frmRegistration.txtPhone.value;
		var email = document.frmRegistration.txtEmail.value;
	if(dropdown == '0')
		{
			alert("You have to select your Initial Selection");
			document.frmRegistration.mydropdown.focus();
			return false;
		}
		
		if(eduLevel == '0')
		{
			alert("You have to select your education level");
			document.frmRegistration.selEduLevel.focus();
			return false;
		}
		
		/*if(gradYear == '')
		{
			alert("You have to select your graduation year.");
			document.frmRegistration.selGradYear.focus();
			return false;
		}*/
		
		if(program == '0')
		{
			alert("You have to select your program you are applying for");
			document.frmRegistration.selProgram.focus();
			return false;
		}
		
		if(firstName == '')
		{
			alert("You have to input your first name");
			document.frmRegistration.txtFirstName.focus();
			return false;
		}
		
		if(lastName == '')
		{
			alert("You have to input your last name");
			document.frmRegistration.txtLastName.focus();
			return false;
		}
		
		if(state == '')
		{
			alert("You have to select state");
			document.frmRegistration.selState.focus();
			return false;
		}
		
		if(country == '')
		{
			alert("You have to select country");
			document.frmRegistration.selCountry.focus();
			return false;
		}
		
		if(phone == '' || !isValidPattern_Digits(phone))
		{
			alert("You have to input your phone number and it must have digits only");
			document.frmRegistration.txtPhone.focus();
			return false;
		}
		
			var Phone=document.frmRegistration.txtPhone
	
			if (checkInternationalPhone(Phone.value)==false){
				alert("Please Enter a Valid Phone Number having 10 digits")
				Phone.value=""
				Phone.focus()
				return false
			}
				
		var ph1 = phone.substr(0,1);
		var ph4 = phone.substr(3,1);
		if(ph1 == '0' || ph1 == '1')
		{
			alert('First digit should not be ZERO or ONE');
			document.frmRegistration.txtPhone.focus();
			return false;
		}
		if(ph4 == '0' || ph4 == '1')
		{
			alert('Fourth digit should not be ZERO or ONE');
			document.frmRegistration.txtPhone.focus();
			return false;
		}
		
		
		if(email == '' || !isValidPattern_Email(email))
		{
			alert("Your email is required and must be in a valid format");
			document.frmRegistration.txtEmail.focus();
			return false;
		}
		
		var emldom = email.split('@');
		var e1 = emldom[1];
		var e2 = e1.split('.');
		
		if(e1 == 'Yahho.com' || e1 == 'Goggle.com' || e1 == 'Abc.com' || e1 == 'Xyz.com' || e1 == 'Aaa.com' || e1 == 'Bbb.com')
		{
			alert('Wrong Domain');
			document.frm.email.focus();
			return false;
		}
		if(e2[0].length<4)
		{
		alert('Domain name of EmailId should have 4 characters');
		document.frm.email.focus();
		return false;
		}
		if(e2[1] != 'com' && e2[1] != 'net' && e2[1] != 'org' && e2[1] != 'us' && e2[1] != 'biz')
		{
		alert('Mail TLD is not allowed');
		document.frm.email.focus();
		return false;
		}
		
		document.frmRegistration.submit();
	}