var ajax = new Array();
//alert("Fenster wurde geschlossen");


function getActive()
{
	var activeopt=new Array();
	for (i = 0; i < document.suche.Land.length; ++i)
		if (document.suche.Land.options[i].selected == true)
			activeopt[0]=document.suche.Land.options[i].value;
	for (i = 0; i < document.suche.Akt.length; ++i)
		if (document.suche.Akt.options[i].selected == true)
			activeopt[1]=document.suche.Akt.options[i].value;
	return activeopt;
}

function getAktList(sel)
{
	actives=getActive();
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('Akt').options.length = 0;	// Empty city select box
	var sel = document.suche.Akt;
	while (sel.firstChild) {
	sel.removeChild(sel.firstChild);
	}
	
	
	if(countryCode.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		//alert("R: "+actives[1]+"- L:"+countryCode);
		ajax[index].requestFile = '../../php/ajax/getAkt.php?id='+countryCode+'&active='+actives[1];	// Specifying which file to get
		ajax[index].onCompletion = function(){ createAkt(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function createAkt(index)
{
	var obj = document.getElementById('Akt');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}

function getLandList(sel)
{
	actives=getActive();
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('Land').options.length = 0;	// Empty city select box
	var sel = document.suche.Land;
	while (sel.firstChild) {
	sel.removeChild(sel.firstChild);
	}
	
	if(countryCode.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		//alert("R: "+countryCode+"- L:"+actives[0]);
		ajax[index].requestFile = '../../php/ajax/getLand.php?id='+countryCode+'&active='+actives[0];	// Specifying which file to get
		ajax[index].onCompletion = function(){ createLand(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function createLand(index)
{
	var obj = document.getElementById('Land');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}

