function ChooseCountry_small(obiect, alter, topdd, leftdd, innertxt){
	document.getElementById('whatis').innerHTML = innertxt;
	StatusObiect('cities_small2','off');
	id=obiect;
	StatusObiect('choose_airport_small','on');
	document.getElementById('cities_small').innerHTML  = '';
	document.getElementById('submit_city_small').innerHTML  = '';
	document.getElementById('iframe').style.display = 'block';
	loadAjaxData('countrys_small','http://www.rezervarebileteavion.ro/get_country.php?obiect='+obiect+'&alter='+alter);
	if(topdd != '0'){
		document.getElementById('choose_airport_small').style.top = 0;
	}
	document.getElementById('iframe').style.left = 100;
	document.getElementById('iframe').style.top = 50;
	//window.open('airport.php?identif='+identif,'','width=500,height=500,scrollbars=no');
}

function ChooseCountry_small2(obiect, alter, topdd, leftdd, innertxt){
	document.getElementById('whatis').innerHTML = innertxt;
	StatusObiect('cities_small2','off');
	id=obiect;
	StatusObiect('choose_airport_small','on');
	document.getElementById('cities_small').innerHTML  = '';
	document.getElementById('submit_city_small').innerHTML  = '';
	document.getElementById('iframe').style.display = 'block';
	loadAjaxData('countrys_small','http://www.rezervarebileteavion.ro/get_country2.php?obiect='+obiect+'&alter='+alter);
	if(topdd != '0'){
		document.getElementById('choose_airport_small').style.top = 0;
	}
	document.getElementById('iframe').style.left = 100;
	document.getElementById('iframe').style.top = 10;
	//window.open('airport.php?identif='+identif,'','width=500,height=500,scrollbars=no');
}


function StatusObiect(obiect,identif){
	document.getElementById(obiect).className=identif;
	if(identif == 'off'){
		document.getElementById('iframe').style.display = 'none';
	}
}

function SelectCity(id,identif,obiect){
	if(identif == 'oras_plecare_small'){
		loadAjaxData('cities_small','http://www.rezervarebileteavion.ro/get_city.php?obiect='+obiect+'&id='+id);
	} else {
		loadAjaxData('cities_small','http://www.rezervarebileteavion.ro/get_city.php?obiect='+obiect+'&id='+id);
	}
	StatusObiect('choose_airport_small','on');
}

function SelectCity2(id,identif,obiect){
	if(identif == 'oras_plecare_small'){
		loadAjaxData('cities_small','http://www.rezervarebileteavion.ro/get_city2.php?obiect='+obiect+'&id='+id);
	} else {
		loadAjaxData('cities_small','http://www.rezervarebileteavion.ro/get_city2.php?obiect='+obiect+'&id='+id);
	}
	StatusObiect('choose_airport_small','on');
}


function SelectAiroport(id,identif,obiect){
	if(identif == 'oras_plecare_small'){
		loadAjaxData('cities_small2','http://www.rezervarebileteavion.ro/get_airoport.php?obiect='+obiect+'&id='+id);
	} else {
		loadAjaxData('cities_small2','http://www.rezervarebileteavion.ro/get_airoport.php?obiect='+obiect+'&id='+id);
	}
	StatusObiect('choose_airport_small','on');
	StatusObiect('cities_small2','on');
}

function update_ok(obiect){
		document.getElementById('submit_city_small').innerHTML  = "<a href=\"#\" onclick=\"setCity(document.getElementById('all_cities').value,'"+obiect+"');return false;\">OK</a>";
}

function update_ok2(obiect){
		document.getElementById('submit_city_small').innerHTML  = "<a href=\"#\" onclick=\"setCity(document.getElementById('all_airo').value,'"+obiect+"');return false;\">OK</a>";
}

function setCity(id_city,identif)
{
		if(identif == '1'){
				myidi = document.forms[0].External_FlightFareSearch_From;
		} else if(identif == '2'){
				myidi = document.forms[0].External_FlightFareSearch_To;
		} else if(identif == '3'){
				myidi = document.forms[0].External_HotelSearch_City;
		} else if(identif == '4'){
				myidi = document.forms[0].External_CarSearch_PickUpLocation;
		} else if(identif == '5'){
				myidi = document.forms[0].External_CarSearch_DropOffLocation;
		}
		myidi.value = id_city;
		StatusObiect('choose_airport_small','off');
}


function loadAjaxData(elementId, url, ins){
	var req = null;
	if(ins != 1){
		document.getElementById(elementId).innerHTML = "Se incarca...";
	}

	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
		if (req.overrideMimeType)
			req.overrideMimeType('text/html');
	}
	else
	if (window.ActiveXObject) {
		try {
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e)
		{
			try {
				req = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}

	req.onreadystatechange = function() {
		if(ins != 1){
			document.getElementById(elementId).innerHTML = "Va rugam asteptati...";
		}
		if (req.readyState == 4) {
			if (req.status == 200) {
			    //alert(req.responseText);
				if(ins != 1) {
					document.getElementById(elementId).innerHTML  = req.responseText;
				} else {
					document.getElementById(elementId).value = req.responseText;
				}
			}
			else
				document.getElementById(elementId).innerHTML="Eroare la incarcare (code " + req.status + " " + req.statusText + ")";
		}
	};

	req.open("GET", url, true);
	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	req.send(null);
}

function alert_date_return(date){
	loadAjaxData('External_FlightFareSearch_ReturnDate','http://www.rezervarebileteavion.ro/return_date.php?date='+date, '1');
}
function launch_support_1_0(){
	var request_url_1_0 = "http://www.perfect-tour.ro/livesupport/request.php?l=razvanm&x=1&deptid=0&page=www.rezervarebileteavion.ro" ;
	newwin = window.open( request_url_1_0, 1, 'scrollbars=no,menubar=no,resizable=0,location=no,screenX=50,screenY=100,width=450,height=400' ) ;
	newwin.focus() ;
}
