var ttCMmatchingAirports = {''   : 'beliebig',
                            '-1' : 'beliebig',
                            '19' : 'Graz',
                            '23' : 'Innsbruck',
                            '27' : 'Klagenfurt',
                            '30' : 'Linz',
                            '42' : 'Salzburg',
                            '46' : 'Wien',
                            '2'  : 'Augsburg (D)',
                            '17' : 'Friedrichshafen (D)',
                            '36' : 'München (D)',
                            '38' : 'Nürnberg (D)',
                            '45' : 'Stuttgart (D)',
                            '3'  : 'Basel-Mulhouse (CH)',
                            '7'  : 'Bern-Belp (CH)',
                            '47' : 'Zürich (CH)'
                           };

var ttCMmatchingDuration = {''     : 'beliebig',
							'-1'   : 'beliebig',
							'9'    : '1 - 4 Tage',
							'10'   : '5 - 8 Tage',
							'6_7'  : '1 Woche',
							'7'    : '9 - 12 Tage',
							'3'    : '13 - 15 Tage',
							'6_14' : '2 Wochen',
							'12'   : '16 - 22 Tage',
							'6_21' : '3 Wochen',
							'13'   : '> 22 Tage',
							'6_1'  : '1 Tag',
							'6_2'  : '2 Tage',
							'6_3'  : '3 Tage',
							'6_4'  : '4 Tage',
							'6_5'  : '5 Tage',
							'6_6'  : '6 Tage',
							'6_8'  : '8 Tage',
							'6_9'  : '9 Tage',
							'6_10' : '10 Tage',
							'6_11' : '11 Tage',
							'6_12' : '12 Tage',
							'6_13' : '13 Tage',
							'6_15' : '15 Tage',
							'6_16' : '16 Tage',
							'6_17' : '17 Tage',
							'6_18' : '18 Tage',
							'6_19' : '19 Tage',
							'6_20' : '20 Tage',
							'6_22' : '22 Tage'
							};
var ttCMmatchingRooms     = {"":"egal","-1":"egal","5":"Einzelzimmer","6":"Doppelzimmer","2":"Familienzimmer","0":"Bungalow","7":"Apartment","-2":"weitere Zimmertypen"};
var ttCMmatchingBoard     = {"":"egal","-1":"egal","0":"nur Uebernachtung","1":"Fruehstueck","2":"Halbpension","3":"Vollpension","4":"All Inclusive","5":"Vollpension Plus","6":"Halbpension Plus","7":"All Inclusive Plus"};
var ttCMmatchingCategory = {'1':'1','1.0':'1','1.5':'1.5','2':'2','2.0':'2','2.5':'2.5','3':'3','3.0':'3','3.5':'3.5','4':'4','4.0':'4','4.5':'4.5','5':'5','5.0':'5','5.5':'5.5','6':'6','6.0':'6','6.5':'6.5'}

function tt2cm(type,value) {
	switch (type) {
		case "airport":
			if (engine == 'erde') {
				matchedValue = 'null';
			} else {
			 	matchedValue = ttCMmatchingAirports[value];
			}
			
			break;
		case "date":
			tmpDate = new Date(value * 1000);
			tmpDay = tmpDate.getDate(); tmpMonth = tmpDate.getMonth()+1;
			tmpDay = (tmpDay < 10) ? "0" + tmpDay : tmpDay;
			tmpMonth = (tmpMonth < 10) ? "0" + tmpMonth : tmpMonth;
			matchedValue = tmpDate.getFullYear()+''+tmpMonth+''+tmpDay;
			break;
		case "duration":
			matchedValue = ttCMmatchingDuration[value];
			break;
		case "category":
		    /*
		    matchedValue = (value+2) + " Sterne";
		    */
			if (value >= 0) {
		        matchedValue = (value + 2) + " Sterne";    
		    } else {
		        matchedValue = "egal";
		    }
			break;
        case "category2":
            if (value == -1 || value == "") {
				$matchedValue = 'beliebig';
			}
			else {
				matchedValue = ttCMmatchingCategory[value] + ((parseInt(value) == 1) ? ' Stern' : ' Sterne');
			}
            break;
		case "travellers":
			tmpTravellers = value.split(";");
			adults = 0; children = 0;
			child = new Array();
			for (i = 0; i < tmpTravellers.length; i++) {
			    if (tmpTravellers[i] < 0) continue;
				if (tmpTravellers[i] != '' && tmpTravellers[i] > 16) {
				    adults++;
				} else if (tmpTravellers[i] != '' && tmpTravellers[i] <= 16 ) {
					children++
					child.push(tmpTravellers[i]);
				}
			}
			matchedValue = adults + " Erwachsene(r)" + ", " + children + " Kind(er) (" + child.join(", ") + " Jahre)";
			break;
		case "room":
			if (value >= 0) {
			    matchedValue = ttCMmatchingRooms[value];
			} else {
			    matchedValue = "egal";
			}
			break;
		case "board":
			if (value >= 0) {
			    matchedValue = ttCMmatchingBoard[value];
			} else {
			    matchedValue = "egal";
			}
			break;

	}
	if (matchedValue > " ") return matchedValue;
	else return "("+value+")";
}