function change_search_tab(tab_id, url){
	ob1 = document.getElementById("search_tab_" + search_current);
	ob2 = document.getElementById("search_tab_" + tab_id);
	search_current	= tab_id;
	ob1.className	= "";
	ob2.className	= "current";
	load_data(url, "form_search");
}

function change_domestic(id){
	frm = document.search_data;
	ob1 = document.getElementById("domestic_0");
	ob2 = document.getElementById("domestic_1");
	if(id == 0){
		ob1.className = "current";
		ob2.className = "";
		frm.domestic.value = 0;
		load_data("load_location.php?domestic=0", "location");
	}
	else{
		ob1.className = "";
		ob2.className = "current";
		frm.domestic.value = 1;
		load_data("load_location.php?domestic=1", "location");
	}
}

function change_car_type(id, return_date, return_time, duration, from, to, from_city, to_city){
	frm = document.search_data;
	ob1 = document.getElementById("type_0");
	ob2 = document.getElementById("type_1");
	if(id == 0){
		ob1.className = "current";
		ob2.className = "";
		frm.type.value = 0;
		load_data("load_car_return.php?return=" + return_date + "&return_time=" + return_time, "car_return_duration");
		load_data("load_car_from_to.php?from=" + from + "&to=" + to, "car_from_to");
		
		document.getElementById("roundtrip_0").disabled = false;
		document.getElementById("roundtrip_1").disabled = false;
	}
	else{
		ob1.className = "";
		ob2.className = "current";
		frm.type.value = 1;
		load_data("load_car_duration.php?duration=" + duration, "car_return_duration");
		load_data("load_car_from_to_city.php?from_city=" + from_city + "&to_city=" + to_city, "car_from_to");
		
		document.getElementById("roundtrip_0").disabled = true;
		document.getElementById("roundtrip_1").disabled = true;
	}
}

function car_return_date(id){
	ob1 = document.getElementById("return");
	ob2 = document.getElementById("return_time");
	ob1.className = (id == 0) ? "form_control_disabled" : "form_control";
	ob2.className = (id == 0) ? "form_control_disabled" : "form_control";
}

function round_trip(id){
	ob1 = document.getElementById("return");
	ob1.className = (id == 0) ? "form_control_disabled" : "form_control";
}

function check_search_air(){
	frm = document.search_data;
	if(frm.from.value == 0){alert("Please select departure."); frm.from.focus(); return false;}
	if(frm.to.value == 0){alert("Please select arrival."); frm.to.focus(); return false;}
	if(frm.children.value == 0 && frm.adult.value == 0){alert("Please enter quantity."); return false;}
	frm.submit();
}

function check_search_car(){
	frm = document.search_data;
	//if(frm.brand.value == 0){alert("Please select car brand."); frm.brand.focus(); return false;}
	if(frm.type.value == 0){
		if(frm.from.value == 0){alert("Please select airport."); frm.from.focus(); return false;}
		if(frm.to.value == 0){alert("Please select destination."); frm.to.focus(); return false;}
	}
	else{
		if(frm.from_city.value == 0){alert("Please select departure."); frm.from_city.focus(); return false;}
		if(frm.to_city.value == 0){alert("Please select destination."); frm.to_city.focus(); return false;}
	}
	frm.submit();
}

function check_search_train(){
	frm = document.search_data;
	//if(frm.train.value == 0){alert("Please select train type."); frm.train.focus(); return false;}
	if(frm.from.value == 0){alert("Please select departure."); frm.from.focus(); return false;}
	if(frm.to.value == 0){alert("Please select destination."); frm.to.focus(); return false;}
	if(frm.from.value == frm.to.value){alert("Please select other destination."); frm.to.focus(); return false;}
	if(frm.children.value == 0 && frm.adult.value == 0){alert("Please enter numbers of adults and children."); return false;}
	frm.submit();
}