Array.prototype.indexOf = IndexOf;

//Toggles between two classes for an element
function ToggleClass(element, firstClass, secondClass, event){
event.cancelBubble = true;

var classes = element.className.split(" ");
var firstClassIndex = classes.indexOf(firstClass);
var secondClassIndex = classes.indexOf(secondClass);

if (firstClassIndex == -1 && secondClassIndex == -1){
classes[classes.length] = firstClass;}
else if (firstClassIndex!= -1){
classes[firstClassIndex] = secondClass;
}else{
classes[secondClassIndex] = firstClass;}
element.className = classes.join(" ");
}

//Finds the index of an item in an array
function IndexOf(item){
for (var i=0; i < this.length; i++){
if (this[i] == item){
return i;}
}
return -1;
}


function toggle(id1,id2,id3)
{
	var foodyes=document.getElementById(id1).checked;
	var foodno=document.getElementById(id2).checked;
	if(foodyes)
	{
		document.getElementById(id3).style.display = 'block';
	}
	else 
	{
		document.getElementById(id3).style.display = 'none';
	}	
}

	




//The toggle event handler for each expandable/collapsable node
//- Note that this also exists to prevent any IE memory leaks
//(due to circular references caused by this)
function ToggleNodeStateHandler(event){
ToggleClass(this, "Collapsed", "Expanded", (event == null)? window.event : event);
}

//Prevents the onclick event from bubbling up to parent elements
function PreventBubbleHandler(event){
if (!event) event = window.event;
event.cancelBubble = true;
}

//Adds the relevant onclick handlers for the nodes in the tree view
function SetupTreeView(elementId){
var tree = document.getElementById(elementId);
var treeElements = tree.getElementsByTagName("li");

for (var i=0; i < treeElements.length; i++){
if (treeElements[i].getElementsByTagName("ul").length > 0){
treeElements[i].onclick = ToggleNodeStateHandler;
}else{
treeElements[i].onclick = PreventBubbleHandler;
}
}
}

var lwr = 'abcdefghijklmnopqrstuvwxyz';
var upr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var dig = '1234567890';
var space= ' ';
 
function isValid(parm,val) 
{
  for (i=0; i<parm.length; i++) 
  {
    if (val.indexOf(parm.charAt(i),0) == -1) return false;
  }
  return true;
}

function validateEmail(email)
{
	
	if (email == ""){
		return false;
	}
	badStuff = ";:/,' \"\\";
	for (i=0; i<badStuff.length; i++){
		badCheck = badStuff.charAt(i)
		if (email.indexOf(badCheck,0) != -1){
			return false;
		}
	}
	posOfAtSign = email.indexOf("@",1)
	if (posOfAtSign == -1){
		return false;
	}
	if (email.indexOf("@",posOfAtSign+1) != -1){
		return false;
	}
	posOfPeriod = email.indexOf(".", posOfAtSign)
	if (posOfPeriod == -1){
		return false;
	}
	if (posOfPeriod+2 > email.length){
		return false;
	}
	return true
}

function isEmpty(textvalue) {
	textvalue=textvalue.replace(/\s/g,"");
	if(textvalue.length>0)
		return false;
	else
		return true;
}

/**Validation for Contact Us Page.**/
function validate_contact(){
//	alert("gfjh");
	if (isEmpty(document.getElementById('ContactName').value)) {
		alert("Please enter your name.");
		document.getElementById('ContactName').focus();
		return false;
	}
	if (!isValid(document.getElementById("ContactName").value,lwr+upr+space))
	 {
	 alert("Enter only alphabets in First Name");
	 document.getElementById('ContactName').focus();
	 return false;
	 }
	
	if (isEmpty(document.getElementById('ContactEmail').value)) {
		alert("Please enter your email address.");
		document.getElementById('ContactEmail').focus();
		return false;
	}

	if(!validateEmail(document.getElementById('ContactEmail').value)) {
		alert("Please enter valid email address.");
		document.getElementById('ContactEmail').focus();
		return false;
	}
	
	if (isEmpty(document.getElementById('ContactSubject').value)) {
		alert("Please enter your message subject.");
		document.getElementById('ContactSubject').focus();
		return false;
	}
		
	if (isEmpty(document.getElementById('ContactMessage').value)) {
		alert("Please enter your message.");
		document.getElementById('ContactMessage').focus();
		return false;
	}
		
}

/**
	This function will for client side validation for User Login Page.
*/

function validate_login()
{
	if (isEmpty(document.getElementById('txt_loinuser').value)) 
	{
		alert("Please enter username.");
		document.getElementById('txt_loinuser').focus();
		return false;
	}
	
	if (isEmpty(document.getElementById('txt_loginpass').value)) 
	{
		alert("Please enter password.");
		document.getElementById('txt_loginpass').focus();
		return false;
	}
}

function validate_loginuser()
{
	if (isEmpty(document.getElementById('UserUsername').value)) 
	{
		alert("Please enter username.");
		document.getElementById('UserUsername').focus();
		return false;
	}
	
	if (isEmpty(document.getElementById('UserPassword').value)) 
	{
		alert("Please enter password.");
		document.getElementById('UserPassword').focus();
		return false;
	}
}

function validate_student()
{
	//Validations for Student Details
	if (isEmpty(document.getElementById('dateinput').value)) {
		alert("Please enter Application Date");
		document.getElementById('dateinput').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('StudentEmail').value)) {
		alert("Please enter email id.");
		document.getElementById('StudentEmail').focus();
		return false;
	}
	if(!validateEmail(document.getElementById('StudentEmail').value)) 
	{
		alert("Please enter valid email address.");
		document.getElementById('StudentEmail').focus();
		return false;
	}		
	if (isEmpty(document.getElementById('StudentAddress').value)) {
		alert("Please enter address");
		document.getElementById('StudentAddress').focus();
		return false;
	}
		
	if (isEmpty(document.getElementById('StudentFirstName').value)) {
		alert("Please enter First Name");
		document.getElementById('StudentFirstName').focus();
		return false;
	}
	if (!isValid(document.getElementById("StudentFirstName").value,lwr+upr))
	 {
	 alert("Enter only alphabets in First Name");
	 document.getElementById('StudentFirstName').focus();
	 return false;
	 }
	if(isEmpty(document.getElementById('StudentLastName').value)) {
		alert(" Please enter  Last Name.");
		document.getElementById('StudentLastName').focus();
		return false;
	}
	if (!isValid(document.getElementById("StudentLastName").value,lwr+upr))
	 {
	 alert("Enter only alphabets in Last Name");
	 document.getElementById('StudentLastName').focus();
	 return false;
	 }	
		
	if (isEmpty(document.getElementById('dateinput1').value)) {
		alert("Please enter date of birth.");
		document.getElementById('dateinput1').focus();
		return false;
	}
	if (!document.getElementById('dateinput1').value=="")
	 {
		 $condition=validate_dateinput();
		 if($condition==0)
		 {
		 	return false;
		 }
   	}
	
	if (!document.getElementById('dateinput1').value=="")
	 {
		 $condition=validate_date1();
		 if($condition==0)
		 {
		 	return false;
		 }
   	}
		
	if (isEmpty(document.getElementById('StudentNationality').value)) {
		alert("Please enter nationality");
		document.getElementById('StudentNationality').focus();
		return false;
	}
	if (!isValid(document.getElementById("StudentNationality").value,lwr+upr))
	 {
	 alert("Enter only alphabets in nationality");
	 document.getElementById('StudentNationality').focus();
	 return false;
	 }	
		
	if (isEmpty(document.getElementById('StudentPhoneNo').value)) {
		alert("Please enter phone no.");
		document.getElementById('StudentPhoneNo').focus();
		return false;
	}
	
	 if (isEmpty(document.getElementById('StudentCourse').value)) {
		alert("Please select course.");
		document.getElementById('StudentCourse').focus();
		return false;
	}
	if (isEmpty(document.getElementById('StudentCardType').value)) {
		alert("Please enter card type");
		document.getElementById('StudentCardType').focus();
		return false;
	}
	if (isEmpty(document.getElementById('StudentSortCard').value)) {
		alert("Please enter sort code");
		document.getElementById('StudentSortCard').focus();
		return false;
	}
	if (isEmpty(document.getElementById('StudentAccNo').value)) {
		alert("Please enter account no.");
		document.getElementById('StudentAccNo').focus();
		return false;
	}
	if (isEmpty(document.getElementById('dateinput4').value)) {
		alert("Please enter valid until detail.");
		document.getElementById('dateinput4').focus();
		return false;
	}
	if (isEmpty(document.getElementById('dateinput5').value)) {
		alert("Please enter valid from detail");
		document.getElementById('dateinput5').focus();
		return false;
	}
	if (isEmpty(document.getElementById('StudentSecurityCode').value)) {
		alert("Please enter security code.");
		document.getElementById('StudentSecurityCode').focus();
		return false;
	}
	if (isEmpty(document.getElementById('StudentIssueNo').value)) {
		alert("Please enter issue no.");
		document.getElementById('StudentIssueNo').focus();
		return false;
	}
	if (isEmpty(document.getElementById('StudentFeePaid').value)) {
		alert("Please enter FEE Paid.");
		document.getElementById('StudentFeePaid').focus();
		return false;
	}
	if (!isValid(document.getElementById("StudentFeePaid").value,dig))
	 {
	 alert("Please enter correct fee details");
	 document.getElementById('StudentFeePaid').focus();
	 return false;
	 }	
	if (isEmpty(document.getElementById('StudentCardHolder').value)) {
		alert("Please enter card holder name");
		document.getElementById('StudentCardHolder').focus();
		return false;
	}
	if (isEmpty(document.getElementById('StudentYouHear').value)) {
		alert("Please select how did you hear about us.");
		document.getElementById('StudentYouHear').focus();
		return false;
	}	
	
     if (!isValid(document.getElementById("StudentCardHolder").value,lwr+upr))
	 {
	 alert("Enter valid card holder name");
	 document.getElementById('StudentCardHolder').focus();
	 return false;
	 }	
	//return false;
}

	function validate_forgot()
	{
		
		if (isEmpty(document.getElementById('txt_username').value)) 
		{
			alert("Please enter email address");
			document.getElementById('txt_username').focus();
			return false;
		}
		if(!validateEmail(document.getElementById('txt_username').value)) 
		{
			alert("Please enter valid email address.");
			document.getElementById('txt_username').focus();
			return false;
		}
		if (isEmpty(document.getElementById('txt_regno').value)) 
		{
			alert("Please enter reference no ");
			document.getElementById('txt_regno').focus();
			return false;
		}
		if (isEmpty(document.getElementById('txt_dob').value)) 
		{
			alert("Please enter date of birth.");
			document.getElementById('txt_dob').focus();
			return false;
		}
		
		
	}
	
	function validate_register()
 {
	//Validations for register student
	if (isEmpty(document.getElementById('txt_username').value)) 
	{
		alert("Please enter username");
		document.getElementById('txt_username').focus();
		return false;
	}	
	if (!isValid(document.getElementById("txt_username").value,lwr+upr+dig))
	 {
	 alert("Enter only alphabets and digits in username");
	 document.getElementById('txt_username').focus();
	 return false;
	 }
	 if (document.getElementById("txt_username").value.length<5)
	 {
	 alert("Enter Username of length more than 4 characters ");
	 document.getElementById('txt_username').focus();
	 return false;
	 }
	
	if (isEmpty(document.getElementById('txt_password').value)) 
	{
		alert("Please enter password");
		document.getElementById('txt_password').focus();
		return false;
	}
	if (document.getElementById('txt_password').value.length<5) 
	{
		alert("Enter password of length more than 4 characters ");
		document.getElementById('txt_password').focus();
		return false;
	}

	if (isEmpty(document.getElementById('txt_name').value)) 
	{
		alert("Please enter name");
		document.getElementById('txt_name').focus();
		return false;
	}	
	if (!isValid(document.getElementById("txt_name").value,lwr+upr+space))
	 {
	 alert("Enter only alphabets in name");
	 document.getElementById('txt_name').focus();
	 return false;
	 }
	if (isEmpty(document.getElementById('txt_email').value)) 
	{
		alert("Please enter email id");
		document.getElementById('txt_email').focus();
		return false;
	}	
	if(!validateEmail(document.getElementById('txt_email').value)) 
	{
		alert("Please enter valid email address.");
		document.getElementById('txt_email').focus();
		return false;
	}
	if (isEmpty(document.getElementById('txt_studentreg').value)) 
	{
		alert("Please enter your student registration no.");
		document.getElementById('txt_studentreg').focus();
		return false;
	}	
	if (!isValid(document.getElementById("txt_studentreg").value,dig))
	 {
	 alert("Enter only numerics in Registration no.");
	 document.getElementById('txt_studentreg').focus();
	 return false;
	 }
	if (isEmpty(document.getElementById('txt_dob').value)) 
	{
		alert("Please enter your date of birth");
		document.getElementById('txt_dob').focus();
		return false;
	}	
	
	if (!document.getElementById('txt_dob').value=="")
	 {
		 $condition=validate_date();
		 if($condition==0)
		 {
		 	return false;
		 }
   	}
	
 }
 
 function validate_date()
{
    var date = document.getElementById('dateinput').value;
	date = date.split("-");
	 if (date[0]>1990 )
	{
			alert ("Please enter correct birth date");
			document.getElementById('dateinput').value=""
			document.getElementById('dateinput').focus();
			return false;
	}
	
}
function validate_date1()
{
    var date = document.getElementById('dateinput1').value;
	date = date.split("-");
	 if (date[0]>1990 )
	{
			alert ("Please enter correct birth date");
			document.getElementById('dateinput1').value=""
			document.getElementById('dateinput1').focus();
			return false;
	}
	
}
	function validate_forget()
 {
	//Validations for register student
	if (isEmpty(document.getElementById('UserUsername').value)) 
	{
		alert("Please enter username");
		document.getElementById('UserUsername').focus();
		return false;
	}	
	 if (document.getElementById("UserUsername").value.length<5)
	 {
	 alert("Enter Username of length more than 4 characters ");
	 document.getElementById('UserUsername').focus();
	 return false;
	 }
	
	if (isEmpty(document.getElementById('UserEmail').value)) 
	{
		alert("Please enter email id");
		document.getElementById('UserEmail').focus();
		return false;
	}	

	if(!validateEmail(document.getElementById('UserEmail').value)) 
	{
		alert("Please enter valid email address.");
		document.getElementById('UserEmail').focus();
		return false;
	}
  }

function validate_result()
 {
	//Validations for register student
	if (isEmpty(document.getElementById('ResultCandidateId').value)) 
	{
		alert("Please enter candidate id");
		document.getElementById('ResultCandidateId').focus();
		return false;
	}	
		
  }
  
  function validate_airport()
 {
	//Validations for register student
	if (isEmpty(document.getElementById('AirportFirstName').value)) 
	{
		alert("Please enter first name");
		document.getElementById('AirportFirstName').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('AirportInitials').value)) 
	{
		alert("Please enter initials");
		document.getElementById('AirportInitials').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('dob').value)) 
	{
		alert("Please enter your Date of birth");
		document.getElementById('dob').focus();
		return false;
	}	
	if (!document.getElementById('dob').value=="")
	 {
		 $condition=validate_dob();
		 if($condition==0)
		 {
		 	return false;
		 }
   	}
	
	if (isEmpty(document.getElementById('AirportNationality').value)) 
	{
		alert("Please enter your nationality");
		document.getElementById('AirportNationality').focus();
		return false;
	}	
	
	if (isEmpty(document.getElementById('AirportPermanentAddress').value)) 
	{
		alert("Please enter your permanent address");
		document.getElementById('AirportPermanentAddress').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('AirportCorrAddress').value)) 
	{
		alert("Please enter your correspondance address");
		document.getElementById('AirportCorrAddress').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('AirportPermanentCountry').value)) 
	{
		alert("Please enter your country");
		document.getElementById('AirportPermanentCountry').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('AirportCorrCountry').value)) 
	{
			alert("Please enter your country");
		document.getElementById('AirportCorrCountry').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('AirportPermanentPhone').value)) 
	{
		alert("Please enter telephone no");
		document.getElementById('AirportPermanentPhone').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('AirportCorrPhone').value)) 
	{
		alert("Please enter telephone no");
		document.getElementById('AirportCorrPhone').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('AirportEmail').value)) 
	{
		alert("Please enter your email id");
		document.getElementById('AirportEmail').focus();
		return false;
	}	
	if(!validateEmail(document.getElementById('AirportEmail').value)) 
	{
		alert("Please enter valid email address.");
		document.getElementById('AirportEmail').focus();
		return false;
	}
		if (isEmpty(document.getElementById('AirportFlightNo').value)) 
	{
		alert("Please enter your flight no");
		document.getElementById('AirportFlightNo').focus();
		return false;
	}	
		if (isEmpty(document.getElementById('AirportAirlineName').value)) 
	{
		alert("Please enter your airline name");
		document.getElementById('AirportAirlineName').focus();
		return false;
	}	
		if (isEmpty(document.getElementById('AirportDepartureFrom').value)) 
	{
		alert("Please enter departure details");
		document.getElementById('AirportDepartureFrom').focus();
		return false;
	}	
		if (isEmpty(document.getElementById('departure_date').value)) 
	{
		alert("Please enter departure date");
		document.getElementById('departure_date').focus();
		return false;
	}	
		if (document.getElementById('AirportDepartureTime1').value==''|| document.getElementById('AirportDepartureTime2').value=='')
		{
					alert("Please enter departure time");
				document.getElementById('AirportDepartureTime1').focus();
				return false;

		}
		if (isEmpty(document.getElementById('AirportArrivalDest').value)) 
	{
		alert("Please enter arrival detination");
		document.getElementById('AirportArrivalDest').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('AirportArrivalDest').value)) 
	{
		alert("Please enter arrival detination");
		document.getElementById('AirportArrivalDest').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('arrival_date').value)) 
	{
		alert("Please enter arrival date");
		document.getElementById('arrival_date').focus();
		return false;
	}	
	if (document.getElementById('AirportArrivalTime1').value==''|| document.getElementById('AirportArrivalTime2').value=='')
		{
					alert("Please enter arrival time");
				document.getElementById('AirportArrivalTime1').focus();
				return false;

		}
	
	if (isEmpty(document.getElementById('AirportAccompanyingMembers').value)) 
	{
		alert("Please enter no. of accompanying members");
		document.getElementById('AirportAccompanyingMembers').focus();
		return false;
	}	
	
		
  }
  

 function validate_dob()
{
    var date = document.getElementById('dob').value;
	date = date.split("-");
	 if (date[2]>1990 )
	{
			alert ("Please enter correct birth date");
			document.getElementById('dob').value=""
			document.getElementById('dob').focus();
			return false;
	}
	
}
function validate_dateinput()
{
    var date = document.getElementById('dateinput1').value;
	date = date.split("-");
	 if (date[2]>1990 )
	{
			alert ("Please enter correct birth date");
			document.getElementById('dateinput1').value=""
			document.getElementById('dateinput1').focus();
			return false;
	}
	
}

function validate_currentdate(id)
{
	var mydate= new Date();
	var currentyear=mydate.getFullYear();
	var currentmonth=mydate.getMonth()+1;
	var currenttoday=mydate.getDate();
    var date = document.getElementById(id).value;
	date = date.split("-");
   if (date[2] >= currentyear && date[1] >= currentmonth)
	{
		if (date[0] < currenttoday)
		{
			alert ("Date should be greater than current date");
			document.getElementById(id).value="";
			document.getElementById(id).focus();
			return false;
		}
	}
	 if (date[2]< currentyear || date[1] < currentmonth)
	{
			alert ("Date should be greater than current date");
			document.getElementById(id).value=""
			document.getElementById(id).focus();
			return false;
	}
	
}

function validate_arrivaldate(id1,id2)
{
    var date = document.getElementById(id1).value;
	var date1 = document.getElementById(id2).value;
	date = date.split("-");
	date1 = date1.split("-");
	
	if (document.getElementById(id1).value=="") {
		alert("Please enter departure Date First.");
		document.getElementById(id2).value="";
		//document.getElementById(id1).focus();
		return false;
	}	
	

	 if (date1[2] >= date[2] && date1[1] >= date[1])
	{
		if (date1[0] < date[0])
		{
			alert ("Arrival Date must occurs after or same to deparure Date");
			document.getElementById(id2).value="";
			document.getElementById(id2).focus();
			return false;
		}
	}
	 if (date1[2]<date[2] || date1[1]<date[1])
	{
			alert ("Arrival Date must occurs after or same to deparure Date");
			document.getElementById(id2).value=""
			document.getElementById(id2).focus();
			return false;
	}
 	return true;
	
}

function validate_coursedate(id1,id2)
{
    var date = document.getElementById(id1).value;
	var date1 = document.getElementById(id2).value;
	date = date.split("-");
	date1 = date1.split("-");
	
	if (document.getElementById(id1).value=="") {
		alert("Please enter course start date first.");
		document.getElementById(id2).value="";
		//document.getElementById(id1).focus();
		return false;
	}	
	

	 if (date1[2] >= date[2] && date1[1] < date[1])
	{
		alert("course end date should be after start date");
		document.getElementById(id2).value = "";
		document.getElementById(id2).focus();
		return false;
	}
	 if (date1[2] >= date[2] && date1[1] >= date[1])
	{
		if (date1[0] < date[0])
		{
			alert ("course end date should be after start date");
			document.getElementById(id2).value="";
			document.getElementById(id2).focus();
			return false;
		}
	}
	 if (date[2]< date1[2] || date[1] < date1[1])
	{
			alert ("course end date should be after start date");
			document.getElementById(id2).value=""
			document.getElementById(id2).focus();
			return false;
	}
	
}

  function validate_accommodation()
 {
	//Validations for register student
	if (isEmpty(document.getElementById('AccommodationFirstName').value)) 
	{
		alert("Please enter first name");
		document.getElementById('AccommodationFirstName').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('AccommodationInitials').value)) 
	{
		alert("Please enter initials");
		document.getElementById('AccommodationInitials').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('dob').value)) 
	{
		alert("Please enter your Date of birth");
		document.getElementById('dob').focus();
		return false;
	}	
		if (!document.getElementById('dob').value=="")
	 {
		 $condition=validate_dob();
		 if($condition==0)
		 {
		 	return false;
		 }
   	}
	if (isEmpty(document.getElementById('AccommodationNationality').value)) 
	{
		alert("Please enter your nationality");
		document.getElementById('AccommodationNationality').focus();
		return false;
	}	
	if (document.accommodation.gender_Male.checked==false) 
	{
		if (document.accommodation.gender_Female.checked==false) 
		{
			alert("Please select your gender");
			document.getElementById('gender_Male').focus();
			return false;
		}
	}		
	if (document.accommodation.maritial_status_Married.checked==false) 
	{
		if (document.accommodation.maritial_status_Single.checked==false) 
		{
			alert("Please select your maritial status");
			document.getElementById('maritial_status_Married').focus();
			return false;
		}
	}		
	if (isEmpty(document.getElementById('AccommodationPermanentAddress').value)) 
	{
		alert("Please enter your permanent address");
		document.getElementById('AccommodationPermanentAddress').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('AccommodationCorrAddress').value)) 
	{
		alert("Please enter your correspondance address");
		document.getElementById('AccommodationCorrAddress').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('AccommodationPermanentCountry').value)) 
	{
		alert("Please enter your country");
		document.getElementById('AccommodationPermanentCountry').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('AccommodationCorrCountry').value)) 
	{
			alert("Please enter your country");
		document.getElementById('AccommodationCorrCountry').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('AccommodationPermanentPhone').value)) 
	{
		alert("Please enter telephone no");
		document.getElementById('AccommodationPermanentPhone').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('AccommodationCorrPhone').value)) 
	{
		alert("Please enter telephone no");
		document.getElementById('AccommodationCorrPhone').focus();
		return false;
	}	
	if (isEmpty(document.getElementById('AccommodationEmail').value)) 
	{
		alert("Please enter your email id");
		document.getElementById('AccommodationEmail').focus();
		return false;
	}	
	if(!validateEmail(document.getElementById('AccommodationEmail').value)) 
	{
		alert("Please enter valid email address.");
		document.getElementById('AccommodationEmail').focus();
		return false;
	}
		if (isEmpty(document.getElementById('AccommodationCourse').value)) 
	{
		alert("Please select your course");
		document.getElementById('AccommodationCourse').focus();
		return false;
	}	
		if (isEmpty(document.getElementById('start').value)) 
	{
		alert("Please enter course start date");
		document.getElementById('start').focus();
		return false;
	}	
		if (isEmpty(document.getElementById('enddate').value)) 
	{
		alert("Please enter course end date");
		document.getElementById('enddate').focus();
		return false;
	}	
	if (document.accommodation.type_accommodation_HostFamily.checked==false) 
	{
		if (document.accommodation.type_accommodation_SelfCatering.checked==false) 
		{
			alert("please select the type of accommodation");
			document.getElementById('type_accommodation_HostFamily').focus();
			return false;
		}
	}	
	if (document.accommodation.share_room_Yes.checked==false) 
	{
		if (document.accommodation.share_room_No.checked==false) 
		{
			alert("please select whether you want to share a room");
			document.getElementById('share_room_Yes').focus();
			return false;
		}
	}	
	if (document.accommodation.vegetarian_Yes.checked==false) 
	{
		if (document.accommodation.vegetarian_No.checked==false) 
		{
			alert("please select whether you are vegetarian or not");
			document.getElementById('vegetarian_Yes').focus();
			return false;
		}
	}	
	if (document.accommodation.food_canteat_Yes.checked==false) 
	{
		if (document.accommodation.food_canteat_No.checked==false) 
		{
			alert("please enter if there are any foods you cant eat");
			document.getElementById('food_canteat_Yes').focus();
			return false;
		}
	}	
	if (document.accommodation.medical_prob_Yes.checked==false) 
	{
		if (document.accommodation.medical_prob_No.checked==false) 
		{
			alert("Do you have medical problems");
			document.getElementById('medical_prob_Yes').focus();
			return false;
		}
	}	
	if (document.accommodation.smoke_Yes.checked==false) 
	{
		if (document.accommodation.smoke_No.checked==false) 
		{
			alert("Do you smoke");
			document.getElementById('smoke_Yes').focus();
			return false;
		}
	}	
	if (document.accommodation.live_smokers_Yes.checked==false) 
	{
		if (document.accommodation.live_smokers_No.checked==false) 
		{
			alert("Are you willing to live in a household with smokers?");
			document.getElementById('live_smokers_Yes').focus();
			return false;
		}
	}	
	if (document.accommodation.travel_overseas_Yes.checked==false) 
	{
		if (document.accommodation.travel_overseas_No.checked==false) 
		{
			alert("Have you travelled overseas before?");
			document.getElementById('travel_overseas_Yes').focus();
			return false;
		}
	}	
	if (document.accommodation.visit_before_Yes.checked==false) 
	{
		if (document.accommodation.visit_before_No.checked==false) 
		{
			alert("Have you visited this country before?");
			document.getElementById('visit_before_Yes').focus();
			return false;
		}
	}	
		
  }