var controller = {
	
	state:			{
		lastDetails:			'',
		fixedDetail:			'',
		areaCode_deeplink:		'',
		hotelCode_deeplink:		'',
		teaserduration_deeplink:'',
		activeCategory:			'',
		agency:					'',
		user:					'',
		password:				'',
		serverNameSession:		'',
		path_prefix:			'',
		destStatus:				'C',
		destTLC:				'',
		hotel:					'',
		lastPage:				0,
		noGoogleMaps:			(typeof GMap2 == 'undefined'),
		isGoogleMapsInit:		false,
		preferredMonth:			'',
		tablePrefix:			'',
		teaserType:				'',
		language:				'de'
	},
	
	dataProvider:	'/includes/modules/hotelGalerie/dataprovider_offer.php5',
	
	init: 			function (tlc) {
						this.category.init();
						var startID = 'category-' + tlc;
						this.category.render(startID, function() {
							$('#categoryPanel').css({'visibility': 'visible'});
							
							//$('#categoryPanel').css({'visibility': 'visible'});
							if (controller.state.destStatus == 'B')
								$(".category-beach").css({'visibility': 'visible'});
							else if (controller.state.destStatus == 'O')
								$(".category-easter").css({'visibility': 'visible'});
							else
								$(".category-city").css({'visibility': 'visible'});
							
							//$('#rightContentPane')
							//.css({'visibility': 'visible'})
							$('#contentLoadingPane div').fadeOut();
							$('#contentLoadingPane').animate({opacity: 1.0}, 1000, function() {
								$('#contentLoadingPane').fadeOut();
							});
						});		
						
						$('#btnShowMapPane').children().bind('click', function(event) {
								if(controller.offer.state.collapsed)
									$.scrollTo(700, {duration: 1000 });
								else
									$.scrollTo(1400, {duration: 1000 });
								event.preventDefault();
							});
							
						$('#btnShowHotelView a').bind('click', function(event) {
								$.scrollTo(0, {duration: 1000 });
								event.preventDefault();
							});
						
						/*$('#btnMap').bind('click', function(event) {
								console.log(controller.state.map.getCenter());
								console.log(controller.state.map.getZoom());
								event.preventDefault();
							});*/
						
						$('#hotellist-Container').hide();
						
						$('#show-hotelist').click(function(e){
							e.preventDefault();
							$('#hotellist-Container').show();
							$.scrollTo($('#hotellist-Container'), {duration: 1000 });
						})
					},
					
	log: function (event) {
		var data = {logevent: event, logdeststatus: controller.state.destStatus, logcategory: controller.state.activeCategory, loghotel: controller.state.hotel, language: controller.state.language};
		$.post(controller.state.path_prefix+'/includes/modules/hotelGalerie/dataprovider.php5', data);
	},
					
	category:		{
	
						renderer: {
							
							overview_startLoading:		function() {
															$('#gallerboxLoadingPane').fadeIn('fast');
															$('.pagerFirst').hide();
															$('.pagerNext').hide();
															$('.pagerPrev').hide();
															$('.pagerLast').hide();
														},
							overview_finishedLoading:	function() {
															$('#gallerboxLoadingPane').fadeOut('fast');
															$('.pagerFirst').show();
															$('.pagerNext').show();
															$('.pagerPrev').show();
															$('.pagerLast').show();
														}	
							
						},
		
						init:		function() {
										$('.categoryNav-Reference li').click(function(event) {
        									controller.category.render($(this).attr('id'));
        									event.preventDefault();
        								});
																						
										$('#overviewContainer .pagerPrev, #overviewContainer .pagerNext').unbind().click(function(event){
													controller.category.scrollHotels(this, 'overviewContainer');
													event.preventDefault();
												});
										
										$('#detailsContainer .pagerPrev, #detailsContainer .pagerNext').unbind().click(function(event){
													$('.details-tabsContainer li:first').trigger('click');
													controller.category.loadDetail(this);
													event.preventDefault();
												});
										
										$('#overviewContainer .pagerFirst, #overviewContainer .pagerLast').unbind().click(function(event){
													controller.category.scrollHotelsToLimit(this, 'overviewContainer');
													event.preventDefault();
												});
										
										$('#detailsContainer .pagerFirst, #detailsContainer .pagerLast').unbind().click(function(event){
													$('.details-tabsContainer li:first').trigger('click');
													controller.category.loadDetailToLimit(this);
													event.preventDefault();
												});												
												
										
									},
									
						render:		function(categoryID, callback) {
										controller.state.activeCategory = categoryID.replace(/category-/, '').toUpperCase();
										
										// Angebote nur schließen, wenn sie geöffnet sind
										if($('.details-offerListAirport').children().length > 0)
												controller.offer.animator.hideOfferlist(function() {
													controller.category.render_category(categoryID, callback);	
												});
										else
											controller.category.render_category(categoryID, callback);
									},
									
						render_category: function(categoryID, callback) {
										$('.category-bold').removeClass('category-bold');
										$('.category-selected').removeClass('category-selected');						
										
										$('#' + categoryID + ' a').addClass('category-bold');
										$('#' + categoryID).addClass('category-selected');
										$('#' + categoryID + ' input').attr('checked', 'checked');
										
        								this.loadHotels(categoryID, callback);

						},
									
						loadHotels:	function(categoryID, callback) {
										// Hotel Code löschen
										controller.offer.state.data.hotel_dbkey = '';
										
										controller.state.destination = categoryID.replace(/category-/, '');
										
										controller.category.renderer.overview_startLoading();
										
										//Für Wetten Dass die Navigation ändern
										if(controller.state.teaserType == "EventSpezial" && controller.state.fixedDetail != "")
											controller.offer.renderer.showSpezialDetails(controller.state.destination);
		
										var durPMI = controller.state.teaserduration_deeplink;
										if (controller.state.destination == 113)
											durPMI = 7;
										if (controller.state.destination == 114)
											durPMI = 4;
										if (controller.state.destination == 112)
											durPMI = 4;
										if (controller.state.destination == 115)
											durPMI = 4;
			
										if(controller.state.destStatus == 'FR')
										{
											if(controller.state.destination == 196 || controller.state.destination == 198)
												durPMI = 2;
											else
												durPMI = 3;
										}
										
										if(controller.state.destStatus == 'JP')
										{
											if (controller.state.destination != "RSW" && controller.state.destination != "MIA" && controller.state.destination != "ALC" && controller.state.destination != "PMI" && controller.state.destination != "BKK" && controller.state.destination != "GWT") {
												durPMI = 3;
												controller.offer.state.data.teaserDuration = 3;
											}										  
										}
										else if(controller.state.destStatus == 'PMIES')
										{
											if (controller.state.destination == 190) 
											{
												controller.offer.state.data.teaserDuration = 4;
												durPMI = 4;
											}
						  					else
											{
												controller.offer.state.data.teaserDuration = 3;
												durPMI = 3;
											}
												
										}
										
										$.getJSON(controller.state.path_prefix+"/includes/modules/hotelGalerie/dataprovider.php5?action=getHotelsOfCategory&destination=" + controller.state.destination + '&first=' + controller.state.hotelCode_deeplink + '&teaserdestination=' + controller.state.areaCode_deeplink + '&teaserduration=' + durPMI + '&logevent=opened-overview-from-categories&language=' + controller.state.language + '&logdeststatus=' + controller.state.destStatus + '&logcategory=' + controller.state.activeCategory + '&loghotel=' + controller.state.hotel + '&destStatus=' + controller.state.destStatus + '&preferredMonth=' + controller.state.preferredMonth + '&tablePrefix=' + controller.state.tablePrefix ,
											function(data)
											{
												
												// Ladeanimation ausblenden
												controller.category.renderer.overview_finishedLoading();
												
												// Karte initialisieren
												controller.map.init(data.category.TLC, data.hotels);				

												// Anzahl der Seiten/Hotels setzen
												controller.state.hotelCount = data.count;
												controller.state.lastPage = Math.ceil(controller.state.hotelCount/3);
												$('.overview-pagerPageCount').html(controller.state.lastPage);
												$('.details-pagerHotelCount').html(controller.state.hotelCount);
												
												// Erstmal alles entfernen
												$('#overview-hotelSlider').html('');
												$('#hotelDetailSlider').html('');
												
												// Destination Area Infos setzen
												$('#destinationInfo h3').html(data.category.Name);

												$('a.btnBack').html(data.category.Name + '<br>' + translationsTextHogaCore["Uebersicht"]);
																								
												$('#overview-AreaDescription').html(data.category.Description1 + ' ' + data.category.Description2);
												
												// Anzeigen des Ausverkauft-Aufklebers bzw. Alternative, wenn keine Hotels/Angebote verfügbar
												if(data.count == 0)
												{
													if (data.noHotelsFoundImg) {
														var marginLeft = (parseInt($('#overview-hotelInnerContainer').css('width'), 10) - data.noHotelsFoundImg.x) / 2;
														var marginTop = (parseInt($('#overview-hotelInnerContainer').css('height'), 10) - data.noHotelsFoundImg.y) / 2;
													
														if (controller.state.language == "es" && data.noHotelsFoundImg.src == "ausverkauft.png")
															var altImgScr = "ausverkauft_es.jpg";
														else
															var altImgScr = data.noHotelsFoundImg.src;
													
														$('#overview-hotelSlider').html('<img src="'+controller.state.path_prefix+'/_images/hotelGalerie/'+altImgScr+'" style="margin: '+marginTop+'px '+marginLeft+'px;">');
													}
													else
													{
														var marginLeft = (parseInt($('#overview-hotelInnerContainer').css('width'), 10) - 396) / 2;
														var marginTop = (parseInt($('#overview-hotelInnerContainer').css('height'), 10) - 189) / 2;
														$('#overview-hotelSlider').html('<img src="' + controller.state.path_prefix + '/_images/hotelGalerie/ausverkauft.jpg" style="margin: ' + marginTop + 'px ' + marginLeft + 'px;">');
													}
												}
												else
												{
													if ( typeof(data.tracking) !== 'undefined' && data.tracking != "")
													{
														try {
															parent.targetTracking.location.href = data.tracking;
														  }
														 catch(err)
														  {
														  //Handle errors here
														  }
													}
												
													$.each(data.hotels, function(i,item){
																											
														var stars = '';
														
														var starsFull = Math.floor(item.Category);
														var needHalfStar = 0;
														if (starsFull != item.Category)
															needHalfStar = 1;
														
														for (var j = 0; j < starsFull; j++)
														{
															stars = stars + '<img src="'+controller.state.path_prefix+'/_images/hotelGalerie/star.png" alt="Star" />';
														}
														
														if (needHalfStar == 1)
															stars = stars + '<img src="'+controller.state.path_prefix+'/_images/hotelGalerie/starhalf.png" alt="Star" />';
													
														var hotelHtml = ''
	+ '							<div id="overview-' + item.Hotelcode + '" class="overview-singleHotel">'
	+ '								<div class="overview-hotelImage">'
	+ '									<div class="overview-hotelImageReal" style="background-image: url(' + item.ImageOverview + ');"></div>'
	+ '									<div class="overview-hotelImageBorder"></div>'
	+ '								</div>'
	+ '								<div class="overview-hotelInfo">'
	+ '									<div class="overview-hotelStars">' + stars + '</div>'
	+ '									<div class="overview-HotelName">' + item.Name + '</div>'
	+ '									<div class="overview-DestLocation">' + item.Location + '</div>'
	+ '									<div class="clearer"></div>'
	+ '								</div>'
	+ '								<div class="overview-hotelDescription">'
	+ '									<div class="separation-line-1"><img src="_images/hotelGalerie/dotted_line.png" height="1" width="190px" border="0"></div>'
	+ '									<p>' + item.Description + '</p>'
	+ '									<div class="opening-times">&nbsp;</div>'	
	+ '									<div class="separation-line-2"><img src="_images/hotelGalerie/dotted_line.png" height="1" width="190px" border="0"></div>';

	// Zeile zur Anzeige der Verfügbarkeit temporär entfernt für Marketing-Aktion 23.06./24.06.10
	// <div class="opening-times">' + item.OpeningTimes + '</div>'	
	
	// Sprachefest (monat und foodtype) 
														if (typeof(item.OfferTeaser.ToGo) !== 'undefined' && item.OfferTeaser.ToGo == 1)
															hotelHtml = hotelHtml
	+ '									<div class="overview-priceInfo">&nbsp;</div>';
														else
															hotelHtml = hotelHtml
	+ '									<div class="overview-priceInfo">' + translationsTextHogaCore["zB"]  + ' <span class="duration">' + item.OfferTeaser.Duration + '</span>&nbsp;<span class="durationText">' + (item.OfferTeaser.Duration > 1 ? translationsTextHogaCore["Naechte"] : translationsTextHogaCore["Nacht"]) + '</span> ' + (item.OfferTeaser.FoodType == 'ohne Verpflegung' || (item.OfferTeaser.FoodType == '&Uuml;bernachtung' && controller.state.language == "es") ? '' : translationsTextHogaCore['mit']) + ' <span class="duration">' + (typeof translationsTextHogaCore[item.OfferTeaser.FoodType] != 'undefined' ? ((translationsTextHogaCore[item.OfferTeaser.FoodType] == 'media pensión' && controller.state.language == 'es' && translationsTextHogaCore[item.OfferTeaser.OfferMonth] == 'Noviembre') ? 'media pen.' : translationsTextHogaCore[item.OfferTeaser.FoodType]) : '') + '</span>' + (controller.state.language == 'es' ? ' ' : '<br>') + translationsTextHogaCore["inkl"] + ' <span class="duration">' + translationsTextHogaCore["Flug"] + '</span> ' + translationsTextHogaCore["im"] + ' <span class="duration">' + translationsTextHogaCore[item.OfferTeaser.OfferMonth] + '</span></div>';


														hotelHtml = hotelHtml
	+ '									<div class="priceContainer">' 
	+ '										<div class="overview-price"><span class="ab">' + translationsTextHogaCore["ab"] + '</span>' + item.OfferTeaser.Price + '<span style="font-size:12px">' + (item.OfferTeaser.Price >= 1000 ? '' : '&nbsp;') + '</span>&euro;</div>'
	+ '										<div class="overview-hotelLink overview-hotelLink_' + controller.state.language + '">'
	+ '											<a href=""></a>'
	+ '										</div>'
	+ '										<div class="layout-clear"></div>'
	+ '									</div>' 
	+ '								</div>'
	+ '							</div>';
														


													// HTML in Hotel Slider einfuegen
														$('#overview-hotelSlider').append(hotelHtml);
														
														// Detail Container erstellen
														$('#hotelDetailSlider').append('<div class="details-hotelDescription" id="details-' + item.Hotelcode + '"></div>');
														
														// Offer Daten zwischenspeichern
														$('#hotelDetailSlider > div:last').data('OfferTeaser', item.OfferTeaser);
													});
												
												}
												
												// Stoerende erste Border entfernen:
												$('.overview-singleHotel:first').css({'border': 'none'});
												
        										// Navi zuruecksetzen
        										$('#overviewContainer .pagerPrev').css({opacity: 0.5});
												$('#overviewContainer .pagerFirst').css({opacity: 0.5});
        										if (controller.state.hotelCount > 3)
												{
        											$('#overviewContainer .pagerNext').css({opacity: 1});
													$('#overviewContainer .pagerLast').css({opacity: 1});
												}
        										else
												{
        											$('#overviewContainer .pagerNext').css({opacity: 0.5});
													$('#overviewContainer .pagerLast').css({opacity: 0.5});
												}
        											
        										$('.pagerPage').html('1');
        										
        										// Position der Slider und die Fenstergroesse zuruecksetzen
        										$('#containerSlider').css({top: '0px', left: '0px'});
        										$('#overview-hotelSlider').css({left: '0px'});
        										$('#hotelDetailSlider').css({left: '0px'});
        										$('.details-hotelInnerContainer').css({height: '482px'});
												
												// Overview->Detail Click
												$('.overview-singleHotel').click(function(event){
													controller.category.loadDetail(this);
													event.preventDefault();
												});
												
												// Detail->Overview Click
												$('.btnBack').unbind().click(function(event){
													if(!controller.offer.state.collapsed) {
														controller.offer.animator.hideOfferlist(function(){
															$(this).wait(350, function() {
																$('#containerSlider').animate({top: '0px'});
																//HotelvideoEntfernen
																$('#divVideo').remove();
															});
														});
													}
													else
														$('#containerSlider').animate({top: '0px'});
													
													$('.details-offerContainer').remove();
													event.preventDefault();
													
													controller.offer.state.data.hotel_dbkey = '';
												});
												
												$('#details-infoTextScrollPane').jScrollPane({showArrows:true, scrollbarWidth: 17});
												
												// Groesse des Overview divs setzen
												$('#overview-hotelSlider').css({'width': controller.state.hotelCount*221});
												
												$('#overview-hotelInnerContainer').append('<div class="clearer"></div>');
												
												// Groesse des Detail divs setzen
												$('#hotelDetailSlider').css({'width': controller.state.hotelCount*682});
												
												if (callback) callback();
												
												// Leere Flaechen auffuellen
												if (controller.state.hotelCount < 3 && controller.state.hotelCount != 0) { 
													$('#overview-hotelSlider').append('<div class="overview-singleHotel inactive"></div>')
																			  .append('<div class="overview-singleHotel inactive"></div>');
													$('#overview-hotelSlider').css({width:'662px'});
												}
												
												// Wenn die HotelGalerie als LandingPage fungiert, direkt auf die Detailansicht einsteigen
												if(controller.state.doLandingPageActions == true || data.category.HotelDetail == 1) {
													// False setzen, damit die Angebote automatisch wieder geöffnet werden
													controller.offer.state.collapsed = false;
													$('.overview-singleHotel:first').click();
												}
													
												
											});
										
									},

						scrollHotels:		function(ref, where) {
											if (controller.state.hotelCount > 3) {
											/*
											$('#overviewContainer .pagerPrev, #overviewContainer .pagerNext').unbind().bind('click', function(event) { event.preventDefault(); });
											*/
											var hotelOffset;
											var logEvent;
											
											$('#' + where + ' .pagerPrev, #' + where + ' .pagerNext').css({opacity: 1});
											
											if($(ref).is('.pagerPrev')) {
												hotelOffset = 3;
												logEvent = 'overview-scroll-left';
												$('#' + where + ' .pagerLast').css({opacity: 1});
											}
											else {
												$('#' + where + ' .pagerFirst').css({opacity: 1});
												hotelOffset = -3;
												logEvent = 'overview-scroll-right';
											}
											
											var currentOffset = parseInt($('#overview-hotelSlider').css('left'), 10)/221;
											var scrollToOffset = -(currentOffset+hotelOffset);
											
											if(scrollToOffset+3 >= controller.state.hotelCount) {
												$('#' + where + ' .pagerNext').css({opacity: 0.5});
												$('#' + where + ' .pagerLast').css({opacity: 0.5});
												scrollToOffset = controller.state.hotelCount-3;
											}
											else if(scrollToOffset <= 0) {
												$('#' + where + ' .pagerFirst').css({opacity: 0.5});
												$('#' + where + ' .pagerPrev').css({opacity: 0.5});
												scrollToOffset = 0;
											}
											
											if(currentOffset != -scrollToOffset)
												controller.log(logEvent);
											
											var pixelOffset = -scrollToOffset*221;
											
											$('#overview-hotelSlider').animate({'left': pixelOffset}/*, function() {
													$('#overviewContainer .pagerPrev, #overviewContainer .pagerNext').unbind().click(function(event){
															controller.category.scrollHotels(this, 'overviewContainer');
															event.preventDefault();
														});
												}*/);
											
											var page = Math.ceil(scrollToOffset/3)+1;
											$('#' + where + ' .pagerPage').html(page);
											
												
										}
									},
									
					scrollHotelsToLimit:	function(ref, where) {
											if (controller.state.hotelCount > 3) {/*
												$('#overviewContainer .pagerFirst, #overviewContainer .pagerLast').unbind().bind('click', function(event){
													event.preventDefault();
												});*/
												var logEvent;
												var pixelOffset											
												
												if ($(ref).is('.pagerFirst')) {
													$('#' + where + ' .pagerFirst').css({opacity: 0.5});
													$('#' + where + ' .pagerPrev').css({opacity: 0.5});
													$('#' + where + ' .pagerNext').css({opacity: 1});
													$('#' + where + ' .pagerLast').css({opacity: 1});
													pixelOffset = 0;
													$('#' + where + ' .pagerPage').html('1');
													logEvent = 'overview-scroll-left-Limit';
												}
												else {
													$('#' + where + ' .pagerFirst').css({opacity: 1});
													$('#' + where + ' .pagerPrev').css({opacity: 1});
													$('#' + where + ' .pagerNext').css({opacity: 0.5});
													$('#' + where + ' .pagerLast').css({opacity: 0.5});
													//scrollToOffset = controller.state.hotelCount-3;
													pixelOffset = -(controller.state.hotelCount - 3) * 221;
													$('#' + where + ' .pagerPage').html(controller.state.lastPage);
													logEvent = 'overview-scroll-right-Limit';
												}
												
												controller.log(logEvent);
												
												$('#overview-hotelSlider').animate({
													'left': pixelOffset
												}/*, function(){
													$('#overviewContainer .pagerFirst, #overviewContainer .pagerLast').unbind().click(function(event){
														controller.category.scrollHotelsToLimit(this, 'overviewContainer');
														event.preventDefault();
													});
												}*/);
										}
									},
						
						loadDetail:		function(reference, stopLoading) {
											// Mehrmaliges Klicken verhindern
											if(controller.state.isLoadingDetail)
												return false;
											controller.state.isLoadingDetail = true;
											
											var hotelCode;
											var logEvent;
																						
											// vertikal
											if($(reference).is('.overview-singleHotel')) {
												hotelCode = $(reference).attr('id').replace(/overview-/, '');
												
												controller.state.hotel = hotelCode;

												if(stopLoading != true)
													logEvent = 'detail-opened-from-overview';
												else
													logEvent = 'detail-opened-from-map';
												
												// Link deaktivieren:
												$('div.overview-hotelLink a', reference)
												.css({'color': '#333333'})
												.children('img:not(.detail-loading)').attr('src', controller.state.path_prefix+'/_images/hotelGalerie/btn_down-grey_paul.gif');
											}
											// horizontal
											else {
												var pagerClass;
												var scrollTo;
												if($(reference).is('.pagerNext')) {
													pagerClass = '.pagerNext';
													scrollTo = 1;
													logEvent = 'detail-scroll-right';
												}
												else {
													pagerClass = '.pagerPrev';
													scrollTo = -1;
													logEvent = 'detail-scroll-left';
												}
													
												var detailOffset = -parseInt($('#hotelDetailSlider').css('left'), 10)/682;
												hotelCode = $('#hotelDetailSlider > div:eq(' + (detailOffset + scrollTo) + ')').attr('id');
												
												if(hotelCode != undefined) {
													// Scrolling Animation
													$('#detailsContainer .fade').fadeIn('fast');
													
													hotelCode = hotelCode.replace(/details-/, '');
												}
												else {
													controller.state.isLoadingDetail = false;
													return;
												}
												
												// Loading Animation deaktivieren:
												$('#detailsContainer' + pagerClass)
												.css({'display': 'none'})
												.after('<img src="'+controller.state.path_prefix+'/_images/hotelGalerie/loading-detail.gif" class="detail-pager" alt="loading"/>');
											}
											
											// Unabhaengig vom 'left'-Wert feststellen in welches Hotel wir reinwollen
											var divNumber = $('#hotelDetailSlider #details-'+hotelCode).prevAll().size();
											$('#detailsContainer .pagerPage').html(divNumber+1);
											
											// Links erstmal alle aktivieren!
											$('#detailsContainer .pagerNext, #detailsContainer .pagerPrev').css({'opacity': 1});
											$('#detailsContainer .pagerLast, #detailsContainer .pagerFirst').css({'opacity': 1});
											
											// Link deaktivieren falls man am Ende ist
											if((divNumber+1) == controller.state.hotelCount) {
												$('#detailsContainer .pagerNext').css({'opacity': 0.5});
												$('#detailsContainer .pagerLast').css({'opacity': 0.5});
											}
											else if(divNumber == 0) {
												$('#detailsContainer .pagerPrev').css({'opacity': 0.5});
												$('#detailsContainer .pagerFirst').css({'opacity': 0.5});
											}
											

											controller.category.insertDetail(hotelCode, '#hotelDetailSlider #details-'+hotelCode, logEvent, function (element) {
													// Am Ende erst scrollen
													// -> vertical
													if($(reference).is('.overview-singleHotel')) {
														$('#hotelDetailSlider').css({'left': -divNumber*682});
														
														$('#containerSlider').animate({'top': '-580px'}, function(){
															// Link wieder aktivieren:
															$('div.overview-hotelLink a', reference)
															.css({'color': '#FFFFFF'})
															.children('img:not(.detail-loading)').attr('src', controller.state.path_prefix+'/_images/hotelGalerie/details_btn_offer_arrow_down.gif')
															.end().children('.detail-loading').remove();
															
															controller.state.isLoadingDetail = false;
										
															if (controller.state.hotelVideo != '' && controller.state.destStatus != 'FR' && false) {
																//Hotelvideo zeigen
																$('.details-infoContainer .details-infoText').hide();
																$('.details-infoContainer .details-tab-video').show();
																
																$('.details-tabsContainer li').removeClass('tabSelected');
																$('#hotelVideo-tab').addClass('tabSelected');
															}
														});
													}
													// -> horizontal
													else {
														$('#detailsContainer' + pagerClass)
														.css({'display': 'inline'})
														.next('.detail-pager"').remove();
														
														var pixelOffset = -(detailOffset+scrollTo)*682;
														
														$('#hotelDetailSlider').css({'left': pixelOffset});
														controller.state.isLoadingDetail = false;
														$('#detailsContainer .fade').fadeOut('fast');
														
													}
													
													// Event zum Angebote öffnen binden
													$(element + ' .details-btnOffer').click(controller.offer.processor.toggleBtnOffer);
													
													// Angebotsauswahl wiederherstellen (Cookie)
													if($.cookie('hotelGalleryState' + controller.state.destStatus + controller.state.destTLC) != null) {
														controller.offer.state.restore = $.secureEvalJSON($.cookie('hotelGalleryState' + controller.state.destStatus + controller.state.destTLC));
														$.cookie('hotelGalleryState' + controller.state.destStatus + controller.state.destTLC, '', { expires: -1 }); // Cookie löschen
													}
													else {
														// Nur zu den Angeboten Scrollen, falls wir von der Flugauswahl zurückkommen
														controller.state.doLandingPageActions = false;
														// Angebotsauswahl bei Hotelwechsel löschen
														controller.offer.state.restore = {
															adults_count: 	null,
															children_count:	null,
															duration:		null,
															airport:		null,
															destAirport:	null,
															month:			null,
															year:			null
														};
													}
													
													// Angebote öffnen, wenn schon vorher offen waren, oder wir eine Landingpage sind
													if(controller.offer.state.collapsed != true)
														$(element + ' .details-btnOffer').click();
													
													if (stopLoading == true)
														$(this).wait(200, function() {
															controller.category.renderer.overview_finishedLoading();
														});

												});
										},
										
					loadDetailToLimit:		function(reference, stopLoading) {
											// Mehrmaliges Klicken verhindern
											if(controller.state.isLoadingDetail)
												return false;
												
											controller.state.isLoadingDetail = true;
											
											var hotelCode;
											var logEvent;

											var pagerClass;
											var scrollToHotel;
											var pixelOffset;							
											
											if($(reference).is('.pagerLast')) {
												pagerClass = '.pagerLast';
												scrollToHotel = controller.state.hotelCount -1;
												pixelOffset = -(scrollToHotel)*682;
												logEvent = 'detail-scroll-right-Limit';
												$('#detailsContainer .pagerPage').html(controller.state.hotelCount);
												$('#detailsContainer .pagerFirst').css({'opacity': 1});
												$('#detailsContainer .pagerNext').css({'opacity': 0.5});
												$('#detailsContainer .pagerPrev').css({'opacity': 1});
												$('#detailsContainer .pagerLast').css({'opacity': 0.5});												
											}
											else {
												pagerClass = '.pagerFirst';
												scrollToHotel = 0;
												pixelOffset = 0;
												logEvent = 'detail-scroll-left-Limit';
												$('#detailsContainer .pagerPage').html('1');
												$('#detailsContainer .pagerFirst').css({'opacity': 0.5});
												$('#detailsContainer .pagerNext').css({'opacity': 1});
												$('#detailsContainer .pagerPrev').css({'opacity': 0.5});
												$('#detailsContainer .pagerLast').css({'opacity': 1});
												
											}
												
											hotelCode = $('#hotelDetailSlider > div:eq(' + scrollToHotel + ')').attr('id');
											
											if(hotelCode != undefined) {
												// Scrolling Animation
												$('#detailsContainer .fade').fadeIn('fast');
												
												hotelCode = hotelCode.replace(/details-/, '');
											}
											else {
												controller.state.isLoadingDetail = false;
												return;
											}
											
											// Loading Animation deaktivieren:
											$('#detailsContainer' + pagerClass)
											.css({'display': 'none'})
											.after('<img src="'+controller.state.path_prefix+'/_images/hotelGalerie/loading-detail.gif" class="detail-pager" alt="loading"/>');
								
											controller.category.insertDetail(hotelCode, '#hotelDetailSlider #details-'+hotelCode, logEvent, function (element) {

													$('#detailsContainer' + pagerClass)
													.css({'display': 'inline'})
													.next('.detail-pager"').remove();
													
													$('#hotelDetailSlider').css({'left': pixelOffset});
													controller.state.isLoadingDetail = false;
													$('#detailsContainer .fade').fadeOut('fast');
														
										
													
													// Event zum Angebote öffnen binden
													$(element + ' .details-btnOffer').click(controller.offer.processor.toggleBtnOffer);
													
													// Angebotsauswahl wiederherstellen (Cookie)
													if($.cookie('hotelGalleryState' + controller.state.destStatus + controller.state.destTLC) != null) {
														controller.offer.state.restore = $.secureEvalJSON($.cookie('hotelGalleryState' + controller.state.destStatus + controller.state.destTLC));
														$.cookie('hotelGalleryState' + controller.state.destStatus + controller.state.destTLC, '', { expires: -1 }); // Cookie löschen
													}
													else {
														// Nur zu den Angeboten Scrollen, falls wir von der Flugauswahl zurückkommen
														controller.state.doLandingPageActions = false;
														// Angebotsauswahl bei Hotelwechsel löschen
														controller.offer.state.restore = {
															adults_count: 	null,
															children_count:	null,
															duration:		null,
															airport:		null,
															destAirport:	null,
															month:			null,
															year:			null
														};
													}
													
													// Angebote öffnen, wenn schon vorher offen waren, oder wir eine Landingpage sind
													if(controller.offer.state.collapsed != true)
														$(element + ' .details-btnOffer').click();
													
													if (stopLoading == true)
														$(this).wait(200, function() {
															controller.category.renderer.overview_finishedLoading();
														});

												});
										},										
										
								insertDetail:	function (hotelCode, element, logEvent, callback) {
											
											$.getJSON(controller.state.path_prefix+"/includes/modules/hotelGalerie/dataprovider.php5?action=getHotelInfo&language=" + controller.state.language + "&code=" + hotelCode + '&destination=' + controller.state.destination + '&teaserdestination=' + controller.state.areaCode_deeplink + '&teaserduration=' + controller.state.teaserduration_deeplink + '&logevent=' + logEvent + '&logdeststatus=' + controller.state.destStatus + '&logcategory=' + controller.state.activeCategory + '&loghotel=' + controller.state.hotel + '&destStatus=' + controller.state.destStatus + '&preferredMonth=' + controller.state.preferredMonth + '&tablePrefix=' + controller.state.tablePrefix ,
												function(data){
													
													controller.state.isGoogleMapsInit = false;
													
													var stars = '';
													var starsFull = Math.floor(data.Category);
													var needHalfStar = 0;
													if (starsFull != data.Category)
														needHalfStar = 1;
													
													for (var j = 0; j < starsFull; j++) {
														stars = stars + '<img src="'+controller.state.path_prefix+'/_images/hotelGalerie/star.png" alt="Star" />';
													}
													
													if (needHalfStar == 1)
														stars = stars + '<img src="'+controller.state.path_prefix+'/_images/hotelGalerie/starhalf.png" alt="Star" />';
													
													
													var venture = 'Hotel';
													var hotelName = data.LongNamePart2;
													if (hotelName == "") 
														hotelName = data.LongNamePart1;
													else {
														if(data.LongNamePart1 != undefined && data.LongNamePart1 != "")
															venture = data.LongNamePart1;
													}
													
													// Zwischengespeicherte OfferTeaser Daten holen
													if(logEvent != 'hotel-popup')
														data.OfferTeaser = $('#hotelDetailSlider #details-'+hotelCode).data('OfferTeaser');
													else
														data.OfferTeaser = {Duration : 0, Price: 0};
													
													var durationText = translationsTextHogaCore["Naechte"];
													if(data.OfferTeaser.Duration == 1) durationText = translationsTextHogaCore["Nacht"];
													
													
													var html = ''
+ '								<div class="details-headLine">'
+ '									<h3><span>' + venture + '</span>&nbsp;' + hotelName + '&nbsp; ' + stars + '</h3><div class="details-location">'
+ '									' + data.DestAreaName + ' <span>/ ' + data.Location + '</span>'
+ '									</div>'
+ '								</div>'
+ '								'
+ '	<div class="image-box">'
+ '  		'
+ '  	<div class="medium-image">'
+ '  		<div class="medium-image-real"></div>'
+ '			<div class="medium-image-border"></div>'
+ '			<!-- <div class="medium-image-magnifier"></div> -->'
+ '		</div>'
+ '		'
+ '		<div class="description">'
+ '			<div class="text"></div>'
+ '			<div style="clear: both;"></div>'
+ '		</div>'
+ '		'
+ ' 	   <div class="carousel">'
+ '			<div class="carousel-prev carousel-navi carousel-navi-deactive"></div>'
+ '			<div class="carousel-next carousel-navi carousel-navi-deactive"></div>'
+ '				<div class="carousel-clip">'
+ '					<ul>'
+ '						<!-- The content will be dynamically loaded in here -->'
+ '					</ul>'
+ '				</div>'
+ '			</div>'
+ '		</div>'
+ '	';

// TrustYou Siegel in Detailansicht der Hotelgalerie einblenden, sofern Daten in der tblHotelAddon vorliegen
if ((controller.state.language == "de" || controller.state.language == "nl")&&(typeof(data.TrustYouId) !== 'undefined' && data.TrustYouId != ""))
{
	html += '<div class="details-trustyouPanel">' +
				// Script für Lyteframe Layover
				'<script type="text/javascript" language="javascript" src="/web/pauschal/_javascripts/lytebox.js"></script>' +
				// i-Frame für (kleines) TrustYou Siegel
				'<iframe src="http://widgets.trustyou.com/widgetizer?id=' + data.TrustYouId + '&module=2&lang=de&size=small&type=ty&partnerid=binoli" class="badge" scrolling="no" frameborder="0" height="80" width="80" marginheight="0" marginwidth="0" style="z-index:1;"></iframe>' +
				// transparentes Pixel über i-Frame legen und verlinken, damit Link auch im IE funktioniert
				'<a class="trustyou-widget" style="display:none" href="http://www.binoli.de/web/pauschal/trustYouEvaluation.php?id=' + data.TrustYouId + '&hotel=' + hotelName + '&url=' + data.TrustYouURL + '" rel="lyteframe" title="' + hotelName + '" rev="width:550px; height:475px; scrolling:no;">&nbsp;</a>' +
				'<img src="img/clearpixel.gif" alt="" class="details-trustyouPanel-overlay" style="position:absolute; left:0px; top:0px; width:77px; height:72px; z-index:9999;">' +
			'</div>';
}

html += '					<div class="details-btnPanel">'
+ '									<!--'
+ '										<img src="_images/hotelGalerie/details_btn_pdf.gif" alt="' + translationsTextHogaCore["PDFHerunterladen"] + '" />'
+ '										<img src="_images/hotelGalerie/details_btn_showmap_line.gif" alt="' + translationsTextHogaCore["KarteAnzeigen"] + '">'
+ '								-->'
+ '								<img src="'+controller.state.path_prefix+'/_images/hotelGalerie/details_btn_showmap_' + controller.state.language + '.gif" class="details-map-link" alt="' + translationsTextHogaCore["KarteAnzeigen"] + '">';

html +=  '					</div>'
+ '								<div class="details-priceExample">'
+ '									<div class="details-priceInfo">';

if (typeof(data.OfferTeaser.ToGo) === 'undefined' || data.OfferTeaser.ToGo == 0)
	html +=  '								' + translationsTextHogaCore["zB"] + ' <span class="duration">' + data.OfferTeaser.Duration + '</span>'
	+ '										<span class="durationText">' + durationText + '</span> (' + translationsTextHogaCore["inklFlug"] + ')<br>'
	// Sprachefest (roomtype/foodtype)
	+ '										<span>' + translationsTextHogaCore[data.OfferTeaser.RoomType] + '&#47;' + (controller.state.language == "es" ? '<br>' : '') + (data.OfferTeaser.FoodType == 'ohne Verpflegung' ? translationsTextHogaCore['ohne Verpfl.'] : translationsTextHogaCore[data.OfferTeaser.FoodType]) + ' ' + translationsTextHogaCore["ab"] + '</span>';
else
	html +=  '								&nbsp;<br><span>' + translationsTextHogaCore["ab"] + '</span>';
	
html +=  '									</div>'
+ '									<div class="details-price details-price_' + controller.state.language + '">' + data.OfferTeaser.Price + '<span style="font-size:12px">&nbsp;</span><span class="priceCurrency">&euro;</span></div>'
+ '								</div>'
+ '								<div class="details-btnOffer details-btnOffer_' + controller.state.language + '">'
+ '									<div id="details-btnOfferLoading"><img src="'+controller.state.path_prefix+'/_images/hotelGalerie/loading_offer.gif" alt="Loading" /></div>'
+ '									<span id="details-btnOfferText"><em></em></span>'
+ '								</div>'
+ '								<div class="details-infoContainer">'
+ '									<div class="details-tabsContainer">'
+ '										<ul id="hotelNavi">'
+ '											<li class="tabSelected">' + translationsTextHogaCore["BESCHREIBUNG"] + '</li>'
+ '											<li class="tip-tab">' + translationsTextHogaCore["TIPP"] + '</li>';

//Karte nur für deutsch
if(controller.state.language == "de")
	html += '<li>' + translationsTextHogaCore["KARTE"] + '</li>';
else
	html += '<li style="display:none;">' + translationsTextHogaCore["KARTE"] + '</li>';


// Ausgabe des Hotelcodes zu Testzwecken
// console.log("test "+hotelCode);

//if (hotelCode == "0120000016576")
//	data.HotelVideo = "showVideo";
/*
if(data.HotelVideo != "")
//if ( typeof(data.HotelVideo) !== 'undefined' )
{
	if ( $.browser.msie === true )
		html += '<li>VIDEO</li>';
	else
		html += '<li onclick="tvt_inject();">VIDEO</li>';

}
*/

// PAUL TRUST YOU
html += '									<li class="trustyou-tab" style="display:none;">TRUSTYOU</li>'
+ '										</ul>'
+ '									</div>'
+ '									<div class="details-infoText holder jScrollPaneStyle_default details-tab-description">'
+ '										<div class="details-infoTextScrollPane" style="width:360px;height:345px">'
+ '												<div>'
+ '													<p>' + (typeof data.DescriptionShort != 'undefined' ? data.DescriptionShort : '') + '</p>'
//+ '													<p>' + (typeof data.OpeningTimes != 'undefined' ? data.OpeningTimes : '') + '</p>'
+ '													<p>' + (typeof data.DescriptionShort != 'undefined' ? '<img src="_images/hotelGalerie/solid_line.png" height="1" width="305px" border="0">' : '') + '</p>'
+ '													<p>' + controller.details.beautyfier.beautifyHotelDescription(data.Description) + '</p>'
+ '												</div>'
+ '										</div>'
+ '									</div>'
+ '									<div class="details-infoText holder jScrollPaneStyle_default details-tab-tip">'
+ '										<div class="details-infoTextScrollPane" style="width:360px;height:345px">'
+ '												<div>'
+ '													<p>' + data.Tipp + '</p>'
+ '												</div>'
+ '										</div>'
+ '									</div>'
+ '									<div class="details-infoText details-tab-map">'
+ '												<div id="details-map-' + hotelCode + '" style="width:360px;height:341px;margin:5px 0 0;">'
+ '												</div>'
+ '									</div>'
+ '									<div class="details-infoText details-tab-video" id="divVideo">'
//+ data.HotelVideo 
//+ '	<div name="tvtrip-anchor"><a name="tvtrip-player" href="http://www.tvtrip.de/paris-hotels/saint-james-and-albany-hotel-spa">Saint James and Albany Hotel Spa - Paris Hotel</a></div><script src="http://www.tvtrip.de/embed-site.js" type="text/javascript"></script>'
//+ ' 									<div name="tvtrip-anchor"><a name="tvtrip-player" href="http://www.tvtrip.com/shanghai-hotels/four-points-by-sheraton-shanghai,-pudong">Four Points by Sheraton Shanghai, Pudong - Shanghai Hotel</a></div><script src="http://www.tvtrip.com//embed-player.js" type="text/javascript"></script>'
//+ ' 									<div name="tvtrip-anchor"><a name="tvtrip-player" href="http://www.tvtrip.com/paris-hotels/saint-james-and-albany-hotel-spa">Saint James and Albany Hotel Spa - Paris Hotel</a></div><script src="http://www.tvtrip.com/embed-site.js" type="text/javascript"></script>'
//+ ' 									<embed id="tvtripPlayerContainer" width="546" height="348" flashvars="id=140855&rootUrl=http://www.tvtrip.com&key=ABQIAAAAMZ1hHlEDygsHoVRCKsqU_RTQblBBuoRf37zFCwnhVBC7rNtOQRSgCkSMb8prk_lKZKRZ5xq3Qeea8g&url=http://www.tvtrip.com/hotelXML?id=140855&provenance=overview&partner=www.tvtrip.com&referer=www.tvtrip.com" autoplay="false" name="playerLink" swliveconnect="true" allowfullscreen="true" bgcolor="#ffffff" pluginspage="http://www.adobe.com/go/getflashplayer" type="application/x-shockwave-flash" src="http://www.tvtrip.com/swf/www/main.swf" style="display: block;"/>'
+ '									</div>'
// PAUL TRUST YOU
+ '									<!--div class="details-infoText holder jScrollPaneStyle_default details-tab-trustyou">'
+ '										<div class="details-infoTextScrollPane" style="width:360px;height:345px">'
+ '												<div>'
+ '													<p></p>'
+ '												</div>'
+ '										</div>'
+ '									</div-->'
+ '								</div>'
+ '								<div class="details-offerContainer">'
+ '									<div class="details-offerContainerFader"></div>'
+ '									<div class="details-offerCanvas">'
+ '										<div class="details-offerLeftPane">'
+ '											<h4>' + translationsTextHogaCore["Reisende"] + '</h4>'
+ '											<ul class="details-offerTraveller">'
+ '												<li class="adult">1 ERW.</li>'
+ '												<li class="adult selected">2 ERW.</li>'
+ '												<li class="divider">&nbsp;</li>'
+ '												<li class="child selected">1 KIND</li>'
+ '												<li class="child">2 KINDER</li>'
+ '											</ul>'
+ '											<h4>' + translationsTextHogaCore["Reisedauer"] + '</h4>'
+ '											<ul class="details-offerDuration">'
+ '												<li>1 TAG</li>'
+ '												<li>3 TAGE</li>'
+ '												<li class="selected">5 TAGE</li>'
+ '												<li>7 TAGE</li>'
+ '												<li>14 TAGE</li>'
+ '											</ul>'
+ '										</div>'
+ '										<div class="details-offerRightPane">'
+ '											<div class="details-offerAirport">'
+ '												<a href="" class="details-offerAirportBtnUp">&nbsp;</a>'
+ '												<a href="" class="details-offerAirportBtnDown">&nbsp;</a>'
+ '												<h5>' + translationsTextHogaCore["Abflughafen"] + '</h5>'
+ '												<div class="details-offerAirportScrollOuter">'
+ '													<div class="details-offerAirportScrollPane">'
+ '														<ul class="details-offerListAirport">'
+ '														</ul>'
+ '													</div>'
+ '												</div>'
+ '											</div>'
+ '											<div class="details-offerMonth">'
+ '												<a href="" class="details-offerMonthBtnUp">&nbsp;</a>'
+ '												<a href="" class="details-offerMonthBtnDown">&nbsp;</a>'
+ '												<h5>' + translationsTextHogaCore["Monat"] + '</h5>'
+ '												<div class="details-offerMonthScrollOuter">'
+ '													<div class="details-offerMonthScrollPane">'
+ '														<ul class="details-offerListMonth">'
+ '														</ul>'
+ '													</div>'
+ '												</div>'
+ '											</div>'
+ '											<div class="details-offerDay">'
+ '												<a href="" class="details-offerDayBtnUp">&nbsp;</a>'
+ '												<a href="" class="details-offerDayBtnDown">&nbsp;</a>'
+ '												<h5>' + translationsTextHogaCore["Tag"] + '</h5>'
+ '												<div class="details-offerDayScrollOuter">'
+ '													<div class="details-offerDayScrollPane">'
+ '														<ul class="details-offerListDay">'
+ '														</ul>'
+ '													</div>'
+ '												</div>'
+ '											</div>'
+ '										</div>'
+ '										<div style="clear:both"></div>'
+ '									</div>'
+ '								</div>';

													// Hotelslider loeschen
													$('#hotelDetailSlider div').children().remove();
													
													// Hoteldetails einfuegen
													$(element).html(html);
													
													if (typeof(data.TrustYouId) !== 'undefined' && data.TrustYouId != "")
													{
														$('.details-trustyouPanel-overlay').bind('click', function(event) {
																jQuery('.trustyou-widget').click();
															}
														  );
													}
													
													//Video
													if ( typeof(data.HotelVideo) !== 'undefined' && data.HotelVideo != "") {
														
														$('#hotelNavi').append('<li id="hotelVideo-tab">' + translationsTextHogaCore["VIDEO"] + '</li>');
														controller.state.hotelVideo = data.HotelVideo;
														var hotelVideoId = data.HotelVideo;//'76'; //140855
														//var hotelVideo  = data.HotelVideo.split("+");
														if ( $.browser.msie === true ) {
															$('.details-tab-video').html('<embed id="tvtripPlayerContainer" width="360" height="250" flashvars="id=' + hotelVideoId + '&rootUrl=http://www.tvtrip.com&key=ABQIAAAAMZ1hHlEDygsHoVRCKsqU_RTQblBBuoRf37zFCwnhVBC7rNtOQRSgCkSMb8prk_lKZKRZ5xq3Qeea8g&url=http://www.tvtrip.com/hotelXML?id=' + hotelVideoId + '&provenance=overview" autoplay="false" name="playerLink" swliveconnect="true" allowfullscreen="true" bgcolor="#ffffff" pluginspage="http://www.adobe.com/go/getflashplayer" type="application/x-shockwave-flash" src="http://www.tvtrip.com/swf/www/main.swf" style="display: block;"/>');
														}
														else
														{
															$('.details-tab-video').html('<div class="playerHome" id="player" style="background-color: #FFFFFF; width: 360px;"><embed height="250" width="360" flashvars="id=' + hotelVideoId + '&amp;rootUrl=http://www.tvtrip.com&amp;key=ABQIAAAAMZ1hHlEDygsHoVRCKsqU_RTQblBBuoRf37zFCwnhVBC7rNtOQRSgCkSMb8prk_lKZKRZ5xq3Qeea8g&amp;url=http://www.tvtrip.com/hotelXML?id=' + hotelVideoId + '" autoplay="false" allowfullscreen="true" bgcolor="#ffffff" pluginspage="http://www.adobe.com/go/getflashplayer" type="application/x-shockwave-flash" id="tvtripPlayerContainer" src="http://www.tvtrip.com/swf/www/home-noPrice.swf" style="display: block;"/></div>');
														}	
													}
													else
													{
														controller.state.hotelVideo = '';
													}										
													
													controller.offer.state.data.teaserDuration = data.OfferTeaser.Duration;
													if(controller.state.destStatus == 'JP')
													{
														if (controller.state.destination != "RSW" && controller.state.destination != "MIA" && controller.state.destination != "ALC" && controller.state.destination != "PMI" && controller.state.destination != "BKK" && controller.state.destination != "GWT") {
															controller.offer.state.data.teaserDuration = 3;
														}										  
													}
													else if(controller.state.destStatus == 'PMIES')
													{
														if (controller.state.destination == 190) 
															controller.offer.state.data.teaserDuration = 4;
									  					else
															controller.offer.state.data.teaserDuration = 3;
													}
										
													// Tipp ausblenden, falls leer
													if (data.Tipp == "") 
														$('.details-tabsContainer .tip-tab').hide();														
														
													// Scrollbars anzeigen
													$('.details-tab-tip').show();
													$('.details-infoTextScrollPane').jScrollPane({showArrows:true, scrollbarWidth: 17});
													$('.details-tab-tip').hide();
													
// PAUL - TRUST YOU - ausblenden, falls leer
													if (data.Tipp == "") 
														$('.details-tabsContainer .tip-trustyou').hide();													
																										
// PAUL - TRUST YOU - Scrollbars anzeigen [FUNKTIONIERT NOCH NICHT]
													// $('.details-tab-trustyou').show();
													// $('.details-infoTextScrollPane').jScrollPane({showArrows:true, scrollbarWidth: 17});
													// $('.details-tab-trustyou').hide();

													controller.offer.state.data.hotel_dbkey = hotelCode;
													
													// Tabs erstellen
													$('.details-tabsContainer li').click(function(){
														var mapping = {	BESCHREIBUNG: 'description',
																		TIPP: 'tip',
																		KARTE: 'map',
																		VIDEO: 'video',
// PAUL TRUST YOU
																		TRUSTYOU: 'trustyou'}
														var mapped = mapping[$(this).text()];
														
														$('.details-infoContainer .details-infoText').hide();
														$('.details-infoContainer .details-tab-' + mapped).show();
														
														$('.details-tabsContainer li').removeClass('tabSelected');
														$(this).addClass('tabSelected');
														
														if(mapped == 'map' && !controller.state.noGoogleMaps) {
					
				
														if(!controller.state.isGoogleMapsInit)
														 {
														 	controller.state.isGoogleMapsInit = true;								
														
															if (!controller.state.noGoogleMaps && data.Longitude != '') {
																controller.state.infomap = new GMap2(document.getElementById('details-map-' + hotelCode));
																controller.state.infomap.setCenter(new GLatLng(50, 10), 12);
																
																// Steuerungselemente und Maßstab in Karte einfügen
																controller.state.infomap.addControl(new GMapTypeControl());
																controller.state.infomap.addControl(new GLargeMapControl());
																controller.state.infomap.addControl(new GScaleControl());
																
													        											// Hotel Marker einfuegen
																var icon;
																var width = 32;
																var height = 34;
																var defaultIcon = new GIcon(G_DEFAULT_ICON);
																defaultIcon.iconAnchor = new GPoint(16, 16);
																defaultIcon.infoWindowAnchor = new GPoint(-15, 15);
																icon = new GIcon(defaultIcon);
																icon.image = controller.state.path_prefix + "/_images/hotelGalerie/hotel_icon.png";
																icon.iconSize = new GSize(width, height);
																icon.shadow = controller.state.path_prefix + "/_images/hotelGalerie/hotel_icon_shadow.png";
																icon.shadowSize = new GSize(width, height);
																icon.transparent = controller.state.path_prefix + "/_images/hotelGalerie/hotel_icon_trans.png";
																icon.imageMap = [0,0, width-1,0, width-1,height-1, 0,height-1];
																
			        											var point = new GLatLng(data.Latitude, data.Longitude);
																var marker = new GMarker(point, icon);
																controller.state.infomap.addOverlay(marker);				
																
															}
														 }
															
															// checkResize aufrufen, da es sonst Probleme gibt, da die Karte in einem hidden div geladen wird
        													controller.state.infomap.checkResize();
	        												// Karte auf den Marker zentrieren
	        												controller.state.infomap.setCenter(new GLatLng(data.Latitude, data.Longitude), 13);
        												}
													});
													
													// Kleine Karte (Google Maps) einfügen, wenn Geokoordinaten vorhanden sind
													if(!controller.state.noGoogleMaps && data.Longitude != '' && controller.state.language == "de") {
				
	        											$('.details-map-link').click(function(){
	        												$('.details-tabsContainer li:contains(\'' + translationsTextHogaCore["KARTE"] + '\')').trigger('click');
	        											});
        											}
        											else // Karte verstecken falls keine Koordinaten vorhanden sind
        												$('.details-tabsContainer li:contains(' + translationsTextHogaCore["KARTE"] + '), .details-btnPanel').hide();										
													// Carousel erstellen
													controller.carousel.create(element, data.Images);
													
													if(typeof callback != 'undefined')
														callback(element);
												
												});
										}
														
					},
					
					
					
	// Google Maps
	map:		{
				
						init:		function(destAreaTLC, data) {

										if(destAreaTLC != "")
											$('#btnShowMapPane img').attr('src', 'http://maps.google.com/staticmap?center=' + destArea_mapData[destAreaTLC]['center'][1] + ',' + destArea_mapData[destAreaTLC]['center'][0] + '&zoom=' + (destArea_mapData[destAreaTLC]['zoom']-3) + '&size=92x45&hl=' + controller.state.language + '&key=' + controller.state.googleMapsKey);
										
										if(controller.state.noGoogleMaps || !GBrowserIsCompatible())
											return; // Keine GoogleMap anzeigen
										
	       								controller.state.map = new GMap2(document.getElementById("mapCanvas"));
	       								// Große Karte einfügen, wenn Geokoordinaten vorhanden sind
	       								if (destArea_mapData[destAreaTLC]) 
	        								controller.state.map.setCenter(new GLatLng(destArea_mapData[destAreaTLC]['center'][1], destArea_mapData[destAreaTLC]['center'][0]), destArea_mapData[destAreaTLC]['zoom']);
										// Deutschlandkarte anzeigen, wenn keine Geokoordniaten verfügbar sind
										else
		        							controller.state.map.setCenter(new GLatLng(50.757886, 10.240819), 6);
										
	        							// Steuerungselemente und Maßstab in Karte einfügen
	        							controller.state.map.addControl(new GMapTypeControl());
	        							controller.state.map.addControl(new GLargeMapControl());
										controller.state.map.addControl(new GScaleControl());
										
	        							this.insertHotels(data);
						},
				
						insertHotels:		function(data) {
										/*
										 * Der nachfolgende Block setzt bei der Wetten-Dass-Galerie einen Marker
										 * auf das Coliseo in die Googlemaps
										 * Diesen Block bitte nicht entfernen, dieser wird nächstes Jahr für
										 * Wetten-Dass sicherlich wieder benötigt 
										 *
										// Wetten, dass...
										if(controller.state.destStatus == "WD") {
											var wettenDasIcon;
											var width = 40;
											var height = 25;
											wettenDasIcon = new GIcon(new GIcon(G_DEFAULT_ICON));
											wettenDasIcon.image = controller.state.path_prefix+"/_images/hotelGalerie/wettendass/logo.png";
											wettenDasIcon.iconSize = new GSize(width, height);
											wettenDasIcon.shadow = controller.state.path_prefix+"/_images/hotelGalerie/wettendass/logo_shadow.png";
											wettenDasIcon.shadowSize = new GSize(width, height);
											wettenDasIcon.transparent = controller.state.path_prefix+"/_images/hotelGalerie/wettendass/logo_trans.png";
											wettenDasIcon.infoWindowAnchor = new GPoint(-16, 16);
											wettenDasIcon.imageMap = [0,0, width-1,0, width-1,height-1, 0,height-1];
										
											var point = new GLatLng(39.583624, 2.658220);
											var marker = new GMarker(point, wettenDasIcon);
											
											GEvent.addListener(marker, "mouseover", function() {
												// alte Timeouts loeschen, wenn ein neues Info-Window geoeffnet wird
												clearTimeout(controller.state.timeout);
												
												marker.openExtInfoWindow(
													controller.state.map,
													"hotelInfoWindow",
													"<h5>Palma de Mallorca</h5><h4>Coliseo Balear - " + translationsTextHogaCore["Stierkampfarena"] + "</h4>" + "<div><img src=\"" + controller.state.path_prefix + "/_images/hotelGalerie/wettendass/arena.jpg\" /></div><p>" + translationsTextHogaCore["HierShow"] + "</p>"
												);
											});
			
											GEvent.addListener(marker, "mouseout", function() {
												// Marker nach 2 sek. entefernen
												controller.state.timeout = setTimeout('controller.map.fadeOutMarker()', 2000 );
											});
											
											controller.state.map.addOverlay(marker);
										}
										*/
							
										// Icons initialisieren
										var defaultIcon = new GIcon(G_DEFAULT_ICON);
										defaultIcon.iconAnchor = new GPoint(16, 16);
										defaultIcon.infoWindowAnchor = new GPoint(-15, 15);
										var icons = [];										
										icons[2] = this.makeStarIcon(2, 90, 45, defaultIcon);
										icons[3] = this.makeStarIcon(3, 105, 45, defaultIcon);
										icons[4] = this.makeStarIcon(4, 120, 45, defaultIcon);
										icons[5] = this.makeStarIcon(5, 132, 45, defaultIcon);
										
										$.each(data, function(i,item){
										    // Punkt erstellen
											var point = new GLatLng(item.Latitude, item.Longitude);
											
											// Marker erstellen
											var marker = new GMarker(point, icons[item.Category]);
											
											// Öffne das Hotel, wenn auf den Marker geklickt wird
											GEvent.addListener(marker, "click", function() {
												var reference = $('#overview-' + item.Hotelcode);
												controller.category.renderer.overview_startLoading();
												$.scrollTo(108, {duration: 1000, onAfter:function() { controller.category.loadDetail(reference, true); }});
											});
											
											// Im IE6 keine InfoWindows zu den Hotelmarkern anzeigen
											if (!(jQuery.browser.msie && parseInt(jQuery.browser.version.substr(0,1), 10) < 7)) {
												// Tooltip einfuegen
												GEvent.addListener(marker, "mouseover", function() {
													// alte Timeouts loeschen, wenn ein neues Info-Window geoeffnet wird
													clearTimeout(controller.state.timeout);
													
													var locationText = item.Location;
													if (locationText == "") locationText = "&nbsp;";
													
													marker.openExtInfoWindow(
														controller.state.map,
														"hotelInfoWindow",
														"<h5>" + locationText+ "</h5><h4>" + item.Name + "</h4>" + "<div><img src=\"" + item.ImageMap + "\" /></div><p>" + item.Adress.replace(/\r\n/g,'\r\n<br />') + "</p>"
													);
												});
	
												GEvent.addListener(marker, "mouseout", function() {
													// Marker nach 2 sek. entefernen
													controller.state.timeout = setTimeout('controller.map.fadeOutMarker()', 2000 );
												});
											}
											
											
											// Marker einfuegen:
											controller.state.map.addOverlay(marker);
      								  });

						},
						
						makeStarIcon:		function(stars, width, height, inherit) {
												var icon;
												icon = new GIcon(inherit);
												icon.image = controller.state.path_prefix+"/_images/hotelGalerie/icons/icon_" + stars + "stars.png";
												icon.iconSize = new GSize(width, height);
												icon.shadow = controller.state.path_prefix+"/_images/hotelGalerie/icons/icon_shadow_" + stars + "stars.png";
												icon.shadowSize = new GSize(width, height);
												icon.transparent = controller.state.path_prefix+"/_images/hotelGalerie/icon_" + stars + "stars.png";
												icon.imageMap = [0,0, width-1,0, width-1,height-1, 0,height-1];
												
												return icon;
						},
						
						fadeOutMarker:		function() {
												var fadeTime = 700;
												var topOffset = parseInt($("#hotelInfoWindow").css("top"), 10) - 20;
												$("#hotelInfoWindow div").fadeOut(fadeTime);
												$("#hotelInfoWindow").animate({top: topOffset}, fadeTime);
						}
				
				},
	
	
	
	carousel:	{
						create:				function(scope, data) {
        												// Bilder einfuegen
        												$.each(data, function(i,item){
															var html = '<div class="imageDiv" style="background-image: url(\'' + item.small + '\')" title="' + item.medium +'"></div><div class="imageBorder"></div>';
															
															$('<li></li>').append(html)
															.appendTo($('.carousel ul', $(scope)))
															.children('.imageBorder').click( function() {
																$(".carousel ul li .imageBorder").removeClass('imageBorderActive');
																
																$(this).addClass('imageBorderActive');
      															controller.carousel.updateMediumImage( this, i, item.Text );
    														});
														});
														
														$('.carousel ul').css({ left: '0px' });
														
														$('.site span').html($(data).size());
														controller.state.imageCount = $(data).size();
														
														// Button aktivieren
														if($(data).size() > 3) {
															$('.carousel-next').removeClass('carousel-navi-deactive');
															$('.carousel-next').bind("click", controller.carousel.move);
														}
														
														// Erstes Bild anzeigen
														$('.carousel ul li:first .imageBorder', $(scope)).click();
																											
														// Fancybox erstellen
														// $(".bigImageTrigger").fancybox();
														
														// Fancybox an den Click auf den Magnifier binden
														$('.medium-image-magnifier').click(function(){
															$('.bigImageTrigger').click();
														});
						},
						
						move:			function() {
											var me = this;
				
											if($(me).is('.carousel-next'))
												offset = -3
											else
												offset = 3
				
											var leftValue = parseInt($('.carousel ul').css('left'), 10);
											var pageNum = leftValue/60;
											var scrollTo = pageNum+offset;
				
											/*if(scrollTo <= -imageCount) {
												scrollTo = -imageCount+3;
											}
											else if(scrollTo >= 0) {
												scrollTo = 0;
											}*/
				
											$(me).unbind();
				
											$('.carousel ul').animate({left: scrollTo*60}, 800, function() {
													$('.carousel-navi').not($(me)).bind("click",controller.carousel.move).removeClass('carousel-navi-deactive');
													if(scrollTo-3 <= -controller.state.imageCount || scrollTo+3 >= 0) {
														$(me).addClass('carousel-navi-deactive');
													}
												});
						},
						
						updateMediumImage:	function (reference, number, description) {
												var mediumImage = $(reference).siblings('.imageDiv').attr('title');
												var bigImage = $(reference).siblings('.imageDiv').attr('title').replace(/240x160_/, '');
												
												var scope = $(reference).parents('.details-hotelDescription');
												
												$('.text').html(description);
												$('.site strong').html(number+1);
												
												// $('.medium-image', scope).children('a').remove().end()
												// .prepend('<a class="bigImageTrigger" href="' + bigImage + '"><img src="' + mediumImage + '" /></a>')
												// .children('a').fancybox({'hideOnContentClick': true});
				
												$(".medium-image-real", scope).css({'background-image': "url('" + mediumImage +"')"});
						}
				},
	
	details:	{
			
			beautyfier:		{
				
				beautifyHotelDescription:	function(description) {
				
												var result = description;
												result = result.replace(/\r\n/g, '<br />');
												result = result.replace(/\n/g, '<br />');
												if (result.indexOf('<br />') == 0) result = result.replace('<br />', '');
												if(result.indexOf('<br />') <= 40)
												{
													var header = result.substr(0, result.indexOf('<br />'));
													if ((result.indexOf('LAGE:') > 0) || (result.indexOf('Lage:') > 0))
														result = '<strong>' + header + '</strong>' + result.replace(header, '');
												}
												
												result = result.replace('LAGE:', '<strong>LAGE&nbsp;</strong>');
												result = result.replace('Lage:', '<strong>LAGE&nbsp;</strong>');
												result = result.replace('AUSSTATTUNG:', '<strong>AUSSTATTUNG&nbsp;</strong>');
												result = result.replace('Hotelbeschreibung:', '<strong>HOTELBESCHREIBUNG&nbsp;</strong>');
												result = result.replace('UNTERBRINGUNG:', '<strong>UNTERBRINGUNG&nbsp;</strong>');
												result = result.replace('Zimmerbeschreibung:', '<strong>ZIMMERBESCHREIBUNG&nbsp;</strong>');
												result = result.replace('VERPFLEGUNG:', '<strong>VERPFLEGUNG&nbsp;</strong>');
												result = result.replace('SPORT/UNTERHALTUNG:', '<strong>SPORT/UNTERHALTUNG&nbsp;</strong>');
												result = result.replace('SPORT', '<strong>SPORT&nbsp;</strong>');
												result = result.replace('GEGEN GEB&Uuml;HR:', '<strong>GEGEN GEB&Uuml;HR&nbsp;</strong>');
												result = result.replace('WELLNESS:', '<strong>WELLNESS&nbsp;</strong>');
												result = result.replace('WELLNESS', '<strong>WELLNESS&nbsp;</strong>');
												result = result.replace('KINDER:', '<strong>KINDER&nbsp;</strong>');
												result = result.replace('KREDITKARTEN:', '<strong>KREDITKARTEN&nbsp;</strong>');
												result = result.replace('OFFIZIELLE LANDESKATEGORIE:', '<strong>OFFIZIELLE LANDESKATEGORIE&nbsp;</strong>');
												result = result.replace('TRANSFER:', '<strong>TRANSFER&nbsp;</strong>');
												result = result.replace('HINWEIS:', '<strong>HINWEIS&nbsp;</strong>');
												result = result.replace('HINWEISE:', '<strong>HINWEISE&nbsp;</strong>');
												result = result.replace('INFO:', '<strong>INFO&nbsp;</strong>');

												result = result.replace('VIENNA CARD:', '<strong>VIENNA CARD&nbsp;</strong>');
												result = result.replace('ANREISE:', '<strong>ANREISE&nbsp;</strong>');
												
												return result;
											}
				
			}
		
	},
		
	offer: {
						state:		{
										collapsed: false,
										lists:			{
															airport:	{
																			wheelDelta:			0.0,
																			wheelDeltaAmount: 	0
																		},
															month:		{
																			wheelDelta:			0.0,
																			wheelDeltaAmount: 	0
																		},
															day:		{
																			wheelDelta:			0.0,
																			wheelDeltaAmount:	0
																		}
														},
										scrollTimer:	{
															intervall:		null,
															elem:			null,
															scrollElem:		null,
															functionStr:	null
														},
										data:			{
															destStatus: 	'B',
															dest_tlc: 		'',
															hotel_code: 	'',
															hotel_dbkey: 	''
														},
										restore:		{
															adults_count: 	null,
															children_count:	null,
															duration:		null,
															airport:		null,
															destAirport:	null,
															month:			null,
															year:			null
														}
									},
									
						config:		{
											scrollSpeed:		50,
											scrollDelay:		500,
											wheelDeltaDivider:	5,
											listItemHeight:		24
									},
										
						factory:	{
										listItem:		function(childElemArray, id, onclick, active, cssDefinitions) {
															if (active == undefined || active == null) active = true;
															var $newElem = $('<li></li>');
															for (var i = 0; i < childElemArray.length; i++) {
																$newElem.append(childElemArray[i]);
															}
															if (id) $newElem.attr('id', id);
															if (active) {
																$newElem.hover(controller.offer.processor.listItem_hover_over,
																			   controller.offer.processor.listItem_hover_out);
																$newElem.bind('click', controller.offer.processor.listItem_select);
															}
															if (onclick) $newElem.bind('click', onclick);
															if (cssDefinitions) $newElem.css(cssDefinitions);
															return $newElem;
														}
										
									},
						animator: 	{
						
										startLoading:			function() {
																	$('.details-btnOffer').css({ backgroundPosition: 'left -29px'});
																	$('#details-btnOfferLoading').show();
																},
															
										finishedLoading:		function() {
																	$('#details-btnOfferLoading').hide();
																	$('.details-btnOffer').css({ backgroundPosition: 'left 0px'});
																	//$('#details-btnOfferArrow').removeClass('arrowDown').addClass('arrowUp');
																	//$('#details-btnOfferText').html('<em>Angebote</em> ausblenden');
																},
															
										startFolding:			function() {
																	$('.details-btnOffer').css({ backgroundPosition: 'left -29px'});											
																},
						
										finishedFolding:		function() {
																	$('.details-btnOffer').css({ backgroundPosition: 'left 0px'});
																	//$('#details-btnOfferArrow').removeClass('arrowUp').addClass('arrowDown');
																	//$('#details-btnOfferText').html('<em>Angebote</em> f&uuml;r dieses Hotel');											
																},
															
										startListLoading:		function(listID) {
																	$('.' + listID).children().remove().end().append('<li class="loading"><img src="'+controller.state.path_prefix+'/_images/hotelGalerie/loading_offer_white.gif" alt="loading" /></li>');		
																},
															
										finishedListLoading:	function(listID) {
																	$('.' + listID).children().remove();
																},
										
										showOfferlist:		function(scrolling) {
																$("#gallerybox").css({height: "1065px"});
																$('#detailsContainer #details-navBottom').animate({top: "1011px"}, 500);
																$('#detailsContainer #details-btnBackBottom').animate({top: "1024px"}, 500);
																
																$(".details-hotelInnerContainer").css({height: "962px"});
																$('.details-offerContainerFader').show();
																$('.details-offerContainer').show();
																$('.details-offerContainerFader').fadeOut(400);
																
																if(scrolling)
																	$.scrollTo(660, {duration: 1000});
															},
										hideOfferlist:		function(callback) {
																$('.details-offerContainerFader').fadeIn(400, function() {
																	$.scrollTo(108, {duration: 800, onAfter: function() {
																		$('.details-offerContainer').hide();
																		$('.details-offerContainerFader').hide();
																		$("#gallerybox").animate({height: "585px"});
																		$(".details-hotelInnerContainer").animate({height: "482px"});
																		$('#detailsContainer #details-btnBackBottom').animate({top: "545px"});
																		$('#detailsContainer #details-navBottom').animate({top: "532px"});
																		if (callback) callback();							
																	}});
																});
															},
															
										showFlashLoader:	function () {
																var flash = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0\" width=\"650\" height=\"299\">"
 + "					<param name=\"movie\" value=\"" + controller.state.path_prefix + "/_images/hotelGalerie/loading_" + controller.state.language + ".swf\" />"
 + "					<param name=\"quality\" value=\"high\" />"
 + "					<embed src=\"" + controller.state.path_prefix + "/_images/hotelGalerie/loading_" + controller.state.language + ".swf\" quality=\"high\" pluginspage=\"://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"650\" height=\"299\"  style=\"margin-left: -15px; margin-top: 20px;\"></embed >";
 
 																
 																$('div.details-offerCanvas').html(flash);
 																$('#detailsContainer .details-offerContainer .details-offerCanvas').css({'border': 'none', 'background-color': 'white'});									
										
															}
							
									},
						
						renderer:	{
										//TODO:
										hideDetails: function(){
											$('.details-offerContainerFader').fadeIn(400, function() {
																	$.scrollTo(108, {duration: 800, onAfter: function() {
																		$('.details-offerContainer').hide();
																		$('.details-offerContainerFader').hide();
																		$("#gallerybox").animate({height: "585px"});
																		$(".details-hotelInnerContainer").animate({height: "482px"});
																		$('#detailsContainer #details-btnBackBottom').animate({top: "545px"});
																		$('#detailsContainer #details-navBottom').animate({top: "532px"});
																		if (callback) callback();							
																	}});
																});
										},
										showSpezialDetails: function(categoryID) {

												if (controller.state.lastDetails != '') {

													$('#category-' + controller.state.lastDetails + '-Details').hide();
													$('#category-' + controller.state.lastDetails + '-Close').show();
													$('#category-' + controller.state.lastDetails).css({height: '45px'});

												}
												if (categoryID != controller.state.fixedDetail) {

													$('#category-' + controller.state.fixedDetail).addClass('category-inactive');
													$('#arrow-right-' + controller.state.fixedDetail).addClass('wd-arrow-right');
													//$('#category-' + categoryID + '-Details').show();
													//$('#category-' + categoryID + '-Close').hide();
													$('#category-' + categoryID).css({height: '45px'});

													controller.state.lastDetails = categoryID;
												}
												else
												{
													
													$('#arrow-right-' + controller.state.fixedDetail).removeClass('wd-arrow-right');
													$('.category-selected').removeClass('category-inactive');
												}
									
												//Anpassung Radiobutton
												$('#category-' + categoryID + '-Close').children("input[@type=radio]").click();

										},
										travellerList:		function(json) {
																// Anzahl der erwachsenen wiederherstellen
																if($.inArray(String(controller.offer.state.restore.adults_count), json.adults.data) == -1)
																	controller.offer.state.restore.adults_count = parseInt(json.adults.selected, 10);
																
																var $list = $('#details-' + controller.offer.state.data.hotel_dbkey +  ' .details-offerTraveller');
																
																$list.children().remove();
																$.each(json.adults.data, function(){
																	var $newElem = $('<li class="adult" id="adults-' + this + '">' + this + ' ' + translationsTextHogaCore["Erw"] + '</li>');
																	if (this == controller.offer.state.restore.adults_count) 
																		$newElem.addClass('selected');
																	$list.append($newElem);
																});
																
																$list.children().hover(function() {
																		if (!$(this).is('.selected')) $(this).addClass('hover');
																	}, function() {
																		if (!$(this).is('.selected')) $(this).removeClass('hover');
																	});
																$list.children().bind('click', controller.offer.processor.traveller_adult_click);
																
																// Button zum Kinderbuchen anzeigen
																var $newElem = $('<li style="padding-left:0px;padding-top:5px;' + (controller.state.language != "de" ? 'display:none;' : '') + '"><img src="'+controller.state.path_prefix+'/_images/hotelGalerie/btn_wettendass_children.gif" alt="Reisen mit Kindern" /></li>')


																/*
																 * Der nachfolgende Block ist notwendig für die Kinder-Buchung in der Wetten-Dass-Galerie
																 * Die auskommentierten Zeilen bitte nicht entfernen, diese werden nächstes Jahr für
																 * Wetten-Dass sicherlich wieder benötigt 
																 */
																//if (controller.state.destStatus != "WD")
																	$newElem.bind('click', function() {
																			var link = controller.state.path_prefix + '/dyn_step_1_flugauswahl.php?startmode=hotelgallery';
																			if (controller.state.agency != '') link += '&agency=' + controller.state.agency;
																			if (controller.state.user != '') link += '&user=' + controller.state.user;
																			if (controller.state.password != '') link += '&password=' + controller.state.password;
																			if (controller.state.serverNameSession != '') link += '&serverNameSession=' + controller.state.serverNameSession;
																			if (controller.state.language != '') link += '&lang=' + controller.state.language;
																			link += '&childsinit=1&destStatus=' + controller.state.destStatus;
																			link += '&numAdults=2&numChilds=1&da=TXL&aa=' + controller.state.destTLC;
																			window.location.href = link;
																		});
																//else
																//	$newElem.bind('click', function() {
																//		window.location.href = 'dyn_step_1_flugauswahl.php?startmode=wettendasskinder';
																//	});
																		
																$list.append($newElem);
																
																/*if (json.children != undefined && json.children.data[0] != '0') {
																	$list.append('<li class="divider">&nbsp;</li>');
																	for (var i = 0; i < json.children.data.length; i++) {
																		var childCount = json.children.data[i];
																		var text = 'Kinder';
																		if (childCount == 1) text = 'Kind';
																		var $newElem = $('<li>' + childCount + ' ' + text + '</li>');
																		if (childCount == parseInt(json.children.selected, 10)) 
																			$newElem.addClass('selected');
																		$newElem.addClass('child');
																		$newElem.attr('id','children-' + childCount);
																		$newElem.hover(function() {
																				if (!$(this).is('.selected')) $(this).addClass('hover');
																			}, function() {
																				if (!$(this).is('.selected')) $(this).removeClass('hover');
																			});
																		$newElem.bind('click', controller.offer.processor.traveller_child_click);
																		$list.append($newElem);
																	}
																}*/
																controller.offer.state.restore.adults_count = parseInt(json.adults.selected, 10);
																controller.offer.state.restore.children_count = parseInt(json.children.selected, 10);
															},
										durationList:		function(json) {
																var $list = $('#details-' + controller.offer.state.data.hotel_dbkey +  ' .details-offerDuration');
																$list.children().remove();
																$.each(json.data, function() {
																	$list.append('<li id="duration-' + this + '">' + this + ' ' + (this == 1 ? translationsTextHogaCore["Nacht"] : translationsTextHogaCore["Naechte"]) + '</li>');
																});
																
																$list.children().hover(controller.offer.processor.listItem_hover_over,
																	controller.offer.processor.listItem_hover_out);
																$list.children().bind('click', controller.offer.processor.duration_click);
																
																// Wunschdauer der Reise als Standard nehmen, wenn noch keine andere gewählt wurde
																if($.inArray(parseInt(controller.offer.state.restore.duration, 10), json.data) == -1)
																	controller.offer.state.restore.duration = parseInt(json.selected, 10);
																
																// Anzahl der Nächte wiederherstellen
																$('.details-offerDuration #duration-' + controller.offer.state.restore.duration).click();
															},
										airportList:		function(json) {
																var $list = $('#details-' + controller.offer.state.data.hotel_dbkey +  ' .details-offerListAirport');
																$list.children().remove();
																var count = 0;
																for (var airportKey in json) {
																	count++;
																	var airport = json[airportKey];
																	if(count == 1)																	
																		controller.state.destTLC = airport.destTLC;
																		
																	var abStr = translationsTextHogaCore["ab"];
																	if (abStr == "desde") abStr = "de";
																	$list.append(controller.offer.factory.listItem([
																			'<div class="listText-destination">' + controller.offer.beautyfier.beautifyAirportName(airport.name) + '</div>',
																			'<div class="listText-price"><span>' + abStr + '</span> ' + airport.price + ' &euro;</div>'
																		], 'airport-' + airportKey + airport.destTLC, controller.offer.processor.airport_click, true, {cursor: 'pointer'}));
																}
																$('.details-offerAirportBtnUp').css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_up_inactive.gif)"}).unbind();
																$('.details-offerAirportBtnDown').css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_down_inactive.gif)"}).unbind();																		
																$('.details-offerAirportBtnUp')
																	.bind('click', controller.offer.processor.nothing)
																	.bind('mouseup', controller.offer.processor.list_mouseup);
																$('.details-offerAirportBtnDown')
																	.bind('click', controller.offer.processor.nothing)
																	.bind('mouseup', controller.offer.processor.list_mouseup);
																if (count > 15) {
																	$('.details-offerAirportBtnDown')
																		.css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_down.gif)"})
																		.bind('mousedown', controller.offer.processor.list_mousedown);																		
																}
																controller.offer.state.lists.airport.itemCount = count;
																controller.offer.state.lists.airport.topItemNum = 1;
																$('.details-offerListAirport')
																	.css({top: '0px'})
																	.bind('mousewheel',
																		function (event, delta) {
																			controller.offer.state.lists.airport.wheelDelta += delta;
																			var newDeltaAmount = controller.offer.state.lists.airport.wheelDelta / controller.offer.config.wheelDeltaDivider;
																			if (newDeltaAmount != controller.offer.state.lists.airport.wheelDeltaAmount) {
																				var diff = newDeltaAmount - controller.offer.state.lists.airport.wheelDeltaAmount;
																				controller.offer.state.lists.airport.wheelDeltaAmount = newDeltaAmount;
																				if (diff < 0)
																					controller.offer.processor.list_scrollDown($('.details-offerAirportBtnDown'), $(this))
																				else
																					controller.offer.processor.list_scrollUp($('.details-offerAirportBtnUp'), $(this));																				
																			}
																			return false;
																		}
																	);
																$('.details-offerListAirport li:last').css({backgroundImage: 'none'});
																
																/* vorherig markierten Abflughafen wieder markieren */
																$('.details-offerListAirport li#airport-' + controller.offer.state.restore.airport + controller.offer.state.restore.destAirport).click();
															},
										monthList:			function(json) {
																var $list = $('#details-' + controller.offer.state.data.hotel_dbkey +  ' .details-offerListMonth');
																$list.children().remove();
																var count = 0;
																for (var year in json) {
																	$list.append(controller.offer.factory.listItem([
																			'<div class="listText-year">' + year + '</div>'
																		], null, null, false));
																	count++;
																	for (var monthKey in json[year]) {
																		var month = json[year][monthKey];
																		var abStr = translationsTextHogaCore["ab"];
																		if (abStr == "desde") abStr = "de";
																		$list.append(controller.offer.factory.listItem([
																				'<div class="listText-destination">' + month.name + '</div>',
																				'<div class="listText-price"><span>' + abStr + '</span> ' + month.price + ' &euro;' + ((controller.state.language == 'de' || controller.state.language == 'es' || controller.state.language == 'it') ? '<span class="arrow"> &raquo;</span>' : '') + '</div>'
																			], 'month-' + monthKey + '-' + year,controller.offer.processor.month_click, true, {cursor: 'pointer'}));
																		count++;
																	}
																}
																															
																$('.details-offerMonthBtnUp').css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_up_inactive.gif)"}).unbind();
																$('.details-offerMonthBtnDown').css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_down_inactive.gif)"}).unbind();																																		
																$('.details-offerMonthBtnUp')
																	.bind('click', controller.offer.processor.nothing)
																	.bind('mouseup', controller.offer.processor.list_mouseup);
																$('.details-offerMonthBtnDown')
																	.bind('click', controller.offer.processor.nothing)
																	.bind('mouseup', controller.offer.processor.list_mouseup);
																if (count > 15) {
																	$('.details-offerMonthBtnDown')
																		.css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_down.gif)"})
																		.bind('mousedown', controller.offer.processor.list_mousedown);	
																}
																controller.offer.state.lists.month.itemCount = count;
																controller.offer.state.lists.month.topItemNum = 1;
																$('.details-offerListMonth')
																	.css({top: '0px'})
																	.bind('mousewheel',
																		function (event, delta) {
																			controller.offer.state.lists.month.wheelDelta += delta;
																			var newDeltaAmount = controller.offer.state.lists.month.wheelDelta / controller.offer.config.wheelDeltaDivider;
																			if (newDeltaAmount != controller.offer.state.lists.month.wheelDeltaAmount) {
																				var diff = newDeltaAmount - controller.offer.state.lists.month.wheelDeltaAmount;
																				controller.offer.state.lists.month.wheelDeltaAmount = newDeltaAmount;
																				if (diff < 0)
																					controller.offer.processor.list_scrollDown($('.details-offerMonthBtnDown'), $(this))
																				else
																					controller.offer.processor.list_scrollUp($('.details-offerMonthBtnUp'), $(this));																				
																			}
																			return false;
																		}
																	);
																$('.details-offerListMonth li:last').css({backgroundImage: 'none'});
																
																// falls es ein WettenDass,..? Hotel ist, Logo anzeigen und Tage automatisch laden, nach Abflugauswahl
																if(controller.state.destStatus == 'WD' && controller.state.destination == 43 )
																{
																	$('.details-offerMonthScrollPane .WDMonthPic').remove();
																	$WDMonthLogo = $('.details-offerMonthScrollPane');
																	$WDMonthLogo.append('<div class="WDMonthPic" style="width:227px; height:181px; z-index:50; margin-left:7px; margin-top:10px;"><img src="http://www.binoli.de/web/pauschal/_images/hotelGalerie/wettendass/rightContentPane-WD-teaser-date-selection.png" border="0"></div>');
																	$('.details-offerListMonth li#month-MAI-2010').click();
																}
																
																if (controller.state.destStatus == 'O') 
																{
																	$('.details-offerListMonth li:second').click();
																}
																
																/* Selektiert den vorher ausgewählten Monat, wenn Abflughafen geändert wird */
																$('.details-offerListMonth li#month-' + controller.offer.state.restore.month + '-' + controller.offer.state.restore.year).click(); 
																
															},
										dayList:			function(json) {
																var $list = $('#details-' + controller.offer.state.data.hotel_dbkey +  ' .details-offerListDay');
																$list.children().remove();
																var count = 0;
																for (var dayKey in json) {
																	var day = json[dayKey];
																	var abStr = translationsTextHogaCore["ab"];
																	if (abStr == "desde") abStr = "de";
																	$list.append(controller.offer.factory.listItem([
																			'<div class="listText-destination"><span>' + day.name + '</span>' + dayKey + '.</div>',
																			'<div class="listText-price"><span>' + abStr + '</span> ' + day.price + ' &euro;' + ((controller.state.language == 'de' || controller.state.language == 'es' || controller.state.language == 'it') ? '<span class="arrow"> &raquo;</span>' : '') + '</div>'
																		], 'day-' + dayKey + '-' + day.airport + '-' + day.prepacked,controller.offer.processor.day_click, true, {cursor: 'pointer'}));
																	count++;
																}
																$('.details-offerDayBtnUp').css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_up_inactive.gif)"}).unbind();
																$('.details-offerDayBtnDown').css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_down_inactive.gif)"}).unbind();																																		
																$('.details-offerDayBtnUp')
																	.bind('click', controller.offer.processor.nothing)
																	.bind('mouseup', controller.offer.processor.list_mouseup);
																$('.details-offerDayBtnDown')
																	.bind('click', controller.offer.processor.nothing)
																	.bind('mouseup', controller.offer.processor.list_mouseup);
																	
																// Da der IE nur 14 Zeilen anzeigt, wird der Scroll-Down Button
																// eher als beim FF auf aktiv gesetzt
																var offsetIE = 15;
																if ($.browser.msie)
																	offsetIE = 14;
																	
																if (count > offsetIE) {
																	$('.details-offerDayBtnDown')
																		.css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_down.gif)"})
																		.bind('mousedown', controller.offer.processor.list_mousedown);	
																}
																controller.offer.state.lists.day.itemCount = count;
																controller.offer.state.lists.day.topItemNum = 1;
																$('.details-offerListDay')
																	.css({top: '0px'})
																	.bind('mousewheel',
																		function (event, delta) {
																			controller.offer.state.lists.day.wheelDelta += delta;
																			var newDeltaAmount = controller.offer.state.lists.day.wheelDelta / controller.offer.config.wheelDeltaDivider;
																			if (newDeltaAmount != controller.offer.state.lists.day.wheelDeltaAmount) {
																				var diff = newDeltaAmount - controller.offer.state.lists.day.wheelDeltaAmount;
																				controller.offer.state.lists.day.wheelDeltaAmount = newDeltaAmount;
																				if (diff < 0)
																					controller.offer.processor.list_scrollDown($('.details-offerDayBtnDown'), $(this))
																				else
																					controller.offer.processor.list_scrollUp($('.details-offerDayBtnUp'), $(this));																				
																			}
																			return false;
																		}
																	);
																$('.details-offerListDay li:last').css({backgroundImage: 'none'});
															},
																			
										clearList:			function(listName) {
																$('.details-offerList' + listName).children().remove();
															}
									},
									
						processor:	{
										toggleBtnOffer:		function(event) {
											// Angebote einblenden, falls sie noch nicht da sind
											if($('.details-offerContainer').css('display') == 'none') {
												controller.offer.loader.initial(function(){
														controller.offer.animator.showOfferlist(controller.state.doLandingPageActions);
														controller.state.doLandingPageActions = false;
												});
											}
											// Ansonsten nur zu den Angeboten scrollen
											else
												$.scrollTo(660, {duration: 1000});
											
											/* Angebote ein- und ausblenden ist deaktiviert (Samy)!
											// Angebotsliste Anzeigen
											if($('.details-offerContainer').css('display') == 'none') {
												controller.offer.animator.startLoading();
												
												// Angebote öffnen, wenn sie vorher geschlossen waren, oder wir eine Landingpage sind
												var scrolling = (controller.offer.state.collapsed || controller.state.doLandingPageActions);
												
												controller.offer.loader.initial(function(){
													controller.offer.animator.showOfferlist(scrolling);
													controller.offer.animator.finishedLoading();
													controller.state.doLandingPageActions = false;
												});
												
												controller.offer.state.collapsed = false;
											}
											// Angebotsliste ausblenden
											else {
												controller.offer.animator.startFolding();
												controller.offer.animator.hideOfferlist();
												
												$(this).animate({opacity: 1}, 1000, function() {
													controller.offer.animator.finishedFolding();
												});
												
												controller.offer.state.collapsed = true;
											}*/
											
											event.preventDefault();
										},
										
										list_mousedown:				function(event) {
																		var $this = $(this);
																		var $scrollElem = $(this).parent().find('ul');
																		switch($this.attr('class')) {
																			case 'details-offerAirportBtnDown':	
																			case 'details-offerMonthBtnDown':
																			case 'details-offerDayBtnDown':
																					controller.offer.processor.list_scrollDown($this, $scrollElem);
																					controller.offer.state.scrollTimer.elem = $this;
																					controller.offer.state.scrollTimer.scrollElem = $scrollElem;
																					controller.offer.state.scrollTimer.functionStr = "controller.offer.processor.list_scrollDown()";
																					controller.offer.state.scrollTimer.interval = window.setInterval("controller.offer.processor.scrollTimer()", controller.offer.config.scrollSpeed + controller.offer.config.scrollDelay);
																					break;
																			case 'details-offerAirportBtnUp':
																			case 'details-offerMonthBtnUp':
																			case 'details-offerDayBtnUp':
																					controller.offer.processor.list_scrollUp($this, $scrollElem);
																					controller.offer.state.scrollTimer.elem = $this;
																					controller.offer.state.scrollTimer.scrollElem = $scrollElem;
																					controller.offer.state.scrollTimer.functionStr = "controller.offer.processor.list_scrollUp()";
																					controller.offer.state.scrollTimer.interval = window.setInterval("controller.offer.processor.scrollTimer()", controller.offer.config.scrollSpeed + controller.offer.config.scrollDelay);
																					break;
																		}
																		event.preventDefault();
																	},
										scrollTimer:				function() {
																		window.clearInterval(controller.offer.state.scrollTimer.interval);
																		controller.offer.state.scrollTimer.interval = window.setInterval(controller.offer.state.scrollTimer.functionStr, controller.offer.config.scrollSpeed);																		
																	},
										list_mouseup:				function(event) {
																		window.clearInterval(controller.offer.state.scrollTimer.interval);																		
																		controller.offer.state.scrollTimer.interval = null;
																	},
										list_scrollDown:			function(elem, scrollElem) {
																		if (elem == undefined) elem = controller.offer.state.scrollTimer.elem;
																		if (scrollElem == undefined) scrollElem = controller.offer.state.scrollTimer.scrollElem;
																		
																		// Da der IE nur 14 Zeilen anzeigt, wird durch die Herabsetzung des Standardwertes für FF
																		// und andere Browser von 15 auf 14 die Sichtbarkeit aller Elemente gewährleistet.
																		var itemcountVisible = 15;
																		if ($.browser.msie)
																			itemcountVisible = 14;
																		
																		switch (scrollElem.attr('class')) {
																			case 'details-offerListAirport': 	
																				if (controller.offer.state.lists.airport.itemCount - controller.offer.state.lists.airport.topItemNum + 1 > itemcountVisible) {
																					controller.offer.state.lists.airport.topItemNum++;
																					
																					var newTop = controller.offer.config.listItemHeight * (controller.offer.state.lists.airport.topItemNum - 1); 
																					scrollElem.css({ top: '-' + newTop + 'px' });
																					
																					if (controller.offer.state.lists.airport.itemCount - controller.offer.state.lists.airport.topItemNum + 1 <= itemcountVisible) {
																						elem.trigger('mouseup');
																						elem
																							.css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_down_inactive.gif)"})
																							.unbind('mousedown');
																					}
																						elem.prev()
																							.css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_up.gif)"})
																							.bind('mousedown', controller.offer.processor.list_mousedown);
																				}
																				break;
																			case 'details-offerListMonth':	
																				if (controller.offer.state.lists.month.itemCount - controller.offer.state.lists.month.topItemNum + 1 > itemcountVisible) {
																					controller.offer.state.lists.month.topItemNum++;
																					var newTop = controller.offer.config.listItemHeight * (controller.offer.state.lists.month.topItemNum - 1); 
																					scrollElem.css({ top: '-' + newTop + 'px' });
																					if (controller.offer.state.lists.month.itemCount - controller.offer.state.lists.month.topItemNum + 1 <= itemcountVisible) {
																						elem.trigger('mouseup');
																						elem
																							.css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_down_inactive.gif)"})
																							.unbind('mousedown');
																					}
																						elem.prev()
																							.css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_up.gif)"})
																							.bind('mousedown', controller.offer.processor.list_mousedown);
																				}
																				break;
																			case 'details-offerListDay':
																				if (controller.offer.state.lists.day.itemCount - controller.offer.state.lists.day.topItemNum + 1 > itemcountVisible) {
																					controller.offer.state.lists.day.topItemNum++;
																					var newTop = controller.offer.config.listItemHeight * (controller.offer.state.lists.day.topItemNum - 1); 
																					scrollElem.css({ top: '-' + newTop + 'px' });
																					if (controller.offer.state.lists.day.itemCount - controller.offer.state.lists.day.topItemNum + 1 <= itemcountVisible) {
																						elem.trigger('mouseup');
																						elem
																							.css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_down_inactive.gif)"})
																							.unbind('mousedown');
																					}
																						elem.prev()
																							.css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_up.gif)"})
																							.bind('mousedown', controller.offer.processor.list_mousedown);
																				}
																				break;
																		}
																	},
										list_scrollUp:				function(elem, scrollElem) {
																		if (elem == undefined) elem = controller.offer.state.scrollTimer.elem;
																		if (scrollElem == undefined) scrollElem = controller.offer.state.scrollTimer.scrollElem;
																		switch (scrollElem.attr('class')) {
																			case 'details-offerListAirport': 	
																				if (controller.offer.state.lists.airport.topItemNum > 1) {
																					controller.offer.state.lists.airport.topItemNum--;
																					var newTop = controller.offer.config.listItemHeight * (controller.offer.state.lists.airport.topItemNum - 1); 
																					scrollElem.css({ top: '-' + newTop + 'px' });
																					if (controller.offer.state.lists.airport.topItemNum <= 1) {
																						elem.trigger('mouseup');
																						elem
																							.css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_up_inactive.gif)"})
																							.unbind('mousedown');
																					}
																					elem.next()
																						.css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_down.gif)"})
																						.bind('mousedown', controller.offer.processor.list_mousedown);
																				}
																				break;
																			case 'details-offerListMonth':	
																				if (controller.offer.state.lists.month.topItemNum > 1) {
																					controller.offer.state.lists.month.topItemNum--;
																					var newTop = controller.offer.config.listItemHeight * (controller.offer.state.lists.month.topItemNum - 1); 
																					scrollElem.css({ top: '-' + newTop + 'px' });
																					if (controller.offer.state.lists.month.topItemNum <= 1) {
																						elem.trigger('mouseup');
																						elem
																							.css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_up_inactive.gif)"})
																							.unbind('mousedown');
																					}
																					elem.next()
																						.css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_down.gif)"})
																						.bind('mousedown', controller.offer.processor.list_mousedown);
																				}
																				break;
																			case 'details-offerListDay':
																				if (controller.offer.state.lists.day.topItemNum > 1) {
																					controller.offer.state.lists.day.topItemNum--;
																					var newTop = controller.offer.config.listItemHeight * (controller.offer.state.lists.day.topItemNum - 1); 
																					scrollElem.css({ top: '-' + newTop + 'px' });
																					if (controller.offer.state.lists.day.topItemNum <= 1) {
																						elem.trigger('mouseup');
																						elem
																							.css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_up_inactive.gif)"})
																							.unbind('mousedown');
																					}
																					elem.next()
																						.css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_down.gif)"})
																						.bind('mousedown', controller.offer.processor.list_mousedown);
																				}
																				break;
																		}
																	},
										listItem_hover_over:		function() {
																		if (!$(this).is('.selected')) {
																				$(this).addClass('hover');
																				$(this).prev().addClass('hideBackground');
																				$(this).find('.arrow').addClass('hover');
																		}
																	},
										listItem_hover_out:			function() {
																		if (!$(this).is('.selected')) {
																			$(this).removeClass('hover');
																			$(this).prev().removeClass('hideBackground');
																			$(this).find('.arrow').removeClass('hover');
																		}
																	},
										listItem_select:			function() {
																		$(this).siblings().removeClass('hideBackground').removeClass('selected').removeClass('hover');
																		$(this).addClass('selected'); 
																		$(this).prev().addClass('hideBackground');
																	},
										traveller_adult_click:		function(event) {
																		$('.details-offerTraveller .adult').removeClass('selected');
																		$(this).removeClass('hover').addClass('selected');
																		controller.offer.state.restore.adults_count = $(this).attr('id').replace('adults-', '');
																		controller.offer.processor.leftPane_click();
																		event.preventDefault();
																	},
										traveller_child_click:		function(event) {
																		$('.details-offerTraveller .child').removeClass('selected');
																		$(this).removeClass('hover').addClass('selected');
																		controller.offer.state.restore.children_count = $(this).attr('id').replace('children-', '');
																		controller.offer.processor.leftPane_click();
																		event.preventDefault();
																	},
										duration_click:				function(event) {
																		$('.details-offerDuration li').removeClass('selected');
																		$(this).removeClass('hover').addClass('selected');
																		controller.offer.state.restore.duration = $(this).attr('id').replace('duration-', '');
																		controller.offer.processor.leftPane_click();
																		event.preventDefault();
																	},	
										leftPane_click:				function() {
																		// Alle Listen leeren
																		controller.offer.renderer.clearList('Day');
																		$('.details-offerDay h5').addClass('inactive');
																		$('.details-offerDayBtnUp').css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_up_inactive.gif)"}).unbind();
																		$('.details-offerDayBtnDown').css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_down_inactive.gif)"}).unbind();
																		controller.offer.renderer.clearList('Month');
																		$('.details-offerMonth h5').addClass('inactive');
																		$('.details-offerMonthBtnUp').css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_up_inactive.gif)"}).unbind();
																		$('.details-offerMonthBtnDown').css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_down_inactive.gif)"}).unbind();																		
																		controller.offer.renderer.clearList('Airport');
																		$('.details-offerAirportBtnUp').css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_up_inactive.gif)"}).unbind();
																		$('.details-offerAirportBtnDown').css({ backgroundImage: "url(" + controller.state.path_prefix + "/_images/hotelGalerie/details_offer_arrow_down_inactive.gif)"}).unbind();																											
																		// Neuladen der Listen starten
																		controller.offer.animator.startListLoading('details-offerListAirport');
																		$(this).wait(250, function() {
																				controller.offer.loader.airports();
																		});
																	},
										airport_click:				function() {
																		controller.offer.state.restore.airport = $(this).attr('id').replace('airport-', '').substr(0,3);
																		controller.offer.state.restore.destAirport = $(this).attr('id').replace('airport-', '').substr(3,3);
																		controller.offer.renderer.clearList('Day');
																		$('.details-offerDay h5').addClass('inactive');
																		controller.offer.renderer.clearList('Month');
																		controller.offer.animator.startListLoading('details-offerListMonth');
																		$(this).animate({ opacity: 1}, 250, function() {
																				controller.offer.loader.months();
																			});
																	},
										month_click:				function() {
																		var idStr = $(this).attr('id').replace('month-', '');
																		controller.offer.state.restore.month = idStr.substr(0,3);
																		controller.offer.state.restore.year = idStr.substr(4,4);
																		controller.offer.renderer.clearList('Day');
																		controller.offer.animator.startListLoading('details-offerListDay');
																		$(this).animate({ opacity: 1}, 250, function() {
																				controller.offer.loader.days();
																			});
																	},
										day_click:					function() {
																		controller.offer.animator.showFlashLoader();
																		
																		// Speicherung der Angebotsauswahl im Cookie
																		var expire = new Date(new Date().getTime() + 10*60*1000); // Cookie soll nach 10 Minuten ablaufen
																		$.cookie('hotelGalleryState' + controller.state.destStatus + controller.state.destTLC, $.toJSON(controller.offer.state.restore), { expires: expire });
																		
																		var mapping = {	JAN: '01',
																						FEB: '02',
																						MAR: '03',
																						APR: '04',
																						MAI: '05',
																						JUN: '06',
																						JUL: '07',
																						AUG: '08',
																						SEP: '09',
																						OKT: '10',
																						NOV: '11',
																						DEZ: '12',
																						ENE: '01',
																						ABR: '04',
																						MAY: '05',
																						AGO: '08',
																						OCT: '10',
																						DIC: '12',
																						GEN: '01',
																						MAG: '05',
																						GIU: '06',
																						LUG: '07',
																						SET: '09',
																						OTT: '10',
																						DEC: '12'
																						}

																		var monthMapped = eval('mapping.' + controller.offer.state.restore.month);
																		
																		var dayStr = $(this).attr('id').replace('day-', '');
																		var splitArr = dayStr.split('-');
																		var day = splitArr[0];
																		var airport = splitArr[1];
																		var prepackaged = splitArr[2];
																		if(day.length == 1)
																			day = '0' + day;
																		
																		var outboundDepartureDate =  day + monthMapped + controller.offer.state.restore.year.substr(2,2);
																		var outboundDepartureDateJS = new Date(controller.offer.state.restore.year, monthMapped-1, day);

																		var retDateMilliSeconds = outboundDepartureDateJS.getTime() + controller.offer.state.restore.duration*1000*60*60*24;
																		// Um den Wechsel von Sommer- zur Winterzeit zu berücksichtigen, darf nicht von 0 Uhr Nachts ab berechnet werden,
																		// denn es wird eine Stunde letztlich noch abgezogen
																		retDateMilliSeconds = retDateMilliSeconds + 12 * 60 * 60 * 1000;
																		var returnDepartureDateJS = new Date(retDateMilliSeconds);
																		
																		var returnDepartureDateDay = returnDepartureDateJS.getDate() + '';
																		if(returnDepartureDateDay.length == 1)
																			returnDepartureDateDay = '0' + returnDepartureDateDay;
																			
																		var returnDepartureDateMonth = returnDepartureDateJS.getMonth() + 1 + '';
																		if(returnDepartureDateMonth.length == 1)
																			returnDepartureDateMonth = '0' + returnDepartureDateMonth;
																			
																		var returnDepartureDateYear = returnDepartureDateJS.getFullYear() + '';
																		returnDepartureDateYear = returnDepartureDateYear.substr(2,2);
																		
																		var returnDepartureDate = returnDepartureDateDay + returnDepartureDateMonth + returnDepartureDateYear;
																		
																		var link = '';
																		if (controller.state.destination == "PMW")
																			link = controller.state.path_prefix + '/dyn_step_1_flugauswahl.php?da=' + controller.offer.state.restore.airport + '&aa=' + controller.state.destination + '&outboundDepartureDate=' + outboundDepartureDate + '&returnDepartureDate=' + returnDepartureDate + '&numAdults=' + controller.offer.state.restore.adults_count + '&numChilds=' + controller.offer.state.restore.children_count + '&hotelDBKey=' + controller.offer.state.data.hotel_dbkey + '&referrer=hotelgallery' + '&prepack=' +  prepackaged;
																		else
																			link = controller.state.path_prefix + '/dyn_step_1_flugauswahl.php?da=' + controller.offer.state.restore.airport + '&aa=' + airport + '&outboundDepartureDate=' + outboundDepartureDate + '&returnDepartureDate=' + returnDepartureDate + '&numAdults=' + controller.offer.state.restore.adults_count + '&numChilds=' + controller.offer.state.restore.children_count + '&hotelDBKey=' + controller.offer.state.data.hotel_dbkey + '&referrer=hotelgallery' + '&prepack=' +  prepackaged;
																		
																		if (controller.state.agency != '') link += '&agency=' + controller.state.agency;
																		if (controller.state.user != '') link += '&user=' + controller.state.user;
																		if (controller.state.password != '') link += '&password=' + controller.state.password;
																		if (controller.state.serverNameSession != '') link += '&serverNameSession=' + controller.state.serverNameSession;
																		if (controller.state.language != '') link += '&lang=' + controller.state.language;
																		link += '&destStatus=' + controller.state.destStatus;
																		
																		if(controller.state.destStatus == "WD")
																			link += '&eventID=' + controller.state.destination;
																			
																		window.location.href = link;
																		
																	},
										nothing:					function(event) {
																		event.preventDefault();
																	}
									},
									
							loader:	{
										initial:					function(callback) {
																		controller.offer.renderer.clearList('Month');
																		controller.offer.renderer.clearList('Day');
																		$('.details-offerMonth h5').addClass('inactive');
																		$('.details-offerDay h5').addClass('inactive');
																		//controller.state.destination
																		$.post(
																			controller.state.path_prefix+controller.dataProvider, 
																			controller.offer.helper.getActionData('offer_load_initial'), 
																			function(data) {
																				logEvent = 'offer_load_initial';
																				controller.log(logEvent);

																				controller.offer.renderer.travellerList(data.traveller);
																				controller.offer.renderer.durationList(data.duration);
																				callback();
																			},
																			'json');
																	},
										airports:						function(callback) {
																		$.post(
																			controller.state.path_prefix+controller.dataProvider,
																			controller.offer.helper.getActionData('offer_load_airports'),
																			function(data) {
																				logEvent = 'offer_load_airports';
																				controller.log(logEvent);

																				controller.offer.renderer.airportList(data.offerdata.airports);
																				if (callback) callback();
																			},
																			'json');	
																	},
										months:						function(callback) {
																		$.post(
																			controller.state.path_prefix+controller.dataProvider,
																			controller.offer.helper.getActionData('offer_load_months'),
																			function(data) {
																				logEvent = 'offer_load_months';
																				controller.log(logEvent);

																				controller.offer.renderer.monthList(data.offerdata.months);
																				$('.details-offerMonth h5').removeClass('inactive');
																				
																				if (callback) callback();
																			},
																			'json');	
																	},
										days:						function(callback) {
																		$.post(
																			controller.state.path_prefix+controller.dataProvider,
																			controller.offer.helper.getActionData('offer_load_days'),
																			function(data) {
																				logEvent = 'offer_load_days';
																				controller.log(logEvent);

																				controller.offer.renderer.dayList(data.offerdata.days);
																				$('.details-offerDay h5').removeClass('inactive');
																				if (callback) callback();
																			},
																			'json');	
																	}
										
									},
									
							beautyfier: 	{
								
								beautifyAirportName:	function(airportName) {
															if (airportName == "M&uuml;nster-Osnabr&uuml;ck") return "M&uuml;nster-Osna.";
															if (airportName == "Berlin - Sch&ouml;nefeld") return "Berlin-Sch&ouml;ne.";
															if (airportName == "Berl&iacute;n - Sch&ouml;nefeld") return "Berl&iacute;n-Sch&ouml;ne.";
															if (airportName == "Santiago de Compostela") return "Santiago Com.";
															if (airportName == "Jerez de la Frontera") return "Jerez de la Fr.";
															if (airportName == "M&aacute;laga - Marbella") return "M&aacute;laga-Marbe.";
															if (airportName == "Arrecife / Lanzarote") return "Lanzarote";
															if (airportName == "Florence Peretola") return "Florence";
															if (airportName == "Milano-Malpensa") return "Milano-Malp.";
															if (airportName == "Stockholm Arlanda") return "Stockholm";
															if (airportName == "Karlsruhe-Baden") return "Karlsruhe-Bad.";
															if (airportName == "") return "";

															return airportName;
														}
								
							},
							helper:	{
										getActionData:		function(actionCode) {
																return {
																			action: 		actionCode,
																			destStatus: 	controller.state.destStatus,
																			destination:    controller.state.destination,
																			adults_count: 	controller.offer.state.restore.adults_count,
																			children_count:	controller.offer.state.restore.children_count,
																			duration:		controller.offer.state.restore.duration,
																			dest_tlc: 		controller.offer.state.data.dest_tlc,
																			hotel_code: 	controller.offer.state.data.hotel_code,
																			hotel_dbkey: 	controller.offer.state.data.hotel_dbkey,
																			airport:		controller.offer.state.restore.airport,
																			month:			controller.offer.state.restore.month,
																			year:			controller.offer.state.restore.year,
																			preferredMonth: controller.state.preferredMonth,
																			tablePrefix: controller.state.tablePrefix,
																			teaserduration:	controller.offer.state.data.teaserDuration,
																			
																			logevent: actionCode,
																			logdeststatus: controller.state.destStatus,
																			logcategory: controller.state.activeCategory,
																			logcategoryhotel: controller.state.hotel,
																			language: controller.state.language
																		};
															}
									}
	
					 }

						
};

window.onload = function() {
	if(controller.state.areaCode_deeplink != '')
		controller.init(controller.state.areaCode_deeplink);
	
	if (jQuery.browser.msie) controller.offer.config.listItemHeight = 26;
}
