
function myOnItemSelect_abf(sType, aArgs) {
	// document.getElementById('abfort_num').innerHTML = aArgs[2][1];
	newobj = new Option('AutoSuggest-AbfOrt', aArgs[2][1], true, true);
	// funktioniert nicht mit IE6!
	// document.forms['eingabe'].abfort.options[document.forms['eingabe'].abfort.length] = newobj;
	document.forms['eingabe'].abfort.appendChild(newobj);
}

function myOnItemSelect_ziel(sType, aArgs) {
	// document.getElementById('zielort_num').innerHTML = aArgs[2][1];
	newobj = new Option('AutoSuggest-ZielOrt', aArgs[2][1], true, true);
	// funktioniert nicht mit IE6!
	// document.forms['eingabe'].zielort.options[document.forms['eingabe'].zielort.length] = newobj;
	document.forms['eingabe'].zielort.appendChild(newobj);
}


// die dropdowns haben einen Rand, der muss versteckt werden, wenn sie nicht sichtbar sind
function myOnContainerExpand_abf(aArgs) {
	// document.getElementById('abfort_res').style.border = '1px solid #000';
	document.getElementById('abfort_res').style.visibility = 'visible';
}
function myOnContainerCollapse_abf(aArgs) {
	document.getElementById('abfort_res').style.visibility = 'hidden';
}
function myOnContainerExpand_ziel(aArgs) {
	document.getElementById('zielort_res').style.visibility = 'visible';
}
function myOnContainerCollapse_ziel(aArgs) {
	document.getElementById('zielort_res').style.visibility = 'hidden';
}


function myOnDataRequest_abf(aArgs) {
	document.getElementById('abfort_spinner').style.visibility = 'visible';
}
function myOnDataReturn_abf(aArgs) {
	document.getElementById('abfort_spinner').style.visibility = 'hidden';
}
function myOnDataRequest_ziel(aArgs) {
	document.getElementById('zielort_spinner').style.visibility = 'visible';
}
function myOnDataReturn_ziel(aArgs) {
	document.getElementById('zielort_spinner').style.visibility = 'hidden';
}


/*
function myQuery_abf(oSelf, oParent, sQuery) {
	oParent.scriptQueryAppend = oSelf.scriptQueryAppend + "&bla=blubb";
}
*/


/* 
function makeautosuggest_abf(element, targetdiv, land_obj) {
 var maxEntries = 20;
 var resultFormat = ['data', 'name', 'id', 'bl', 'land'];
 var land = land_obj.options[land_obj.selectedIndex].value;
// alert(land);
 var minQL = (land=='D') ? 2 : 1;

 abfort_xhr = new YAHOO.widget.DS_XHR('/index_backend.php', resultFormat);
 abfort_xhr.responseType = YAHOO.widget.DS_XHR.prototype.TYPE_JSON;
 abfort_xhr.maxCacheEntries = 0;
 abfort_xhr.scriptQueryAppend = 'sub_str=0&land='+land+'&limit='+maxEntries;
 abfort_xhr.queryMatchSubset = false;
 abfort_xhr.queryMatchContains = false;
 var abfort_ac = new YAHOO.widget.AutoComplete(
 	document.getElementById(element), 
	document.getElementById(targetdiv),
	abfort_xhr);
// abfort_ac.forceSelection = true;
 abfort_ac.minQueryLength = minQL;
// abfort_ac.queryDelay = 1;
 abfort_ac.maxResultsDisplayed = maxEntries;
 abfort_ac.highlightClassName = 'ac_highlight';
 abfort_ac.prehighlightClassName = 'ac_highlight_pre';

 abfort_ac.formatResult = function(oResultItem, sQuery) {
	var sKey = oResultItem[0];
	var nQuantity = oResultItem[1];
	var sQueryL = sQuery.toLowerCase();
	var oResTL = oResultItem[0].replace(sQuery, "<u>"+sQuery+"</u>");
	var aMarkup = [
	    oResTL.replace(sQueryL, "<u>"+sQueryL+"</u>"),
	    ];
	return (aMarkup.join(""));
 };

 abfort_ac.itemSelectEvent.subscribe(myOnItemSelect_abf);
 abfort_ac.containerExpandEvent.subscribe(myOnContainerExpand_abf);
 abfort_ac.containerCollapseEvent.subscribe(myOnContainerCollapse_abf);
 abfort_ac.dataRequestEvent.subscribe(myOnDataRequest_abf);
 abfort_ac.dataReturnEvent.subscribe(myOnDataReturn_abf);

// abfort_xhr.queryEvent.subscribe(myQuery_abf);
}


function makeautosuggest_ziel(element, targetdiv, land_obj) {
 var maxEntries = 20;
 var resultFormat = ['data', 'name', 'id', 'bl', 'land'];
 var land = land_obj.options[land_obj.selectedIndex].value;
 var minQL = (land=='D') ? 2 : 1;

 zielort_xhr = new YAHOO.widget.DS_XHR('/index_backend.php', resultFormat);
 zielort_xhr.responseType = YAHOO.widget.DS_XHR.prototype.TYPE_JSON;
 zielort_xhr.maxCacheEntries = 0;
 zielort_xhr.scriptQueryAppend = 'sub_str=0&land='+land+'&limit='+maxEntries;
 zielort_xhr.queryMatchSubset = false;
 zielort_xhr.queryMatchContains = false;
 var zielort_ac = new YAHOO.widget.AutoComplete(
 	document.getElementById(element), 
	document.getElementById(targetdiv),
	zielort_xhr);
// zielort_ac.forceSelection = true;
 zielort_ac.minQueryLength = minQL;
// zielort_ac.queryDelay = 1;
 zielort_ac.maxResultsDisplayed = maxEntries;
 zielort_ac.highlightClassName = 'ac_highlight';
 zielort_ac.prehighlightClassName = 'ac_highlight_pre';

 zielort_ac.formatResult = function(oResultItem, sQuery) {
	var sKey = oResultItem[0];
	var nQuantity = oResultItem[1];
	var sQueryL = sQuery.toLowerCase();
	var oResTL = oResultItem[0].replace(sQuery, "<u>"+sQuery+"</u>");
	var aMarkup = [
	    oResTL.replace(sQueryL, "<u>"+sQueryL+"</u>"),
	    ];
	return (aMarkup.join(""));
 };

 zielort_ac.itemSelectEvent.subscribe(myOnItemSelect_ziel);
 zielort_ac.containerExpandEvent.subscribe(myOnContainerExpand_ziel);
 zielort_ac.containerCollapseEvent.subscribe(myOnContainerCollapse_ziel);
 zielort_ac.dataRequestEvent.subscribe(myOnDataRequest_ziel);
 zielort_ac.dataReturnEvent.subscribe(myOnDataReturn_ziel);
 // zielort_ac.textboxFocusEvent.subscribe(myFocus_ziel);
}
*/
