function validateformSearch (form) {
	var text1 = $('error_length').value;
	var check_date_error = $('error_date').value;
	var err_date_today = $('error_date_today').value;

	if($('search_hotelcode') && $('search_hotelcode') != '') {

	} else {

		if (($('ville')) && ($('ville').type!== '')) {
			if ($('ville').type=='hidden' && ($('search_city').value.length<2 || $('search_city').value.replace(/ /g,'') == '') ) {
				$('search_city').focus();
				alert(text1);
				return false;
			}
			else if (($('search_city').value.length<2 || $('search_city').value.replace(/ /g,'') == '') && ( $('ville')[0].checked==true  ) ){
				$('search_city').focus();
				alert(text1);
				return false;
			}
		}
		else {
			if ( $('search_city').value.length<2 || $('search_city').value.replace(/ /g,'') == '' ) {
				$('search_city').focus();
				alert(text1);
				return false;
			}
		}
	}

	if (!$('nr_adults').value) {
		alert('Please select the number of adults!');
		return false;
	}

	if ((form.arrivalDay.value!=0)) {

		var apices=$('arrivalMonthYear').value.split('-');
		var arrivalMonth = apices[0];
		var arrivalYear = apices[1];

		var dpices=$('departMonthYear').value.split('-');
		var departMonth = dpices[0];
		var departYear = dpices[1];

		var sdate=arrivalMonth+'/'+form.arrivalDay.value+'/'+arrivalYear+' 23:00:00';

		var myDate = new Date()
		var startTimest=myDate.setTime(Date.parse(sdate));

		var edate=departMonth+'/'+form.departDay.value+'/'+departYear+' 23:00:00';
		var endTimest=myDate.setTime(Date.parse(edate));

		var today = new Date();
		var todayTimest=today.setTime(Date.parse(today));

		if (startTimest> endTimest ) {
			alert (check_date_error);
			return false;
		}
		if (startTimest < todayTimest) {
			alert (err_date_today);
			return false;
		}

		if (form.nr_night.value>30) {
			alert($('errormsg').value);
			return false;
		}
	}
	return true;

}


function change_prefix(id, text){
	if($('phone_prefix'))
		$('phone_prefix').value=id;
	if($('mobile_prefix'))
		$('mobile_prefix').value=id;
	if ($('fax_prefix'))
		$('fax_prefix').value=id;
	if ($('text_country'))
		$('text_country').value=text;
}
