var on=0;
var zahl=0;

// Ergebnisse sortieren
function tableSort_region(col, anz, mandant) {
    if (col=="")
        col=column;
    if (col=="country") {
        order="country";
        for(i=0; i<anz; i++)
        {
            arr[i].sort(stringComparison);
            if (direction_country=="DESC")
                arr[i].reverse();
        }
        if (direction_country=="ASC")
            direction_country = "DESC";
        else
            direction_country = "ASC";
        direction_prper = "ASC";
        column = "prper";
    } else {
        order="prper";
        for(i=0; i<anz; i++)
        {
            arr[i].sort(cmpnum);
            if (direction_prper=="DESC")
                arr[i].reverse();
        }
        if (direction_prper=="ASC")
            direction_prper = "DESC";
        else
            direction_prper = "ASC";
        direction_country = "ASC";
        column = "country";
    }
    for(i=0; i<anz; i++)
    {
        for(ii=0; ii<arr_tags[i].length; ii++) {;
            document.getElementById(arr_tags[i][ii].id).innerHTML=arr[i][ii].headline;
            document.getElementById(arr_tags[i][ii].id_prper).innerHTML=arr[i][ii].f_prper;
        }
    }
    // Sortierungsicon definieren
    iconAZ = 'az_aktiv.gif';
    iconPrice = 'eur_aktiv.gif';
    if (mandant == "ch") {
        iconAZ = 'az_aktiv_franken.gif';
        iconPrice = 'franken_aktiv.gif';
    }
    if (col=="country")
      if (document.getElementById("sortregion_az_gif"))
        document.getElementById("sortregion_az_gif").src="images/ic/" + iconAZ;
    if (col=="prper")
      if (document.getElementById("sortregion_az_gif"))
        document.getElementById("sortregion_az_gif").src="images/ic/" + iconPrice;
}
function tableSort(col, mandant) {
    if (col=="")
        col=column;
    if (col=="country") {
        order="country";
        arr.sort(stringComparison);
        if (direction_country=="DESC")
            arr.reverse();
        if (direction_country=="ASC")
            direction_country = "DESC";
        else
            direction_country = "ASC";
        direction_prper = "ASC";
        column = "prper";
    } else {
        order="prper";
        arr.sort(cmpnum);
        if (direction_prper=="DESC")
            arr.reverse();
        if (direction_prper=="ASC")
            direction_prper = "DESC";
        else
            direction_prper = "ASC";
        direction_country = "ASC";
        column = "country";
    }
    for(ii=0; ii<arr_tags.length; ii++) {
        document.getElementById(arr_tags[ii].id).innerHTML=arr[ii].headline;
        document.getElementById(arr_tags[ii].id_prper).innerHTML=arr[ii].f_prper;
    }
    // Sortierungsicon definieren
    iconAZ = 'az_aktiv.gif';
    iconPrice = 'eur_aktiv.gif';
    if (mandant == "ch") {
        iconAZ = 'az_aktiv_franken.gif';
        iconPrice = 'franken_aktiv.gif';
    }
    if (col=="country")
      if (document.getElementById("sort_az_gif"))
        document.getElementById("sort_az_gif").src="images/ic/" + iconAZ;
    if (col=="prper")
      if (document.getElementById("sort_az_gif"))
        document.getElementById("sort_az_gif").src="images/ic/" + iconPrice;
}

function stringComparison(a, b) {
    try {
	a.country = a.country.toLowerCase();
	a.country = a.country.replace(/ä/g,"a");
	a.country = a.country.replace(/ö/g,"o");
	a.country = a.country.replace(/ü/g,"u");
	a.country = a.country.replace(/ß/g,"s");

	b.country = b.country.toLowerCase();
	b.country = b.country.replace(/ä/g,"a");
	b.country = b.country.replace(/ö/g,"o");
	b.country = b.country.replace(/ü/g,"u");
	b.country = b.country.replace(/ß/g,"s");
    } catch (e) {
    }
    return(a.country==b.country)?0:(a.country>b.country)?1:-1;
}
function cmpnum(inp1, inp2) {
    return inp1.prper-inp2.prper;
}
// Schnellnavigation.
function MM_jumpMenu(targ,selObj,restore){
  eval(targ+".location=\'"+selObj.options[selObj.selectedIndex].value+"\'");
  if (restore) selObj.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}

function fensterschliessen() {
  window.opener.location.href ="/shop.htm";
  this.window.close();
}
// Newsletter-Abo
function submitForm(){
var check = false;
  for (var i = 0; i < document.theForm.ABFLUG.length; i++){
    if(document.theForm.ABFLUG[i].checked){
      check = true;
      break;
    }
  }
  if(check == false){
    alert("Lieber L'TUR Kunde,\nBitte waehlen Sie einen Abflughafen.\nVielen Dank.");
    document.theForm.ABFLUG[0].focus();
    return;
  }
  if(document.theForm.EMAIL.value == ""){
    alert("Lieber L'TUR Kunde,\nBitte geben Sie Ihre E-Mail-Adresse ein wenn Sie die Last-Minute-Mail abbestellen moechten.\nVielen Dank.");
    document.theForm.EMAIL.focus();
    document.theForm.EMAIL.select();
    return;
  }
  document.theForm.submit();
}

function changeFormAction(obj, actionURL) {
  obj.action=actionURL;
  obj.submit();
}


var win = null;
function NewWindow(mypage,myname,w,h,scroll,status){
   LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
   TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
   settings =
   'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable,status='+status+''
   win = window.open(mypage,myname,settings)
}

var req;
var TempDiv;
var TempIfr;
var TempFieldname;
var TempHiddenfieldname;
var full = false;
var test = "";
var isIE = false;
var active = "";
var is_an  = false;
var thisentryCount = 0;
var thisindex      = 0;
var set = "";
var uhost = '';
var ghost = '';
var venereuhost = '';
var M_OVER_VON = "";
var DESTINATION_AUTO_COMPLETE = "";
var DESTINATION_ID = "";
var ZO_FL = "";
var DST_SHORT = "";

function initChoice(choiceDiv, choiceIfr, host)
{   
	uhost=host+'/airports';
	M_OVER_VON = 'm_over_von';
	DESTINATION_AUTO_COMPLETE = "destination_auto_complete";
	DESTINATION_ID = "destination_id";
	ZO_FL = "zo_fl";
	DST_SHORT = "dst_short";
	aus(choiceDiv, choiceIfr);	
	ghost = host; 

//	document.getElementById(choiceDiv).setAttribute("autocomplete","off");
	if (document.getElementById(DESTINATION_AUTO_COMPLETE))
	{
            if(/Safari/.test(navigator.userAgent))
                document.getElementById(DESTINATION_AUTO_COMPLETE).addEventListener("keyup",nav,false);
            if(/Gecko/.test(navigator.userAgent))
                document.getElementById(DESTINATION_AUTO_COMPLETE).addEventListener("keyup",nav,false);
            else
                document.getElementById(DESTINATION_AUTO_COMPLETE).attachEvent('keyup',nav);
	}
        if(/MSIE/.test(navigator.userAgent))  
	    isIE = true;
}

function initChoiceVenere(choiceDiv, choiceIfr, host)
{   
	venereuhost=host+'/venere_geo';
	M_OVER_VON = 'm_over_von_venere';
	DESTINATION_AUTO_COMPLETE = "destination_auto_complete_venere";
	DESTINATION_ID = "destination_id_venere";
	ZO_FL = "zo_fl_venere";
	DST_SHORT = "dst_short_venere";
	aus(choiceDiv, choiceIfr);	
	host = host;

//	document.getElementById(choiceDiv).setAttribute("autocomplete","off");
	if (document.getElementById(DESTINATION_AUTO_COMPLETE))
	{	
            if(/Safari/.test(navigator.userAgent))
                document.getElementById(DESTINATION_AUTO_COMPLETE).addEventListener("keyup",nav_venere,false);
            if(/Gecko/.test(navigator.userAgent))
                document.getElementById(DESTINATION_AUTO_COMPLETE).addEventListener("keyup",nav_venere,false);
            else
                document.getElementById(DESTINATION_AUTO_COMPLETE).attachEvent('keyup',nav_venere);
	}
        if(/MSIE/.test(navigator.userAgent))  
	    isIE = true;
}
	
function aus(what, iFR)
{	
    if ((active!="pfeil_unten") && (active!="flagge"))
    {	
    //    if(document.getElementById(what))document.getElementById(what).style.display = "none";				
        if(/MSIE/.test(navigator.userAgent))  
        {
		try	{
			document.getElementById(iFR).style.display = "none";	
			var DivRef 				= document.getElementById(what);
			var IfrRef 				= document.getElementById(iFR);
			IfrRef.style.width 		= DivRef.offsetWidth;
			IfrRef.style.height 	= DivRef.offsetHeight;	
			IfrRef.style.top 		= DivRef.style.top;
			IfrRef.style.left 		= DivRef.style.left;
			IfrRef.style.zIndex 	= DivRef.style.zIndex + 100;
			IfrRef.style.display 	= DivRef.style.display;
		} catch (e) {}
        }
        is_an = false;
        thisentryCount = 0;
        thisindex = 0;
    }
    else
    {
        is_an = true;
    }
    active = "";
}

function an(what, iFR)
{   
    if(/MSIE/.test(navigator.userAgent)) 
	if (what=="lturlanguage_auto_complete") 
            document.getElementById(what).style.top = "125px";
    document.getElementById(what).style.display = "";	
    if(/MSIE/.test(navigator.userAgent))  
    {
		try	{
			var DivRef		= document.getElementById(what);
			var IfrRef 		= document.getElementById(iFR);
			DivRef.style.display 	= "block";
			IfrRef.style.width 	= DivRef.offsetWidth;
			TEMPheight		= DivRef.offsetHeight;
			IfrRef.style.height 	= TEMPheight;			
			IfrRef.style.top 	= DivRef.style.top;
			IfrRef.style.left 	= DivRef.style.left;
			IfrRef.style.zIndex 	= DivRef.style.zIndex + 100;
			IfrRef.style.display 	= "block";
		} catch (e) {}
    }
    is_an = true;
}
	
function div_display(what, where, where_i)
{
    document.getElementById(where).innerHTML = what;	
    if(/MSIE/.test(navigator.userAgent))  
	{
		try	{
			var DivRef 		= document.getElementById(where);
			var IfrRef 		= document.getElementById(where_i);	
			DivRef.style.display 	= "block";
			IfrRef.style.width 	= DivRef.offsetWidth;
			TEMPheight		= DivRef.offsetHeight;
			IfrRef.style.height 	= TEMPheight;			
			IfrRef.style.top 	= DivRef.style.top;
			IfrRef.style.left 	= DivRef.style.left;
			IfrRef.style.zIndex 	= DivRef.style.zIndex + 100;
		} catch (e) {}
	}
}

function keylistener(what, TempDiv, TempIfr, TempFieldname, TempHiddenfieldname, TMPmultiairport, form_name) 
{
	l = 0;
	t_field = what;	
	aktDiv = TempDiv
	aktIfr = TempIfr
	fieldname = TempFieldname
	hiddenfieldname = TempHiddenfieldname
	multiairport = TMPmultiairport;
	f_name = form_name;
	
    if(/Safari/.test(navigator.userAgent))  
		document.getElementById(what).addEventListener("keyup",nav,false);
    if(/Gecko/.test(navigator.userAgent))  
		document.getElementById(what).addEventListener("keyup",nav,false);
	else 
		document.getElementById(what).attachEvent('onkeyup',nav);
}



function keylistener_venere(what, TempDiv, TempIfr, TempFieldname, TempHiddenfieldname, TMPmultiairport, form_name) 
{
	l = 0;
	t_field_venere = what;	
	aktDiv = TempDiv
	aktIfr = TempIfr
	fieldname = TempFieldname
	hiddenfieldname = TempHiddenfieldname
	multiairport = TMPmultiairport;
	f_name = form_name;
	
    if(/Safari/.test(navigator.userAgent))  
		document.getElementById(what).addEventListener("keyup",nav_venere,false);
    if(/Gecko/.test(navigator.userAgent))  
		document.getElementById(what).addEventListener("keyup",nav_venere,false);
	else 
		document.getElementById(what).attachEvent('onkeyup',nav_venere);
}



function markPrevious() {
    if(thisindex > 1) thisindex--
      else thisindex = thisentryCount;
    if (document.getElementById(M_OVER_VON))
      document.getElementById(M_OVER_VON).value = thisindex;
}
function markNext() {
    if(thisindex < thisentryCount) thisindex++
      else thisindex = 1;
    if (document.getElementById(M_OVER_VON))
      document.getElementById(M_OVER_VON).value = thisindex;
}
function render_advanced() {
    if(thisentryCount > 0) {
	for (i=1;i<=thisentryCount;i++)
        {
	    if (document.getElementById(i))
		document.getElementById(i).className = 'lc3_inv';
        }
        if (document.getElementById(thisindex))
	   document.getElementById(thisindex).className = 'lc3_Hover_inv';
    }
}
function clear_render(tindex)
{
    for (i=1;i<=thisentryCount;i++)
    {
        if (document.getElementById(i))
            document.getElementById(i).className = 'lc3_inv';
    }
    thisindex=tindex;
    if (document.getElementById(M_OVER_VON))
      document.getElementById(M_OVER_VON).value = thisindex;
    set = "clicked";
}
function checkField()
{
 if (is_an)
 {
    if (thisindex==0)
        changeField(1, aktDiv, aktIfr, fieldname, hiddenfieldname);
    else
        changeField(thisindex-1, aktDiv, aktIfr, fieldname, hiddenfieldname);
    return false;
 }
 else
 {
    return true;
 }
 document.getElementById("submitbtn").focus();
}

function nav(event) 
{
	uhost=ghost+'/airports';
	M_OVER_VON = 'm_over_von';
	DESTINATION_AUTO_COMPLETE = "destination_auto_complete";
	DESTINATION_ID = "destination_id";
	ZO_FL = "zo_fl";
	DST_SHORT = "dst_short";
	aktDiv = 'destination_auto_complete';
	aktIfr = 'destination_auto_complete_i';
	hiddenfieldname = 'zo_fl';
		
	
    if (is_an)
    {
        if (event.keyCode == 27)
	{
	   aus(aktDiv, aktIfr);
           return;
	}
	if (event.keyCode == 39)
           return;
        if (event.keyCode == 38)
        {
           markPrevious();
	   render_advanced();
           return;
        }
        if (event.keyCode == 40)
        {
           markNext();
	   render_advanced();
           return;
        }
    }
    if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 9 || event.keyCode == 13) 
    {		
        if (event.keyCode == 13) 
        {
	    // bei ENTER
	    if(t_field == DESTINATION_ID)
	    {
                if (document.getElementById('SEA_adults_FL'))
                    document.getElementById('SEA_adults_FL').focus();
	    }
	    return;
	}
    }
    else
        if(t_field == DESTINATION_ID)
	    airline_code(document.getElementById(DESTINATION_ID).value, aktDiv, aktIfr, fieldname, hiddenfieldname, multiairport, uhost);
    set = "";
}





function nav_venere(event) 
{	venereuhost=ghost+'/venere_geo';
	M_OVER_VON = 'm_over_von_venere';
	DESTINATION_AUTO_COMPLETE = "destination_auto_complete_venere";
	DESTINATION_ID = "destination_id_venere";
	ZO_FL = "zo_fl_venere";
	DST_SHORT = "dst_short_venere";
	
	aktDiv = 'destination_auto_complete_venere';
	aktIfr = 'destination_auto_complete_i_venere';
	hiddenfieldname = 'zo_fl_venere';
	
    if (is_an)
    {
        if (event.keyCode == 27)
	{
	   aus(aktDiv, aktIfr);
           return;
	}
	if (event.keyCode == 39)
           return;
        if (event.keyCode == 38)
        {
           markPrevious();
	   render_advanced();
           return;
        }
        if (event.keyCode == 40)
        {
           markNext();
	   render_advanced();
           return;
        }
    }
    if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 9 || event.keyCode == 13) 
    {		
        if (event.keyCode == 13) 
        {
	    // bei ENTER
	    if(t_field_venere == DESTINATION_ID)
	    {
                if (document.getElementById('SEA_adults_FL'))
                    document.getElementById('SEA_adults_FL').focus();
	    }
	    return;
	}
    }
    else{
        if(t_field_venere == DESTINATION_ID){
	    airline_code(document.getElementById(DESTINATION_ID).value, aktDiv, aktIfr, fieldname, hiddenfieldname, multiairport, venereuhost);
        }
    set = "";
    }
}


function airline_code(letter, aktDiv, aktIfr, fieldname, hiddenfieldname, multiairport, hostt) 
{
	set = "";
	TempDiv 		= aktDiv;
	TempIfr 		= aktIfr;
	TempFieldname 		= fieldname;
	TempHiddenfieldname 	= hiddenfieldname;
	aktDiv = 'destination_auto_complete_venere';
	
	if(letter.length == 3)
	{
		aus(aktDiv, aktIfr);
		letter = escape(letter);			
		//initVar = true;	
		initVar = false;
		load3lc('http://' + hostt + '/yff_ajax_search.php?destination=' + letter + '&multi=' + multiairport);	

	}
	if(letter.length > 3)
	{
		if(initVar == false)
		{	
			letter = escape(letter);
        	        //initVar = true;
	                initVar = false;
			load3lc('http://' + hostt + '/yff_ajax_search.php?destination=' + letter + '&multi=' + multiairport);	
		}
		var letter_comp = letter.toLowerCase();
		aus(aktDiv, aktIfr);
		if (req.readyState == 4) 
		{
			if (req.status == 200)
			{
				buildAirports(letter_comp, TempDiv, TempIfr, TempFieldname, TempHiddenfieldname);
			} 
		}
	}
	if(letter.length < 3)
	{     
		aus(aktDiv, aktIfr);
		initVar = false;	
	}
}
	
function load3lc(evt)  
{
    try 
    {
        loadXMLDoc(evt);
    }
    catch(e) 
    {
        return;
    }
}
	
function loadXMLDoc(url) 
{
    if (window.XMLHttpRequest) 
    {
        req = new XMLHttpRequest();
        req.onreadystatechange = processReqChange;           
             
       
        req.open("GET", url, true);        
        
        req.send(null);
    } 
    else if (window.ActiveXObject) 
    {
       	isIE = true;
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) 
	{
            req.onreadystatechange = processReqChange;
            req.open("GET", url, true);
            req.send();
       	}
    }
}

function processReqChange()
{
    if (req.readyState == 4) 
        if (req.status == 200)
            buildAirports("", TempDiv, TempIfr, TempFieldname, TempHiddenfieldname, f_name);
	else 
	    return;
}

	
function getElementTextNS(prefix, local, parentElem, index) 
{
    var result = "";
    if (prefix && isIE) 
        result = parentElem.getElementsByTagName(prefix + ":" + local)[index];
    else 
        try { result = parentElem.getElementsByTagName(local)[index]; } catch (e) { }
    if (result) 
        if (result.childNodes.length > 1) 
            return result.childNodes[1].nodeValue;
	else 
            return result.firstChild.nodeValue;    		
    else 
        try { return document.getElementById(DESTINATION_ID).value; } catch (e) { }
}

function buildAirports(what, aktDiv, aktIfr, fieldname, hiddenfieldname) 
{
	thisentryCount = 0;
	thisindex = 0;
	var select = "";
	if(what == "")
	{
		var full = false;		
		var tmp_land = "";
		var items = '';
		try { items = req.responseXML.getElementsByTagName("item"); } catch(e) { }
		dl = items.length;
		for (var i = 0; i < items.length; i++) 
		{
			LC_city		= getElementTextNS("", "airport", items[i], 0);			
			LC_airportname 	= getElementTextNS("", "portname", items[i], 0);
			LC_id		= getElementTextNS("", "id", items[i], 0);
			LC_code		= getElementTextNS("", "code", items[i], 0);			
			if(LC_id != "SHORT")
			{					
				full = true;
				thisentryCount++;
				select = select + "<div title=\""+i+"\" id=\"" + thisentryCount + "\" class=\"lc3_inv\" onMouseOver=\"clear_render(" + thisentryCount + "); this.className = 'lc3_Hover_inv';\" onMouseOut=\"this.className = 'lc3_inv';\" onClick=\"changeField(\'" + i + "\', \'" + aktDiv + "\', \'" + aktIfr + "\',  \'" + fieldname + "\', \'" + hiddenfieldname + "\');\">" + LC_city + "</div>";
			}
			if( LC_id == "SHORT")
			{	
				full = true;
				thisentryCount++;				
				select = select + "<div title=\""+i+"\" id=\"" + thisentryCount + "\" class=\"lc3_inv\" onMouseOver=\"clear_render(" + thisentryCount + "); this.className = 'lc3_Hover_inv';\" onMouseOut=\"this.className = 'lc3_inv';\" onClick=\"changeField(\'" + i + "\', \'" + aktDiv + "\', \'" + aktIfr + "\',  \'" + fieldname + "\', \'" + hiddenfieldname + "\');\"><b>" + LC_code + "</b> - " + LC_city + "</div>";
				if(items.length > 1)
				{
					select = select + "<hr size=\"1\" noshade>";
				}
			}			
		}
		if(full == true)
		{
			div_display(select, aktDiv, aktIfr);
			an(aktDiv, aktIfr);
		}
		else
		{
			aus(aktDiv, aktIfr);
		}
	}
	else
	{		
		var full = false;
		var tmp_land = "";
		var select = "";
                var items = '';
                try { items = req.responseXML.getElementsByTagName("item"); } catch(e) { }
		dl = items.length;
		for (var i = 0; i < items.length; i++) 
		{
			LC_city 	= getElementTextNS("", "airport", items[i], 0);
			LC_airportname 	= "";
                        LC_id           = getElementTextNS("", "id", items[i], 0);
			LC_code		= getElementTextNS("", "code", items[i], 0);			
			CompA= LC_city;
			CompA= CompA.substring(0, what.length);
			CompA= CompA.toLowerCase();
			CompB= what;
			if(CompA == CompB && LC_id != "SHORT")	
			{
				if(LC_id != "SHORT")
				{
					full = true;
					thisentryCount++;
					select = select + "<div title=\""+i+"\" id=\"" + thisentryCount + "\" class=\"lc3_inv\" onMouseOver=\"clear_render(" + thisentryCount + "); this.className = 'lc3_Hover_inv';\" onMouseOut=\"this.className = 'lc3_inv';\" onClick=\"changeField(\'" + i + "\', \'" + aktDiv + "\', \'" + aktIfr + "\', \'" + fieldname + "\', \'" + hiddenfieldname + "\');\">" + LC_city + "</div>";
				}
			}
		}				
		if(full == true)
		{
			div_display(select, aktDiv, aktIfr);
			an(aktDiv, aktIfr);
		}
		else
		{			
			aus(aktDiv, aktIfr);
		}
	}
	if (thisentryCount>0)
	{
           markNext();
           render_advanced();
	}
}

function changeField(what, aktDiv, aktIfr, fieldname, hiddenfieldname)
{	document.getElementById(DESTINATION_AUTO_COMPLETE).style.display='none';
	aus(aktDiv, aktIfr);	
        var items = '';
        try { items = req.responseXML.getElementsByTagName("item"); } catch(e) { }

	if((aktDiv == DESTINATION_AUTO_COMPLETE) && (set!="chang_ed") && (items.length>0) )
	{
	    if (document.getElementById(DESTINATION_ID))
                document.getElementById(DESTINATION_ID).value = getElementTextNS("", "airport", items[what], 0);
            if (document.getElementById(ZO_FL))
                document.getElementById(ZO_FL).value = getElementTextNS("", "code", items[what], 0);
            if (document.getElementById(DST_SHORT))
                document.getElementById(DST_SHORT).value = getElementTextNS("", "code", items[what], 0);
	    set = "clicked";
            aus(aktDiv, aktIfr);
	}	
	
}
	
function airline_short(letter, f_name) 
{
	if((f_name == 'search0')&&(set!="clicked"))
	{
		if(document.getElementById(M_OVER_VON).value == '0' && aktDiv == 'destination_auto_complete')
		{
			if(letter.length >= 3)
			{		
				letter = escape(letter);			
                		//initVar = true;
		                initVar = false;
				short_load3lc('http://' + uhost + '/yff_ajax_search.php?destination=' + letter + '&multi=' + multiairport + '&allgstr=1');
			}
		}
		else
		{
		    if (document.getElementById(M_OVER_VON).value != '0')
		    {
		        var items = '';
		        try { items = req.responseXML.getElementsByTagName("item"); } catch(e) { }

			try {
			var elemid= document.getElementById(M_OVER_VON).value;
			if (document.getElementById(elemid))
			    what = document.getElementById(elemid).title;
			else
                            what = 0;
			} catch (e) { what = 0; }
		        if(items.length>0)
			{
                	        if (document.getElementById(DESTINATION_ID))
                        	    document.getElementById(DESTINATION_ID).value = getElementTextNS("", "airport", items[what], 0);
	                        if (document.getElementById(ZO_FL))
        	                    document.getElementById(ZO_FL).value = getElementTextNS("", "code", items[what], 0);
                	        if (document.getElementById(DST_SHORT))
                        	    document.getElementById(DST_SHORT).value = getElementTextNS("", "code", items[what], 0);
			}
            		aus(aktDiv, aktIfr);
		    }
		}
            set = "chang_ed";
	}
	
}

function short_load3lc(evt)  
{
    try 
    {
        short_loadXMLDoc(evt);
    }
    catch(e) 
    {
        return;
    }
}
	
function short_loadXMLDoc(url) 
{
    if (window.XMLHttpRequest) 
    {
        req = new XMLHttpRequest();
        req.onreadystatechange = short_processReqChange;
        req.open("GET", url, true);
        req.send(null);
    } 
    else if (window.ActiveXObject) 
    {
       	isIE = true;
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) 
	{
            req.onreadystatechange = short_processReqChange;
            req.open("GET", url, true);
            req.send();
       	}
   }
}
	
function short_processReqChange()
{
    if (req.readyState == 4) 
        if (req.status == 200)
            short_buildAirports("", TempDiv, TempIfr, TempFieldname, TempHiddenfieldname);
	else 
	    return;
}
	
function short_buildAirports(what, aktDiv, aktIfr, fieldname, hiddenfieldname) 
{
	var select = "";
	if(what == "")
	{
                var items = '';
                try { items = req.responseXML.getElementsByTagName("item"); } catch(e) { }
		if(aktDiv == DESTINATION_AUTO_COMPLETE)
		{
                    if(items.length>0)
                    {
        	        if (document.getElementById(DESTINATION_ID))
	                    document.getElementById(DESTINATION_ID).value = getElementTextNS("", "airport", items[0], 0);
                	if (document.getElementById(ZO_FL))
        	            document.getElementById(ZO_FL).value = getElementTextNS("", "code", items[0], 0);
	                if (document.getElementById(DST_SHORT))
                	    document.getElementById(DST_SHORT).value = getElementTextNS("", "code", items[0], 0);
		    }
		    aus(aktDiv, aktIfr);
		}	
	}
	
}

function show_flash(name, path, file, bild, link, width, height) {
	var protokoll;
	if (document.URL.substring(0,5) == "https") {
		protokoll = "https";
	} else {
		protokoll = "http";
	}
	flag_flash = detectingFLASH(8);
	var html_output = "";
	if (flag_flash) {
                // Flash Film - Achtung <embed> Tag innerhalb von <object> Tag fÃ¼r alte NS Browser
                html_output += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="' + protokoll + '://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="' + width + '" height="' + height + '" id="'+ name +'" align="middle">';
                html_output += '<param name="allowScriptAccess" value="sameDomain" />';
                html_output += '<param name="FlashVars" value="eUrl=' + link + '"/>';
                //html_output += '<param name="movie" value="' + path + file + '" />';
                html_output += '<param name="movie" value="' + path + file + '" />';
                html_output += '<param name="quality" value="high" />';
                html_output += '<param name="wmode" value="transparent">';
                html_output += '<embed FlashVars="eUrl=' + link + '"    src="' + path + file + '" quality="high" wmode="transparent" bgcolor="#ffffff" width="' + width + '" height="' + height + '" name="' + name + '" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="' + protokoll + '://www.macromedia.com/go/getflashplayer" />';
                html_output += '</object>';
	} else {
		if (link != "") {
			html_output += '<div><a href=' + link + '><img src=' + path + bild + ' border=0 width=' + width + ' height=' + height + '></a></div>';
		} else {
			html_output += '<div><a href=http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&promoid=BIOW target=_blank><img src=' + path + bild + ' border=0 width=' + width + ' height=' + height + '></a></div>';
		}
	}
	document.writeln(html_output);
}	// of function
function openLink(link) {
	// Link oeffnet sich in neuem Fenster:
	popupWin = window.open(link, 'remote',  'menubar,toolbar,location,directories,status,scrollbars,resizable,dependent,width=810,height=610,left=50,top=50');
}

function detectingFLASH(since_version) {
	if (since_version < 3) {
		since_version = 5;
	}
	var browser = navigator.userAgent.toLowerCase();
        flashVersion = 0;

        // NS3+, Opera3+, IE5+ Mac
        if ( navigator.plugins != null && navigator.plugins.length > 0 ) {
                var flashPlugin = navigator.plugins['Shockwave Flash'];
                if ( typeof flashPlugin == 'object' ) {
                        if ( (since_version <= 9) && (flashPlugin.description.indexOf('9.') != -1) ) flashVersion = 9;
                        else if ( (since_version <= 8) && (flashPlugin.description.indexOf('8.') != -1) ) flashVersion = 8;
                        else if ( (since_version <= 7) && (flashPlugin.description.indexOf('7.') != -1) ) flashVersion = 7;
                        else if ( (since_version <= 6) && (flashPlugin.description.indexOf('6.') != -1) ) flashVersion = 6;
                        else if ( (since_version <= 5) && (flashPlugin.description.indexOf('5.') != -1) ) flashVersion = 5;
                        else if ( (since_version <= 4) && (flashPlugin.description.indexOf('4.') != -1) ) flashVersion = 4;
                        else if ( (since_version <= 3) && (flashPlugin.description.indexOf('3.') != -1) ) flashVersion = 3;
                        else flashVersion = 0;
                }
        } // IE4+ Win32 (VBscript)
        else if ( browser.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && browser.indexOf("win")!= -1 && browser.indexOf("16bit")== -1 ) {
                document.write('<scr' + 'ipt language="VBScript"\> \n');
                document.write('on error resume next \n');
                document.write('DIM obFlash \n');
                document.write('SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.9") \n');
                document.write('IF IsObject(obFlash) THEN \n');
                document.write('flashVersion = 9 \n');
                document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.8") END IF\n');
                document.write('IF IsObject(obFlash) THEN \n');
                document.write('flashVersion = 8 \n');
                document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.7") END IF\n');
                document.write('IF flashVersion < 8 and IsObject(obFlash) THEN \n');
                document.write('flashVersion = 7 \n');
                document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.6") END IF \n');
                document.write('IF flashVersion < 7 and IsObject(obFlash) THEN \n');
                document.write('flashVersion = 6 \n');
                document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.5") END IF \n');
                document.write('IF flashVersion < 6 and IsObject(obFlash) THEN \n');
                document.write('flashVersion = 5 \n');
                document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.4") END IF \n');
                document.write('IF flashVersion < 5 and IsObject(obFlash) THEN \n');
                document.write('flashVersion = 4 \n');
                document.write('ELSE SET obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.3") END IF \n');
                document.write('IF flashVersion < 4 and IsObject(obFlash) THEN \n');
                document.write('flashVersion = 3 \n');
                document.write('END IF');
                document.write('</scr' + 'ipt\> \n');

                // pruefen, ob Version des Plugins zulaessig ist
                if (flashVersion < since_version) {
                        flashVersion = 0;
                }

        } // no Flash
        else {
                flashVersion = 0; //-1;

        }
        return flashVersion;
}       // of function

function ltur_writeln(ltur_code) {
        document.writeln(ltur_code);
}

function checkRoom(formname) {
  try {
    room = document.forms[formname].hz;
    if ((room.value == 'E') || (room.value == 'O') || (room.value == '3')) {
        document.forms[formname].SEA_adults.options.selectedIndex = 0;
    }
  } catch (e) {}
}


function generate_map_link(formname, link_geo_suche) {
    form_name = "search"+formname;
    my_list   = document.getElementsByTagName("a");
    var adult_name = "SEA_adults_"+formname;
    var kids1_name = "SEA_kids1_"+formname;
    var kids2_name = "SEA_kids2_"+formname;
    wert = link_geo_suche+"&SEA_adults="+document.getElementById(adult_name).options[document.getElementById(adult_name).selectedIndex].value+"&SEA_kids1="+document.getElementById(kids1_name).options[document.getElementById(kids1_name).selectedIndex].value+"&SEA_kids2="+document.getElementById(kids2_name).options[document.getElementById(kids2_name).selectedIndex].value;
    if (document.getElementById('geo_welt')) document.getElementById('geo_welt').href = wert;
    if (document.getElementById('geo_welt_img')) document.getElementById('geo_welt').href = wert;
}

function OpenCalendar(formname, Reference_From,Reference_Check, Index, CIndex, mandant, PageMove)
{
    var refday = Reference_Check +'_day';
    var refmon = Reference_Check +'_month';
    var refyear= Reference_Check +'_year';
    if (PageMove && mandant != "fr" && mandant != "nl") {
        popupHeight = 300;
    } else {
        PageMove = 0;
        popupHeight = 300;
    }
    refmonv=document.getElementById(refmon).value
    var url = '/search_calender.tpl.php?u=sdh&formname='+formname+'&calendar=3&frmidx='+ CIndex +'&ref='+ Reference_From +'&refC='+ Reference_Check +'&refday='+ document.getElementsByName(refday)[Index].value +'&refmon='+ refmonv +'&refyear='+ document.getElementsByName(refyear)[Index].value+'&PageMove='+PageMove;
    MM_openBrWindow(url,'Kalender','width=610,height='+ popupHeight +',scrollbars=no,resizable=no');
}

function CloseCalendar()
{
    close();
}

// check_funcs.js ANFANG
function unlock()
{
    document.getElementsByName("submit2")[0].disabled = false;
}

function correct_date_rueck()
{
    var ab_day   = document.getElementById("start_datum_day_FL").options[document.getElementById("start_datum_day_FL").selectedIndex].value;
    var ab_month = document.getElementById("start_datum_month_FL").options[document.getElementById("start_datum_month_FL").selectedIndex].value;
    var ab_year  = document.getElementById("start_datum_year_FL").value;
    var rueck_day   = document.getElementById("end_datum_day_FL").options[document.getElementById("end_datum_day_FL").selectedIndex].value;
    var rueck_month = document.getElementById("end_datum_month_FL").options[document.getElementById("end_datum_month_FL").selectedIndex].value;
    var rueck_year  = document.getElementById("end_datum_year_FL").value;
    var currentTime = new Date();
    var ab_heute        = currentTime.getTime();
    var heute_day   = currentTime.getDay();
    var heute_month = currentTime.getMonth();
    var startTime   = new Date(ab_year, ab_month-1, ab_day, 0, 0, 0);
    var ab_date     = startTime.getTime();
    var endTime = new Date(rueck_year, rueck_month-1, rueck_day, 0, 0, 0);
    var rueck_date = endTime.getTime();
    if (rueck_month == "") {
        document.getElementById("end_datum_day_FL").options[0].selected = true;
    }
    if(rueck_month != "" && rueck_date <= ab_heute)
    {
        rueck_date = ab_heute+(7*24*60*60*1000); // plus sieben Tag
        var rueck_parse = new Date();
        rueck_parse.setTime(rueck_date); // Eingegebenes Datum als Timestamp
        rueck_day = rueck_parse.getDate();
        rueck_month = rueck_parse.getMonth()+1;
        rueck_year = rueck_parse.getFullYear();

        for(var i=0; i < document.getElementById('end_datum_day_FL').options.length; i++)
            if (document.getElementById('end_datum_day_FL').options[i].value==rueck_day)
                document.getElementById('end_datum_day_FL').options[i].selected=true;
        for(var i=0; i < document.getElementById('end_datum_month_FL').options.length; i++)
            if (document.getElementById('end_datum_month_FL').options[i].value==rueck_month)
                document.getElementById('end_datum_month_FL').options[i].selected=true;
        document.getElementById('end_datum_year_FL').value = rueck_year;
    }
    if(rueck_month != "" && rueck_date < ab_date)
    {
        ab_date = rueck_date;
//      ab_date = rueck_date-(7*24*60*60*1000); // minus sieben Tag
        if(ab_date <= ab_heute)
           ab_date = ab_heute;
        var ab_parse = new Date();
        ab_parse.setTime(ab_date); // Eingegebenes Datum als Timestamp
        ab_day = ab_parse.getDate();
        ab_month = ab_parse.getMonth()+1;
        ab_year = ab_parse.getFullYear();
        for(var i=0; i < document.getElementById('start_datum_day_FL').options.length; i++)
            if (document.getElementById('start_datum_day_FL').options[i].value==ab_day)
                document.getElementById('start_datum_day_FL').options[i].selected=true;
        for(var i=0; i < document.getElementById('start_datum_month_FL').options.length; i++)
            if (document.getElementById('start_datum_month_FL').options[i].value==ab_month)
                document.getElementById('start_datum_month_FL').options[i].selected=true;
        document.getElementById('end_datum_year_FL').value = ab_year;
    }
}

function correct_date_ab()
{
    var ab_day   = document.getElementById("start_datum_day_FL").options[document.getElementById("start_datum_day_FL").selectedIndex].value;
    var ab_month = document.getElementById("start_datum_month_FL").options[document.getElementById("start_datum_month_FL").selectedIndex].value;
    var ab_year  = document.getElementById("start_datum_year_FL").value;
    var rueck_day   = document.getElementById("end_datum_day_FL").options[document.getElementById("end_datum_day_FL").selectedIndex].value;
    var rueck_month = document.getElementById("end_datum_month_FL").options[document.getElementById("end_datum_month_FL").selectedIndex].value;
    var rueck_year  = document.getElementById("end_datum_year_FL").value;
    var currentTime = new Date();
    ab_heute        = currentTime.getTime();
    var heute_day   = currentTime.getDay();
    var heute_month = currentTime.getMonth();
    var startTime   = new Date(ab_year, ab_month-1, ab_day, 0, 0, 0);
    var ab_date     = startTime.getTime();
    var endTime = new Date(rueck_year, rueck_month-1, rueck_day, 0, 0, 0);
    var rueck_date = endTime.getTime();
    if(ab_date <= ab_heute)
    {
        for(var i=0; i < document.getElementById('start_datum_day_FL').options.length; i++)
            if (document.getElementById('start_datum_day_FL').options[i].value==heute_day)
                document.getElementById('start_datum_day_FL').options[i].selected=true;
        for(var i=0; i < document.getElementById('start_datum_month_FL').options.length; i++)
            if (document.getElementById('start_datum_month_FL').options[i].value==heute_month)
                document.getElementById('start_datum_month_FL').options[i].selected=true;
    }
    if(rueck_date < ab_date)
    {
        rueck_date = ab_date;
//        rueck_date = ab_date+(7*24*60*60*1000); // plus sieben Tag
        var rueck_parse = new Date();
        rueck_parse.setTime(rueck_date); // Eingegebenes Datum als Timestamp
        rueck_day   = rueck_parse.getDate();
        rueck_month = rueck_parse.getMonth()+1;
        rueck_year  = rueck_parse.getFullYear();
        for(var i=0; i < document.getElementById('end_datum_day_FL').options.length; i++)
            if (document.getElementById('end_datum_day_FL').options[i].value==rueck_day)
                document.getElementById('end_datum_day_FL').options[i].selected=true;
        for(var i=0; i < document.getElementById('end_datum_month_FL').options.length; i++)
            if (document.getElementById('end_datum_month_FL').options[i].value==rueck_month)
                document.getElementById('end_datum_month_FL').options[i].selected=true;
        document.getElementById('end_datum_year_FL').value = rueck_year;
    }
}

function change_year(month,which)
{
     var jetzt = new Date();
     var monat = jetzt.getMonth()+1; //Javascript zaehlt ab 0
     var jahr  = jetzt.getFullYear();
     var whichname = which+'_datum_year';
     if ( which.indexOf('tart') > 0 ) {
         if (month<monat) 
             jahr = jetzt.getFullYear()+1;
     } else {
         if (month!=0)
	     if (month<monat)
                 jahr = jetzt.getFullYear()+1;
     }
     if (document.getElementById(which))
         document.getElementById(which).value = jahr;
     else
         document.getElementsByName(whichname)[0].value = jahr;
}

function disableField(){
	
}