function toggleBlock(d, i)
{
	var e = document.getElementById(d);
	var img = document.getElementById(i);
	if (!e)return;
	if (e.style.display == "block"){
		e.style.display = "none";
		img.src = "images/expand.gif";
	} else {
		e.style.display = "block";
		img.src = "images/collapse.gif";
	}
}
function more(list, div, moretext)
{
	if(list.value == "more"){
		document.getElementById(div).style.visibility = "visible";
		document.getElementById(moretext).value = "";
		//document.MainForm.moretext.value = "";
	} else {
		document.getElementById(div).style.visibility = "hidden";
		document.getElementById(moretext).value =list.value;
		//document.MainForm.moretext.value = list.value;
	}	
}
function toggleBlock1(d, i)
{
	var e = document.getElementById(d);
	var img = document.getElementById(i);
	if (!e)return;
	if (e.style.display == "block"){
		e.style.display = "none";
		img.src = "images/expand1.gif";
	} else {
		e.style.display = "block";
		img.src = "images/collapse1.gif";
	}
}
//// 
var emsg = "The field must not be empty";
function validatePersonal(s)
{
	var mv = new Validator("MainForm");
	var v_arr = [
		"isNotEmpty,firstname,Passenger Name,"+emsg,
		"isNotEmpty,lastname,Passenger Surname,"+emsg,
		/*"isNotEmpty,birthdate,Date of Birth,Select a date from the calendar",*/
		"isNotEmpty,nationality,Nationality,"+emsg,
		"IsValidEmail,email,E-mail,Not a valid email address"
	];
	var str = mv.validate(v_arr);
	if (str.length > 0) { 
		alert(str);
		return false;
	}
	if (s){
		document.MainForm.stype.value = "addperson";
		document.MainForm.submit();
	}
	return true;
}
function validateBooking(s)
{
	var mv = new Validator("MainForm");
	var v_arr = [
		"isNotEmpty,dest_country,Destination Country,"+emsg,
		"isNotEmpty,dest_city,Destination City,"+emsg,
		/*"isNotEmpty,airline,Desied Airline, Select from the list or specify your choice in the appropriate text field",*/
		"isNotEmpty,departureDate,Departure Date,Select a date from the calendar",
		"isNotEmpty,returnDate,Return Date,Select a date from the calendar"
	];
	var str = mv.validate(v_arr);
	if (str.length > 0) { 
		alert(str);
		return false;
	}
	if (s){
		document.MainForm.stype.value = "adddestination";
		document.MainForm.submit();
	}
	return true;	
}
function submitHotel()
{
	document.MainForm.stype.value = "addhotel";
	document.MainForm.submit();
}



function validatehotels(s)
{
	var mv = new Validator("MainForm");
	var v_arr = [
		"isNotEmpty,checkin,Check In,Select a date from the calendar",
		"isNotEmpty,checkout,Check Out,Select a date from the calendar"
	];
	var str = mv.validate(v_arr);
	if (str.length > 0) { 
		alert(str);
		return false;
	}
	if (s){
		document.MainForm.stype.value = "hotels";
		document.MainForm.submit();
	}
	return true;
	}




function validateAll()
{
	if (false!=isPerson){
		if (isNotEmpty(document.MainForm.firstname)){
			if (!validatePersonal(0)){
				return false;
			}
		}
	} else {
		if (!validatePersonal(0)){
			return false;
		}
	}

	if (false!=isDestination){
		if (isNotEmpty(document.MainForm.dest_country)){
			if(!validateBooking(0)){
				return false;
			}
		}
	} else {
		if(!validateBooking(0)){
			return false;
		}
	}
	return true;
}

