_action = "";
_countryname="";
_reiseartname="";
_countryID = 0;
_reiseartID = 0;
_id = 0;



function ReisefinderShrink(idSelectBox) {
	var _url = "/web/skripte/dsp_reisefinder.cfm"
	var _queryString = getQueryString(idSelectBox);

		new Ajax.Request("/web/skripte/session_updater.cfm"+getQueryString(idSelectBox)); 

		new Ajax.Request(_url+_queryString, {   
		onSuccess: ShrinkSuccess,
		onFailure: ShrinkFailure,
		onCreate : ShrinkCreate,
		onComplete:ShrinkComplete
		}); 

}



function ShrinkSuccess(transport)	{
	var container = $('reisefinder');
   	var content = transport.responseText; 
   	container.update(content);
}

function ShrinkFailure(transport)	{
	var container = $('reisefinder');
   	var content = transport.responseText; 
   	container.update(content);
}

function ShrinkCreate() {
	$("loader").show();
}

function ShrinkComplete() {
	$("loader").hide();
	
	this.tabController = new TabController(getIdLand(), getIdReiseart());
	this.tabController.update();
}


/*
	Returns the id of Selected reiseart,
	from the shrinkingbox of Übersichtseite
*/
function getIdReiseart() {
	var selObj = document.getElementById('reiseartId');
	return selObj.options[selObj.selectedIndex].value
}

/*
	Returns the id of Selected Country,
	from the shrinkingbox of Übersichtseite
*/
function getIdLand() {
	var selObj = document.getElementById('landId');
	return selObj.options[selObj.selectedIndex].value
}

function getQueryString(idSelectBox) {

	var _queryString = "";
	if(idSelectBox == "landId") {
		var selObj = document.getElementById('landId');
		var selObjRA = document.getElementById('reiseartId');
		var countryID = selObj.options[selObj.selectedIndex].value;
		var countryname = selObj.options[selObj.selectedIndex].text;
		
		//_queryString = _queryString +"/idLand/"+countryID+"/idReiseart/-1/abreisedatum/-1";		
		_queryString = _queryString +"/idLand/"+countryID+"/idReiseart/"+selObjRA.options[selObjRA.selectedIndex].value+"/abreisedatum/-1";		
		_countryname = countryname;
		_countryID = countryID
		_reiseartname = "";
	}
	else if(idSelectBox == "reiseartId") {
		var selObj = document.getElementById('landId');
		var countryID = selObj.options[selObj.selectedIndex].value;
		var countryname = selObj.options[selObj.selectedIndex].text;

		_queryString = _queryString +"/idLand/"+countryID;	
		selObj = document.getElementById('reiseartId');
		_queryString = _queryString +"/idReiseart/"+selObj.options[selObj.selectedIndex].value+"/abreisedatum/-1";	
		_reiseartname = selObj.options[selObj.selectedIndex].text;
		_reiseartID = selObj.options[selObj.selectedIndex].value;
		_countryID = countryID
		_countryname = countryname;
		
	}
	else {
		var selObj = document.getElementById('landId');
		_queryString = _queryString +"/idLand/"+selObj.options[selObj.selectedIndex].value;	
		selObj = document.getElementById('reiseartId');
		_queryString = _queryString +"/idReiseart/"+selObj.options[selObj.selectedIndex].value;	
		selObj = document.getElementById('abreisedatum');
		_queryString = _queryString +"/abreisedatum/"+selObj.options[selObj.selectedIndex].value;	
	}

	return _queryString+"/init/1";
}



function SucheSuccess(transport) {
	var idObjekt = transport.responseText.strip()
	if( idObjekt != -1) {
		window.location.href ="/web/index.cfm/pm/detail/idObjekt/"+idObjekt
	} else {
		document.getElementById("reisecode_error").style.display='block';
	}
	
}

function suchen() {
	var _url = "/web/index.cfm/pm/uebersicht/init/0/recherche/1";
	var _queryString = "";
	var selObj = document.getElementById('landId');
	
	if(selObj.options[selObj.selectedIndex].value != -1)
		_queryString = _queryString +"/idLand/"+selObj.options[selObj.selectedIndex].value;	
	
	selObj = document.getElementById('reiseartId');
	if(selObj.options[selObj.selectedIndex].value != -1)
		_queryString = _queryString +"/idReiseart/"+selObj.options[selObj.selectedIndex].value;	
	
	selObj = document.getElementById('abreisedatum');
	if(selObj.options[selObj.selectedIndex].value != -1)
		_queryString = _queryString +"/abreisedatum/"+selObj.options[selObj.selectedIndex].value;	

	new Ajax.Request("/web/skripte/session_updater.cfm"+_queryString,
	{
		onComplete: function(){
			window.location.href=_url;
		}
	}); 
	
}