var nzStdServerUri		= './php/passThroughExt.php';
var nzStdTargetServer	= 'http://192.168.202.112/';
var nzStdPauschCgi		= 'ibepausch2.cgi';



var nHotelItemsPerPage		= 10;

var nTerminItemsPerPage		= 10; 




var submitPauschalForm  	= false;
var submitTimeOut			= false;

var getHotelList			= false;
var checkTerminIfAvailable  = false;
var sortTerminList			= false;

var callThemenwelt			= false;
var openHotelDetail			= false;

var oContentCache			= false;
var oCCCounter 		= 0;

//global content object
var oContentObject					= new Object();

var nConnectionTimeOut		= 60000;
//var nHistoryCount = 0;   
//var oHistory 	  = new Object();

// Sortierung
var nTerminListSort	= 4;
var nHotelListSort  = 4;
var TerminLstSortBox = '';
//ENDE Sortierung

//Last spezific parameters
//so user can change search params without starting from begin
var nzLastRegionFromMask = '';
var nzLastRegionFromList = '';
var nzLastHotelFromList  = '';



//Global needed Elements
	var DauerList = false;
    

	//loadMask hide function START
			var nHideEventCount    = 0;
			var nHideEventRequired = 5;
			
			LoadMainPageTimeout = window.setTimeout("LoadMainPageError()", nConnectionTimeOut);
			
			function LoadMainPageError() {
				Ext.Msg.show({
						title:'Verbindungs- Timeout',
						msg: 'Zeit&uuml;berschreitung beim Laden der Seite, bitte &uuml;berpr&uuml;fen Sie Ihre Internetvebindung und versuchen Sie es sp&auml;ter erneut!',
						buttons: Ext.Msg.OK,
						icon: Ext.MessageBox.ERROR
					});
			}//end of  LoadMainPageError
			
			function hideLoadMask() {
				nHideEventCount++;
				
				if(nHideEventCount >= nHideEventRequired) {
				
					if(window.TabRegistry['travelcategorieContentStartseite']) {
						window.clearTimeout(LoadMainPageTimeout);
						Ext.Msg.hide();
					}else{
						nHideEventRequired++;
						//alert(nHideEventCount);
						window.setTimeout("hideLoadMask()", 1000);
					}//end if defined
				
					
				}//end if nHideEventCount is reached
			}//end hideLoadMask
	//loadMask hide function END
	
				DoBeforeUnLoad = function() {
							return "Sie sind dabei die Pauschalseite zu verlassen, Ihre Auswahl geht dabei verloren, mchten Sie das wirklich?\n\nZur Navigation benutzen Sie bitte die lokalen Elemente im jeweiligen Bereich der Seite!";
				}//end of OnBeforeUnloadHandler	
	

function createDynamicMaskFields() {
         
	Ext.Msg.wait( 'Seite wird geladen...','Bitte warten');

/* GOOGLE ANALYTICS HACK START */
			
			/*var oGaHttpConnection = new Ext.data.Connection();
			
			var oGaConnectionConfig = {	
													    //url: './php/pass_through.php?uri=' + urlencode('http://192.168.202.112/cgi-bin/pdbjsonexport.cgi?01=PDBJDL'),
													    url: './blank.html',
													    method: 'GET',
													    //params: '',
													    success: function() {},
														failure: function() {
													    	 		//Ext.Msg.show({
																	//   title:'Verbindungs- Timeout',
																	//   msg: 'Eine Verbindung war leider nicht mglich bitte versuchen Sie es spter erneut!',
																	//   buttons: Ext.Msg.OK,
																	//   icon: Ext.MessageBox.ERROR
																	});
													     },
													     timeout: nConnectionTimeOut
											};
								  
								  //set get parameter*/
			
			var setConversion = function(nzGaUrl) {
								
					//oGaConnectionConfig.url = nzGaUrl;
					//oGaHttpConnection.request(oGaConnectionConfig);
					
					top.GoogleAnalysticsHelper.location.href = 'http://www.mein-reisespezialist.de/mep/googleanalystic/' + nzGaUrl;
					
								
			}//end if setConversion
								  
								  
/* GOOGLE ANALYTICS HACK ENDE */

var oHttpConnection = new Ext.data.Connection();



//Function zum Vorladen der Button-Bilder
function preloadImages()
{
    document.preload = new Array();

    if(document.images)
    {
        for(var i = 0; i < preloadImages.arguments.length; i++)
        {
            document.preload[i] = new Image();
            document.preload[i].src = preloadImages.arguments[i];
        }
    }
}
preloadImages('images/zurueck.gif', 'images/weiter.gif', 'images/pruefen.gif', 'images/buchen.gif', 'images/belegt.gif');
//ENDE Function zum Vorladen



/******************************************************************************/
/************************** Pauschalmask Fields START *************************/
/******************************************************************************/
	//BLOCK 1 START
		//Airport List START
			//http://192.168.202.112/cgi-bin/pdbjsonexport.cgi?01=PDBJTC
						airportListStore = new Ext.data.JsonStore({
							url: './php/passThroughExt.php?Uri='+encodeURI('http://192.168.202.112/cgi-bin')+'&FileName='+encodeURI('pdbjsonexport.cgi')+'&01=PDBJAL',
							root: 'departure',
							fields: ['key', 'name','level']
							});	 
												
													
						//#### Code fÃ¼r destinationListStore ####
									//>>START
										//AusfÃ¼hren wenn InputStore geladen ist
										airportListStore.on('load', function () {	  
																			hideLoadMask();
																			//OnloadAirportListStore();  
																			}
														);//end of tagCloudStore
		
										
										airportListStore.load(); 
									//>>ENDE
									
									
						AirportList = new Ext.form.ComboBox({
											fieldLabel: 'AirportList',
											tpl: '<tpl for="."><div ext:qtip="{name}" class="x-combo-list-item dropDownLevelZero{level}">{name}</div></tpl>',
											store: airportListStore,
											displayField:'name',
											valueField:'key',
											typeAhead: true,
											mode: 'local',
											triggerAction: 'all',
											emptyText:'beliebig',
											selectOnFocus:true,
											width: 150,
											minListWidth: 200,
											forceSelection: true,
											allowBlank: true,
											value: '',
											renderTo: 'airportListInputDiv'
											});

															
						AirportList.on('valid', function() {
															handleTravelDateChange();
															});		
															
						var aDauerData = [
										 	[1,'1 Tag'],
										 	[2,'2 Tage'],
										 	[3,'3 Tage'],
										 	[4,'4 Tage'],
										 	[5,'5 Tage'],
										 	[6,'6 Tage'],
										 	[7,'7 Tage'],
										 	[8,'8 Tage'],
										 	[9,'9 Tage'],
										 	[10,'10 Tage'],
										 	[11,'11 Tage'],
										 	[12,'12 Tage'],
										 	[13,'13 Tage'],
										 	[14,'14 Tage'],
										 	[15,'15 Tage'],
										 	[16,'16 Tage'],
										 	[17,'17 Tage'],
										 	[18,'18 Tage'],
										 	[19,'19 Tage'],
										 	[20,'20 Tage'],
										 	[21,'21 Tage'],
										 	[22,'22 Tage']
										 ];
										 
						var DauerDataStore = new Ext.data.SimpleStore({
											        fields: [
											           {name: 'value'},
											           {name: 'name'}
											        ]
											    });				 
						
						
						
						
						DauerDataStore.on('load', function () {	  
																			hideLoadMask();
																			  
																			}
														);
														
						DauerDataStore.loadData(aDauerData);	
						
												
													
						DauerList = new Ext.form.ComboBox({
											fieldLabel: 'durationList',
											id: 'travelDauer',
											tpl: '<tpl for="."><div ext:qtip="{name}" class="x-combo-list-item" style="text-align:left;">{name}</div></tpl>',
											store: DauerDataStore,
											displayField:'name',
											valueField:'value',
											typeAhead: true,
											mode: 'local',
											triggerAction: 'all',
											//emptyText:'beliebig',
											selectOnFocus:true,
											width: 115,
											minListWidth: 115,
											forceSelection: true,
											allowBlank: false,
											value: '7 ',
											renderTo: 'durationList'
											});	 	
											
						DauerList.on('change', function() {
															//handleTravelDateChange();
															handleDauerChange();
															});		
															
						DauerList.on('valid', function() {
															handleTravelDateChange();
															//handleDauerChange();
															});		
									
						var aAdultData = [
										 	[1,'1'],
										 	[2,'2'],
										 	[3,'3'],
										 	[4,'4'],
										 	[5,'5'],
										 	[6,'6']
										 ];
										 
						var AdultDataStore = new Ext.data.SimpleStore({
											        fields: [
											           {name: 'value'},
											           {name: 'name'}
											        ]
											    });
											    
						AdultDataStore.on('load', function () {	  
																			hideLoadMask();
																			  
																			}
														);				 
						
						AdultDataStore.loadData(aAdultData);								
													
						var AdultList = new Ext.form.ComboBox({
											fieldLabel: 'AdultList',
											id: 'travelAdult',
											tpl: '<tpl for="."><div ext:qtip="{name}" class="x-combo-list-item" style="text-align:left;">{name}</div></tpl>',
											store: AdultDataStore,
											displayField:'name',
											valueField:'value',
											typeAhead: true,
											mode: 'local',
											triggerAction: 'all',
											//emptyText:'beliebig',
											selectOnFocus:true,
											width: 115,
											minListWidth: 115,
											forceSelection: true,
											allowBlank: false,
											value: '2',
											renderTo: 'travelAdultTd'
											});
											
						AdultList.on('valid', function() {
															handleTravelDateChange();
															});		
						
		//Airport List END
	//*******************
	//*** BLOCK 1 END ***
	//*******************
	
	
	//FUNCTION fr onClick Handle bei RadioGroup
	/*Ext.override(Ext.form.Radio, {
    onClick : function(){
    	if(this.el.dom.checked != this.checked){
    	    var els = this.el.up('form').select('input[name='+this.el.dom.name+']');
    	    els.each(function(el){
    	        if(el.dom.id == this.id){
    	            this.setValue(true);
    	        }else{
    	            Ext.getCmp(el.dom.id).setValue(false);    	        
    	        }
    	    }, this);
        }
    }
	});*/
	//END FUNCTION fr onCLick Handle
	
	
	//FUNCTION getValue fï¿½r Radio Groups 
	//Funktion dient dem reinen Ausgeben der Values von den Radioboxen - Example: oYourGroup.getValue(); //returns the value of the Radio Group
		Ext.override(Ext.form.RadioGroup, {
		  getName: function() {
		    return this.items.first().getName();
		  },
		
		  getValue: function() {
		    var v;
		
		    this.items.each(function(item) {
		      v = item.getRawValue();
		      return !item.getValue();
		    });
		
		    return v;
		  },
		
		  setValue: function(v) {
		    this.items.each(function(item) {
		      item.setValue(item.getRawValue() == v);
		    });
		  }
		});
	//FUNCTION getValue END
	
	//FUNCTION getValue fï¿½r Checkboxen
	Ext.override(Ext.form.CheckboxGroup, {
	  getNames: function() {
	    var n = [];
	
	    this.items.each(function(item) {
	      if (item.getValue()) {
	        n.push(item.getName());
	      }
	    });
	
	    return n;
	  },
	
	  getValues: function() {
	    var v = [];
	
	    this.items.each(function(item) {
	     if (item.getValue()) {
	        v.push(item.getRawValue());
	     }else{
	     	v.push("off");
	     }
	    });
	
	    return v;
	  },
	
	  setValues: function(v) {
	    var r = new RegExp('(' + v.join('|') + ')');
	
	    this.items.each(function(item) {
	      item.setValue(r.test(item.getRawValue()));
	    });
	  }
	});
	//FUNCTION getValue END
	
	//BLOCK 2 START
	
			var oVerpflegungsGroup = new Ext.form.RadioGroup({
																id: 'VerpflegungsGroup',
																inputType: 'radio',
																name: 'VerpflegungsGroup',
																disabled : false,
															
																
																items: [{
																	
																		checked: true,
																		name: 'mealType',
		                												boxLabel:'egal',
		                												itemCls: 'x-form-clear-both',
		                												inputValue : '',
		                												handler: function() {
		                													handleTravelMoreChange();
		                												}
		                												},{
																		
																		name: 'mealType',
		                												boxLabel:'Nur&nbsp;&Uuml;bernachtung',
		                												itemCls: 'x-form-clear-both',
		                												inputValue : 'OV',
		                												haJavaScriptHistoryHelperndler: function() {
		                													handleTravelMoreChange();
		                												}
																		},{
																		
																		name: 'mealType',
		                												boxLabel:'Fr&uuml;hst&uuml;ck',
		                												itemCls: 'x-form-clear-both',
		                												inputValue : 'UF',
		                												handler: function() {
		                													handleTravelMoreChange();
		                												}
																		},{
																		
																		name: 'mealType',
		                												boxLabel:'Halbpension',
		                												itemCls: 'x-form-clear-both',
		                												inputValue : 'HP',
		                												handler: function() {
		                													handleTravelMoreChange();
		                												}
																		},{
																		
																		name: 'mealType',
		                												boxLabel:'Vollpension',
		                												itemCls: 'x-form-clear-both',
		                												inputValue : 'VP',
		                												handler: function() {
		                													handleTravelMoreChange();
		                												}
																		},{
																		
																		name: 'mealType',
		                												boxLabel:'All&nbsp;Inclusive',
		                												itemCls: 'x-form-clear-both',
		                												inputValue : 'AI',
		                												handler: function() {
		                													handleTravelMoreChange();
		                												}
																		}],
																renderTo: 'OptionSetVerpflegung'
																});
																

																
																
		
																
																
		// END Option Verpflegung
		//START Option HotelKategorie
			var oHotelKategorieGroup = new Ext.form.RadioGroup({
															id: 'HotelKategorieGroup',
															inputType: 'radio',
															name: 'HotelKategorieGroup',
															disabled : false,
															
															items: [{
																
																	checked: true,
																	name: 'hotelCategory',
	                												boxLabel:'egal',
	                												itemCls: 'x-form-clear-both',
	                												inputValue : '',
		                											handler: function() {
		                													handleTravelMoreChange();
		                												}
	                												},{
																	
																	name: 'hotelCategory',
	                												boxLabel:'2&nbsp;Sterne',
	                												itemCls: 'x-form-clear-both',
	                												inputValue : '2',
		                											handler: function() {
		                													handleTravelMoreChange();
		                												}
																	},{
																	
																	name: 'hotelCategory',
	                												boxLabel:'3&nbsp;Sterne',
	                												itemCls: 'x-form-clear-both',
	                												inputValue : '3',
		                											handler: function() {
		                													handleTravelMoreChange();
		                												}
																	},{
																	
																	name: 'hotelCategory',
	                												boxLabel:'4&nbsp;Sterne',
	                												itemCls: 'x-form-clear-both',
	                												inputValue : '4',
		                											handler: function() {
		                													handleTravelMoreChange();
		                												}
																	},{
																	
																	name: 'hotelCategory',
	                												boxLabel:'5&nbsp;Sterne',
	                												itemCls: 'x-form-clear-both',
	                												inputValue : '5',
		                											handler: function() {
		                													handleTravelMoreChange();
		                												}
																	}],
															renderTo: 'OptionSetHotelKategorie'
															});
															
		// END Option HotelKategorie
		//START Option Zimmer
			var oZimmerGroup = new Ext.form.RadioGroup({
															id: 'ZimmerGroup',
															inputType: 'radio',
															name: 'ZimmerGroup',
															disabled : false,
															
															items: [{
															
																	checked: true,
																	name: 'roomType',
	                												boxLabel:'egal',
	                												itemCls: 'x-form-clear-both',
	                												inputValue : '',
		                												handler: function() {
		                													handleTravelMoreChange();
		                												}
	                												},{
																	name: 'roomType',
	                												boxLabel:'Einzelzimmer',
	                												itemCls: 'x-form-clear-both',
	                												inputValue : 'EZ',
		                												handler: function() {
		                													handleTravelMoreChange();
		                												}
	                												},{
																	name: 'roomType',
	                												boxLabel:'Doppelzimmer',
	                												itemCls: 'x-form-clear-both',
	                												inputValue : 'DZ',
		                												handler: function() {
		                													handleTravelMoreChange();
		                												}
	                												},{
																	name: 'roomType',
	                												boxLabel:'Junior&nbsp;Suite',
	                												itemCls: 'x-form-clear-both',
	                												inputValue : 'JS',
		                												handler: function() {
		                													handleTravelMoreChange();
		                												}
	                												},{
																	name: 'roomType',
	                												boxLabel:'Suite',
	                												itemCls: 'x-form-clear-both',
	                												inputValue : 'SU',
		                												handler: function() {
		                													handleTravelMoreChange();
		                												}
	                												},{
																	name: 'roomType',
	                												boxLabel:'Appartement',
	                												itemCls: 'x-form-clear-both',
	                												inputValue : 'AP',
		                												handler: function() {
		                													handleTravelMoreChange();
		                												}
	                												},{
																	name: 'roomType',
	                												boxLabel:'Bungalow',
	                												itemClJavaScriptHistoryHelpers: 'x-form-clear-both',
	                												inputValue : 'BU',
		                												handler: function() {
		                													handleTravelMoreChange();
		                												}
	                												},{
																	name: 'roomType',
																	boxLabel:'Studio',
	                												itemCls: 'x-form-clear-both',
	                												inputValue : 'ST',
		                												handler: function() {
		                													handleTravelMoreChange();
		                												}
	                												},{
																	name: 'roomType',
	                												boxLabel:'Villa',
	                												itemCls: 'x-form-clear-both',
	                												inputValue : 'VI',
		                												handler: function() {
		                													handleTravelMoreChange();
		                												}
	                												}],
															renderTo: 'OptionSetZimmer'
															});
		// END Option Zimmer
		//START Checkbox Angebot
			var oAngebotGroup = new Ext.form.CheckboxGroup({
															id: 'AngebotGroup',
															inputType: 'radio',
															name: 'AngebotGroup',
															disabled : false,
															
															items: [{
																	name: 'strandnah',
	                												boxLabel:'Strandnah',
	                												itemCls: 'x-form-clear-both',
	                												handler: function() {
		                													handleTravelMoreChange();
		                												}
	                												},{
																	name: 'airCondition',
	                												boxLabel:'Klimaanlage',
	                												itemCls: 'x-form-clear-both',
	                												handler: function() {
		                													handleTravelMoreChange();
		                												}
	                												},{
																	name: 'children',
	                												boxLabel:'Familienfreundlich',
	                												itemCls: 'x-form-clear-both',
	                												handler: function() {
		                													handleTravelMoreChange();
		                												}
	                												},{
																	name: 'wellness',
	                												boxLabel:'Wellness&#x2011;Angebote',
	                												itemCls: 'x-form-clear-both',
	                												handler: function() {
		                													handleTravelMoreChange();
		                												}
	                												},{
																	name: 'sport',
	                												boxLabel:'Sport&#x2011;Angebote',
	                												itemCls: 'x-form-clear-both',
	                												handler: function() {
		                													handleTravelMoreChange();
		                												}
	                												},{
																	name: 'tv',
	                												boxLabel:'TV&#x2011;Angebote',
	                												itemCls: 'x-form-clear-both',
	                												handler: function() {
		                													handleTravelMoreChange();
		                												}
	                												}],
															renderTo: 'CheckboxSetAngebot'
															});
															
															
					var oHotelSearchField = new Ext.form.TextField({
																	emptyText: 'Wunschhotel eingeben',
																	allowBlank: true, 
																	width: '150',
																	renderTo: 'hotelSearchInput'
																	});
																	
																	
					oHotelSearchField.on('valid',function() {
		                													handleTravelMoreChange();
		                												});
	
	
	//BLOCK 2 END
	//BLOCK 3 START
		//Destination List START
			//http://192.168.202.112/cgi-bin/pdbjsonexport.cgi?01=PDBJTC
						var destinationListProxy = new Ext.data.HttpProxy({
								method: 'GET',
								disableCaching:true,
								url: './php/passThroughExt.php?Uri='+encodeURI('http://192.168.202.112/cgi-bin')+'&FileName='+encodeURI('pdbjsonexport.cgi')+'&01=PDBJDL'
							});
							
			
						var destinationListStore = new Ext.data.JsonStore({
								proxy: destinationListProxy,
								root: 'dest',
								fields: ['key', 'region','level','tagcloud']
							});	 
													
													
						//#### Code fÃ¼r destinationListStore ####
									//>>START
										//AusfÃ¼hren wenn InputStore geladen ist
										destinationListStore.on('load', function () {	  
																			CreateTagCloud();
																			hideLoadMask();
																			//OnloadDestinationListStore();  
																			}
														);//end of tagCloudStore
		
										
										destinationListStore.load(); 
									//>>ENDE
									
									
						var tagCloud = '';			
						function CreateTagCloud() {
							
							for(nCount = 0; nCount < destinationListStore.getTotalCount(); nCount++) {
								if(destinationListStore.getAt(nCount).data['tagcloud'] != '') {
									if(destinationListStore.getAt(nCount).data['tagcloud'] == 'B' || destinationListStore.getAt(nCount).data['tagcloud'] == 'C') tagCloud += '<span>';
									tagCloud += '<a href="javascript:submitFromTagCloud('+ "'" + destinationListStore.getAt(nCount).data['key'] + "'" +')" >' + destinationListStore.getAt(nCount).data['region'] + '</a> ';
								 	if(destinationListStore.getAt(nCount).data['tagcloud'] == 'B' || destinationListStore.getAt(nCount).data['tagcloud'] == 'C') tagCloud += '</span> ';
								}//end if 
							}//end of for
							
						document.getElementById("tagCloudContainer").innerHTML = tagCloud;
						
						}//end of OnloadtagCloudStore
									
									
						var DestinationList = new Ext.form.ComboBox({
											fieldLabel: 'DestinationList',
											tpl: '<tpl for="."><div ext:qtip="{region}" class="x-combo-list-item dropDownLevel{level}" >{region}</div></tpl>',
											store: destinationListStore,
											displayField:'region',
											valueField:'key',
											typeAhead: true,
											mode: 'local',
											triggerAction: 'all',
											emptyText:'Land auswhlen...', //Wenn man statt  ein &auml; macht, geht es nicht mehr...
											selectOnFocus:true,
											width: 150,
											minListWidth: 300,
											forceSelection: true,
											allowBlank: false,
											renderTo: 'destinationListInputDiv'
											});
						
						var nzLastValue = false;					
						DestinationList.on('valid', function() {
															document.getElementById('destinationListButton').style.display = 'block';
																/*
																if(nzLastValue != DestinationList.getRawValue()) {
																	
																	nzLastValue = DestinationList.getRawValue();
																	
																	window.clearTimeout(submitTimeOut);
																	submitTimeOut = window.setTimeout("submitPauschalForm()", 1000);
																	
																	
																}//end if nzLastValue
																*/
															});

		
						
						
		//Destination List END/holzweg_dev/pdb_cgi-bin/
	//BLOCK 3 END
/******************************************************************************/
/************************** Pauschalmask Fields END ***************************/
/******************************************************************************/



/******************************************************************************/
/************************ Standard Connection START ***************************/
/******************************************************************************/
	//Request CONTENT START
		//Request config for Region Result
	

								var oStdSuccess = function(responseObject) {
															
														    var oContent = document.getElementById('content');
															var nzRegionContent = '';
													    	
													    	//alert('data' + responseObject.responseText);
													    	
													    	var oEncode = false;
													    	
													    	oEncode = Ext.util.JSON.decode(responseObject.responseText);
													    	
													    	  top.JavaScriptHistoryHelper.location.href = './html/javascriptOnBackScript.html';
													    	  //Case block for conncetion response
														    	if(oEncode['error'] != '') {
														    		oContent.style.display = 'none';
														    		oContent.innerHTML = '<p style="padding:10px;">' + oEncode['error'] + '</p>';
														    		oContent.style.display = 'block';
														    	}else if(oEncode['regions']){//Regionlist response case
														    		
														    		//google analystics call
														    		setConversion('pauschal/GAregionsListe.html');
														    		
														    		window.onbeforeunload = null;

														    		oCCCounter++;
														    		oContentCache[oCCCounter] = new Object();
														    		
														    		oContentCache[oCCCounter]['type'] = 'RegionList';
														    		oContentCache[oCCCounter]['html'] = makeRegionList(oEncode);
														    		oContent.style.display = 'none';
														    		oContent.innerHTML = oContentCache[oCCCounter]['html'];
														    		oContent.style.display = 'block';
														    		
														    		
														    		
														    	}else if(oEncode['hotels']){//Hotellist response case
														    		
														    		top.JavaScriptHistoryHelper.location.href = './html/javascriptOnBackScript2.html';
														    		//window.onbeforeunload = DoBeforeUnLoad;
														    		
			                                          				if(oContentCache[oCCCounter] && oContentCache[oCCCounter]['type'] == 'HotelList') {
			                                          					
			                                          					//setConversion('pauschal/GAhotelListeBlaettern.html');
			                                          					
			                                          					oContentCache[oCCCounter]['PageCount']++;
																		
															    		oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']] = new Object();
															    		oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['params'] = oStdConnectionConfig.params;
															    		oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']   = oEncode;
															    		oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['html']   = makeHotelList(oEncode);
																		oContent.style.display = 'none';
																		oContent.innerHTML = oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['html'];
																		oContent.style.display = 'block';
			                                          				}else{
			                                          				
			                                          					setConversion('pauschal/GAhotelListe.html');
			                                          				
												    					oCCCounter++;
															    		oContentCache[oCCCounter] = new Object();
															    		oContentCache[oCCCounter]['type']   = 'HotelList';
															    		
															    		oContentCache[oCCCounter]['PageCount'] = 0;
															    		
															    		oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']] = new Object();
															    		oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['params'] = oStdConnectionConfig.params;
															    		oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']   = oEncode;
															    		oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['html']   = makeHotelList(oEncode);
																		oContent.style.display = 'none';
															    		oContent.innerHTML = oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['html'];
															    		oContent.style.display = 'block';
															    	}//end if inside hotellist
														    		
														    	}else if(oEncode['journey']){//Terminlist response case
														    		//DetailPage
														    		//oContentCache[oCCCounter]['HotelInfo']
														    		//TemporÃ¤re bergangslsung START
															    		var nI = 0;
															    		while(oEncode['journey'][nI]) {
															    		 if(oEncode['journey'][nI]['free'] == '') oEncode['journey'][nI]['free'] = 2;
															    		nI++;
															    		}//end of while
														    		//TemporÃ¤re bergangslsung ENDE
														    		
														    		top.JavaScriptHistoryHelper.location.href = './html/javascriptOnBackScript.html';
														    		//window.onbeforeunload = DoBeforeUnLoad;
														    		
														    		if(oContentCache[oCCCounter] && oContentCache[oCCCounter]['type'] == 'DetailPage') {
																		if(oContentCache[oCCCounter]['notFirstRun'] == 1) {
				                                          					
				                                          					//setConversion('pauschal/GAdetailSeiteBlaettern.html');
				                                          					
				                                          					oContentCache[oCCCounter]['PageCount']++;
																			
																    		oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']] = new Object();
																    		oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['params'] = oStdConnectionConfig.params;
																    		oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']   = oEncode;
																    		oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['html']   = makeTerminList(oEncode);
																			oContent.style.display = 'none';
																			document.getElementById('TerminListContainer').innerHTML = oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['html'];
																			oContent.style.display = 'block';
				                                          				}else{
																    		
																    		setConversion('pauschal/GAdetailSeite.html');
																    		
																    		oContentCache[oCCCounter]['notFirstRun'] = 1;
																    		oContentCache[oCCCounter]['PageCount'] = 0;
																    		
																    		oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']] = new Object();
																    		oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['params'] = oStdConnectionConfig.params;
																    		oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']   = oEncode;
																    		oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['html']   = makeTerminList(oEncode);
																			oContent.style.display = 'none';
																    		document.getElementById('TerminListContainer').innerHTML = oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['html'];
																    		oContent.style.display = 'block';
																    		
																    	}//end if inside DetailPage
																	}//end if
														    			
														    			
														    		
														    	}//end if error
															Ext.Msg.hide();
															
													    };
		
		
								var oStdConnectionConfig = {	
													    //url: './php/pass_through.php?uri=' + urlencode('http://192.168.202.112/cgi-bin/pdbjsonexport.cgi?01=PDBJDL'),
													    url: nzStdServerUri,
													    method: 'GET',
													    //params: '',
													    success: oStdSuccess,
														failure: function() {
													    	 		Ext.Msg.show({
																	   title:'Verbindungs- Timeout',
																	   msg: 'Eine Verbindung war leider nicht mglich bitte versuchen Sie es spter erneut!',
																	   buttons: Ext.Msg.OK,
																	   icon: Ext.MessageBox.ERROR
																	});
													     },
													     timeout: nConnectionTimeOut
											};
											
	//Request CONTENT END									
/******************************************************************************/
/************************ Standard Connection END *****************************/
/******************************************************************************/					




//****************************************************************************************//
//****************************** PauschalHistory START ***********************************//
//****************************************************************************************//

goForward = function() {
	if(oContentCache[oCCCounter + 1]) {
	oContent = document.getElementById('content');
		switch (oContentCache[oCCCounter + 1]['type']) {
						/*case 'RegionList':
						  	oCCCounter++;
						    document.getElementById('content').innerHTML = oContentCache[oCCCounter]['html'];
						    break;*/
						    
						  case 'HotelList':
						  oContent.style.display = 'none';
						   	oCCCounter++;
						   	
						   	//set regions selection for param possible chance again
						   	nzLastRegionFromList = 	oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['hotels'][0]['object-region-id'];
						   	
						   	document.getElementById('content').innerHTML = oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['html'];
						   	if(oContentCache[oCCCounter + 1]) document.getElementById('HistoryNavigation').innerHTML  += '<span style="font-size:0.8em;padding-left:390px;" class="hotelTitelBold">&nbsp;<a href="javascript:;" onClick="goForward();" >Einen Schritt vor</a></span>';
						    oContent.style.display = 'block';
						    break;
						  case 'DetailPage':
						    oCCCounter++;
						    oContent.style.display = 'none';
						    
						    //set hotel selection for param possible chance again
						    nzLastHotelFromList = 	oContentCache[oCCCounter]['HotelName'];
						   	
						   
						   	document.getElementById('content').innerHTML = oContentCache[oCCCounter]['HotelInfo'];
						   	document.getElementById('TerminListContainer').innerHTML = oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['html'];
						    
						    delete SortDropDownList;
							MakeSortDropDownList();
							SortDropDownList.render("sortDropDownContainer");
							
						    updateCheckButtons();
						    oContent.style.display = 'block';
						    break;
						}//end switch case type
	}//end if
}//end goForward

goBackward = function() {
	if(oCCCounter >= 1) {
	oContent = document.getElementById('content');
		switch (oContentCache[oCCCounter - 1]['type']) {
						  case 'RegionList':
						  	oCCCounter--;
						  	
						  	//delete selected regions and hotel for new search
						  	nzLastRegionFromList = '';
							nzLastHotelFromList  = '';
						  	
						  	oContent.style.display = 'none';
						    oContent.innerHTML = oContentCache[oCCCounter]['html'];
						    document.getElementById('HistoryNavigation').innerHTML = '<div style="padding:0px 0px 0px 500px;font-size:0.8em;float:left;"  class="hotelTitelBold">&nbsp;<a href="javascript:;" onClick="goForward();" style="">Weiter zur Hotelliste</a></div>';
						    oContent.style.display = 'block';
						    break;
						  case 'HotelList':
						  	oCCCounter--;
						  	
						  	//delete selected hotel for new search
							nzLastHotelFromList  = '';
						  	
						  	oContent.style.display = 'none';
						  	document.getElementById('content').innerHTML = "";
						   	document.getElementById('content').innerHTML = oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['html'];	    
						    if(oCCCounter >= 1) document.getElementById('HistoryNavigation').innerHTML  = '<span style="float:left; padding-left:5px;font-size:0.8em;" class="hotelTitelBold">&nbsp;<a href="javascript:;" onClick="goBackward();" >Einen&nbsp;Schritt&nbsp;zur&uuml;ck</a></span>';
						    					document.getElementById('HistoryNavigation').innerHTML += '<span style="float:right; font-size:0.8em;" class="hotelTitelBold">&nbsp;<a href="javascript:;" onClick="goForward();" >Einen&nbsp;Schritt&nbsp;vor</a></span>';
						   oContent.style.display = 'block';
						    break;
						case 'DetailPage':
						    oCCCounter--;
						    oContent.style.display = 'none';
						   	document.getElementById('content').innerHTML = oContentCache[oCCCounter]['HotelInfo'];
						   	delete SortDropDownList;
							MakeSortDropDownList();
							SortDropDownList.render("sortDropDownContainer");
						   	document.getElementById('TerminListContainer').innerHTML = oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['html'];
						    updateCheckButtons();
						    oContent.style.display = 'block';
						    break;
						}//end switch case type
	}//end if
}//end goBackward


//****************************************************************************************//
//****************************** PauschalHistory END *************************************//
//****************************************************************************************//




//****************************************************************************************//
//**************************** Pauschalmask submit START *********************************//
//****************************************************************************************//
			//Pauschalmask submit funktions				
							submitFromTagCloud = function(nzDestinationKey) {
							
								nzLastRegionFromList = '';
								nzLastHotelFromList  = '';
							
								DestinationList.setValue(nzDestinationKey);
								submitPauschalForm();
							}//end of submitFromTagCloud
							
							submitFromRegionDropDown = function() {
							
								nzLastRegionFromList = '';
								nzLastHotelFromList  = '';
								
								submitPauschalForm();
							
							}
							
							 function DoBeforeSubmit() {
			                                        //if(document.getElementById('hotelSearchInputField').value == "Wunschhotel eingeben") document.getElementById('hotelSearchInputField').value = "";
			                                        
			                                        //closeMe('travelcategorieContent');
			                                        closeMe('travelcategorieContentStartseite');
			                                       
			                                        
			                                        updateHotellist();
			                                        
			                                        
			                                        //new request reset
			                                        	delete oContentCache;
			                                        	oContentCache	= new Object();
														oCCCounter 		= -1;
			                                        
			                                        /*
			                                        //new request reset
													    oContentObject['RegionList'] 	= new Object();
													    oContentObject['HotelList']  	= new Object();
													    oContentObject['HotelDetail']	= new Object();
													    oContentObject['TerminList']	= new Object();
			                                        
				                                        //Data reset for Hotelist
				                                          oContentObject['HotelList']['html'] 			= new Object();
				                                          oContentObject['HotelList']['htmlArrayCount'] = 0;
				                                        
				                                        //Main history Reset 
				                                        	//nHistoryCount = 0;   
															//oHistory	  = new Object();
												 	*/
				                                        			                                        
			                                        //if(oFormObject.hotelName.value == "") oFormObject.hotelName.value = "Wunschhotel eingeben";
			                                return false;
			                 }//end of DoBeforeSubmit
           
           
                 
//Build XML Request and submit the Pauschalform START                
	                submitPauschalForm = function() {
	                
	                	
	                
	                	document.getElementById('destinationListButton').style.display = 'none';
	                	//document.getElementById('JspMask').style.display = 'none';
	                	document.getElementById('contentIframe').style.display = 'none';
	                	document.getElementById('content').style.display = 'block';
	                	
	                	 
	                	var nzErrorText = false;
	                	var nDate = new Date();
	                	
	                	
	                	/************ Datepickers - in Amerikanisches format konvertieren**********/
	                	/**************************************************************************/
		                	var nzDateChild1Temp = window.datePickers['child1BirthdayP'].getRawValue();
		                	var nDateChild1      = nzDateChild1Temp.split(".").reverse().join("");
		                	
		                	var nzDateChild2Temp = window.datePickers['child2BirthdayP'].getRawValue();
		                	var nDateChild2      = nzDateChild2Temp.split(".").reverse().join("");
	                	/**************************************************************************/
	                	
	                	/************** Von-Bis - in Amerikanisches format konvertieren************/
	                	/**************************************************************************/
		                	var nzDateVonTemp = window.vonPicker.getRawValue();
		                	var nDateVon      = nzDateVonTemp.split(".").reverse().join("");
		                	
		                	var nzDateBisTemp = window.bisPicker.getRawValue();
		                	var nDateBis      = nzDateBisTemp.split(".").reverse().join("");
	                	/**************************************************************************/
	                	
	                	
	                	/********** Aktuelles Datum - in Amerikanisches format konvertieren********/
	                	/**************************************************************************/
		                	var nDateNow  = "";
		                	    nDateNow += nDate.getFullYear();
		                	    nDateNow += ((nDate.getMonth() + 1) < 10)? "0"+(nDate.getMonth() + 1): (nDate.getMonth() + 1);
		                		nDateNow += (nDate.getDate() < 10)  ? "0"+nDate.getDate()  : nDate.getDate();
		                /*************************************************************************/

	                	//if controlblock to check user input
	                	if(DestinationList.getValue() == '' && nzLastRegionFromList == ''){
							nzErrorText = 'Ihr Reiseziel fehlt!<br />Bitte w&auml;hlen Sie noch ein Reiseziel &uuml;ber die Liste oder das Dropdown-Men&uuml; aus<br /><br />';
	                	}else if((nDateVon < nDateNow) || (nDateBis < nDateNow)){
	                	    
	                		nzErrorText  = ((nDateVon < nDateNow)  && (nDateBis < nDateNow)) ? 'Das Abreise-Datum und das Ankunfts-Datum liegen in der Vergangenheit!' : '';
	                		nzErrorText += ((nDateVon < nDateNow)  && (nDateBis >= nDateNow))? 'Das Abreise-Datum lieget in der Vergangenheit!' : '';
	                		nzErrorText += ((nDateVon >= nDateNow) && (nDateBis < nDateNow)) ? 'Das Ankunfts-Datum lieget in der Vergangenheit!' : '';
	               
	                	}else if((nDateChild1 > nDateNow) || (nDateChild2 > nDateNow)){
	                	
	                		nzErrorText = 'Das Geburtsdatum ';
	                		nzErrorText += ((nDateChild1 > nDateNow)  && (nDateChild2 > nDateNow)) ?  'der beiden Kinder' : '';
	                		nzErrorText += ((nDateChild1 > nDateNow)  && (nDateChild2 <= nDateNow))? 'des ersten Kindes' : '';
	                		nzErrorText += ((nDateChild1 <= nDateNow) && (nDateChild2 > nDateNow)) ? 'des zweiten Kindes': '';
	                		nzErrorText += ' liegt in der Zukunft!';
	                		
	                	}else if(!isNaN(nDateBis)){
	                		
	                			Ext.Msg.wait( 'Reisedaten werden geladen','Bitte warten');
	                			
								//action to do before sumit will be started
								DoBeforeSubmit();
								
								//alert(oVerpflegungsGroup.getValues(true));
								
								var nzXML = '';
								
								//xml head
								nzXML += '<?xml version="1.0" encoding="UTF-8"?><theMessage><search-request caller="MEP" callee="GA"><offerpa ';
								
								  //Get data from fields START
									
									//block 1
										nzXML += 'from-date="'		+ window.vonPicker.getRawValue() + '" ';
										nzXML += 'to-date="'		+ window.bisPicker.getRawValue() + '" ';
										nzXML += 'duration="'		+ DauerList.getValue()			 + '" ';
										nzXML += 'adult-count="'	+ AdultList.getValue()			 + '" ';
										
										nzXML += 'children-1="'	+ window.datePickers['child1BirthdayP'].getRawValue() + '" ';
										nzXML += 'children-2="'	+ window.datePickers['child2BirthdayP'].getRawValue() + '" ';
									  //nzXML += 'children-3="'	+ window.datePickers['child3BirthdayP'].getRawValue() + '" ';//currently not in use
									  
									  	nzXML += 'from-airport="'	+ AirportList.getValue()		 + '" ';
									
									//block2
										var ReplaceMe = '';

										nzXML += 'room-category="'	+ oZimmerGroup.getValue()	 + '" ';
										nzXML += 'price="'			+ ''  + '" ';
										
										if(oHotelSearchField.getValue() != '') {		 		 			 	
											nzXML += 'object-name="'	+ oHotelSearchField.getValue() + '" ';
										} else {
											nzXML += 'object-id="'	+ nzLastHotelFromList + '" ';
										}//end if hotel is selected already
										
										nzXML += 'object-category="'+ oHotelKategorieGroup.getValue()	 		 + '" ';
										nzXML += 'meal-category="'	+ oVerpflegungsGroup.getValue()	 	 + '" ';
									
									

									
									//block 3
										if((DestinationList.getValue() != nzLastRegionFromMask) || nzLastRegionFromList == '') {
											nzXML += 'region-id="'	+ DestinationList.getValue() + '" ';
											nzLastRegionFromMask = DestinationList.getValue();
											nzLastRegionFromList = '';
											nzLastHotelFromList  = '';
										} else {
											nzXML += 'region-id="'	+ nzLastRegionFromList + '" ';
										}//end if region is selected already
								  
								  //Get data from fields END
								
								
								nzXML += ' duration-diff="" ></offerpa>';
								var oAngebotValue = oAngebotGroup.getValues();
								
								
								nzXML += '<attribute value="' + ((oAngebotValue[0] == 'on') ? '1' : '0') + '" name="Strandnah"/>';
								nzXML += '<attribute value="' + ((oAngebotValue[1] == 'on') ? '1' : '0') + '" name="Klima"/>';
								nzXML += '<attribute value="' + ((oAngebotValue[2] == 'on') ? '1' : '0') + '" name="Kinderfreundlich"/>';
								nzXML += '<attribute value="' + ((oAngebotValue[3] == 'on') ? '1' : '0') + '" name="Wellness"/>';
								nzXML += '<attribute value="' + ((oAngebotValue[4] == 'on') ? '1' : '0') + '" name="Sport"/>';
								nzXML += '<attribute value="' + ((oAngebotValue[5] == 'on') ? '1' : '0') + '" name="TV"/>';
								
								nzXML += '</search-request></theMessage>';
								
								
								//xml bottom
								//nzXML += '></offerpa></search-request></theMessage>';
								
								//alert(nzXML);
								
								//encode special chars dont use escape because not all spezial chars should be transformed
								nzXML = encodeURI(nzXML);
								//set get parameter
								oStdConnectionConfig.params = {
																		'Uri' 		: encodeURI(nzStdTargetServer + 'cgi-bin'),
																		'FileName'	: encodeURI(nzStdPauschCgi),
																		'01' : 'PDBX04',
																		'09' : 'J',
																		'11' : '0',
																		'12' : nzXML
																	 };
								
								oHttpConnection.request(oStdConnectionConfig);
							
						return true;
							
						}else{
							Ext.Msg.show({
								 title:'Bitte beachten Sie...',
								 msg: 'Das Ankunfts-Datum muss in folgendem Format sein: TT.MM.JJJJ',
								 buttons: Ext.Msg.OK,
								 icon: Ext.MessageBox.WARNING
							});
						}//end if check user input valid
						
					  		if(nzErrorText != false) {
					  		
					  				    Ext.Msg.show({
										   title:'Bitte beachten Sie...',
										   msg: nzErrorText,
										   buttons: Ext.Msg.OK,
										   //fn: processResult,
										   //animEl: 'elId',
										   icon: Ext.MessageBox.WARNING
										});
					  		
					  		}//end if nzErrorText
					 	return false;
					  
					}//end of submitPauschalForm
	//Build XML Request and submit the Pauschalform END	
//****************************************************************************************//
//**************************** Pauschalmask submit END ***********************************//
//****************************************************************************************//



/******************************************************************************/
/************************ Create Regionlist START *****************************/
/******************************************************************************/
	//Function to create the regionlist from response START 
		var makeRegionList = function(oEncode) {
			
													    		var nI = 0;
													    		var nzRegionContent = '';
													    		var nBgColor = false;
													    		
													    		if(oEncode['regions'][nI] != null) {
													    		
													    					//oEncode['total']
													    					//oEncode['offset']
													    					//nHotelItemsPerPage
													    					
													    					nzRegionContent += '<br />';
													    					nzRegionContent += '<h1>&nbsp;Ihre Suchergebnisse:</h1><br><br>';
														    				while(oEncode['regions'][nI]) {
														    					
															    				if(oEncode['regions'][nI]['level'] == 1) {
															    					nzRegionContent += '<br><br><h1>&nbsp;&nbsp;' + oEncode['regions'][nI]['name'] + '</h1><br><br>';
															    				}else if(oEncode['regions'][nI]['level'] == 2) {
																    					
															    						while(oEncode['regions'][nI] && oEncode['regions'][nI]['level'] == 2) {
															    							if(nBgColor == 'FFE1C5'){ nBgColor =  'FFEDDB'; }else{ nBgColor = 'FFE1C5';}
															    							
																    						nzRegionContent += '<div id="regionList" style="background: url(images/regionsListe_bg.png); font-size: 0.8em; color: #000066;height:26px;padding-top: 9px;width: 705px;">';
																									
																									nzRegionContent += '<span style="float:left;width: 210px;"><a title="" href="javascript: submitFromRegion('+"'"+oEncode['regions'][nI]['ibe-parameters'].replace(/&amp;/g, '&') +"'"+')" style="color: #000066;padding-left: 45px;font-size:0.9em;"><b>';
																    								nzRegionContent += oEncode['regions'][nI]['name'];
																    								nzRegionContent += '</b></a></span>';
																    								
																								nzRegionContent += '<span style="float: left; padding-left: 20px;text-align:center;">';
																									if(oEncode['regions'][nI]['temp-water'] >= 1 || oEncode['regions'][nI]['weather'] >= 1) {
																								 	 nzRegionContent += '<b>Temp.</b>&nbsp;';
																								 	}//end if temperatur
																								
																								if(oEncode['regions'][nI]['weather'] >= 1) {
																			    					nzRegionContent += '<img alt="" src="images/sonne.jpg" alt="Temperatur" /> ' + oEncode['regions'][nI]['weather'] + '°Grad';
																								}//end if temperatur
																								nzRegionContent += '&nbsp;&nbsp;';
																								if(oEncode['regions'][nI]['temp-water'] >= 1) {
																			    					nzRegionContent += '<img alt="" src="images/wasser.jpg" alt="Wasser Temperatur"/> ' + oEncode['regions'][nI]['temp-water'] + '°Grad';
																								}//end if temperatur
																								nzRegionContent += '</span>';
																								
																								nzRegionContent += '<span style="float: right;">';
																									nzRegionContent += 'Preis pro Person <b>';
																									nzRegionContent += 'ab: ';
																									nzRegionContent += '<span class="red">';
																			    					nzRegionContent += oEncode['regions'][nI]['price'];
																									nzRegionContent += '</span>';
																									nzRegionContent += '&nbsp;Euro&nbsp;</b>';
																								nzRegionContent += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>';
																			    			nzRegionContent += '</div>';
																			    		
																    						 nI++;
																    					}//end while if level 2
																    					
																							
																    					 nI--;
															    				}//if level
														    				
														    				 nI++;
																    		}//end of while results
																    		
															
																    	nzRegionContent += '<div id="HistoryNavigation" style="float:left;display:inline;"></div><div style="float: left; clear: both; display: none;">cleared layerrfor</div>';	
														    			
													    		 }else{
																    	nzRegionContent = '<p>Es wurden leider keine Angebote in diesem Zeitraum gefunden!</p>';
																 }//end if regions
			//alert(nzRegionContent);												 
			return(nzRegionContent);
		}//end of makeRegionList
		
		
		submitFromRegion = function(nzIbeParameter) {
		           	//alert(nzIbeParameter);
	                	var nzErrorText = false;
	                
	                	//if controlblock to check user input
	                	if(nzIbeParameter == ''){
							nzErrorText = 'Zuordnungs Fehler<br />Keine Parameter f&uuml;r diese Region gefunden, bitte rufen Sie die Seite sp&auml;ter nocheinmal auf!<br /><br />';
	                	}else{
	                			
	                			Ext.Msg.wait( 'Hoteldaten werden geladen','Bitte warten');
	                			
								
								//set get parameter
								oStdConnectionConfig.params = {
																		'Uri' 		: encodeURI(nzStdTargetServer + 'cgi-bin'),
																		'FileName'	: encodeURI(nzStdPauschCgi),
																		

																		'temp'		: '0&' + nzIbeParameter,
																		
																		
																		'98'		: '0',//offset
																		'99'		: nHotelItemsPerPage//Anzahl der zu Liefernden Ergebnisse
																		
																	 };
								

								oHttpConnection.request(oStdConnectionConfig);
							
						//return true;
							
						}//end if check user input valid
						
					  		if(nzErrorText != false) {
					  		
					  				    Ext.Msg.show({
										   title:'Achtung',
										   msg: nzErrorText,
										   buttons: Ext.Msg.OK,
										   //fn: processResult,
										   //animEl: 'elId',
										   icon: Ext.MessageBox.WARNING
										});
					  		
					  		}//end if nzErrorText
					 	//return false;
					  
		}//end of submitFromRegion
		
/******************************************************************************/
/************************ Create Regionlist END *******************************/
/******************************************************************************/



/******************************************************************************/
/************************ Create Hotellist START ******************************/
/******************************************************************************/
//Function to create the hotellist from response START 
	var makeHotelList = function(oEncode) {
		
												    		var nI = 0;
												    		var nzRegionContent = '';
												    		
												    		if(oEncode['hotels'][nI] != null) {
												    			
												    			var nzLastLevel = 1;
												    			
												    			//nzRegionContent += '<ul>';
													    		//if(oEncode['regions']) { 
																		
																		//sets the selected region so user can chance params without start from begin
																		nzLastRegionFromList = oEncode['hotels'][nI]['object-region-id'];
																		
													    				var nzHotelImageClass = 'hotelImageLeft';
													    				nzRegionContent += '<br>&nbsp;&nbsp;<h1>Ihre Suchergebnisse:</h1><br><br>';
															    		while(oEncode['hotels'][nI] ) {
															    			if(oEncode['object-name'] != ""){
															    			
															    		
																    			nzRegionContent += '<div class="hotelmitdaten" id="HotelListPart'+nI+'"><div class="'+nzHotelImageClass+'">';
																    			//nzRegionContent += '<div style="background:url(images/hotelDetailRahmen.png);background-repeat:no-repeat;padding:7px 0px 0px 6px;width:196px;height:123px;">';
																    			nzRegionContent += '<a title="'+ oEncode['hotels'][nI]['object-name'] +'" href="javascript: submitFromHotel('+"'"+nI+"'"+')">';
																    			nzRegionContent += '<img height="110" width="184" title="'+ oEncode['hotels'][nI]['object-name'] +'" alt="'+ oEncode['hotels'][nI]['object-name'] +'" src="'+oEncode['hotels'][nI]['object-pict-path']+'"/>';
																    			nzRegionContent += '</a>';
																    			//nzRegionContent += '</div>';
																    			nzRegionContent += '</div><div class="hotelContainer">';
																    			
																    			nzRegionContent += '<div class="hotelTitel">';
																	    			nzRegionContent += '<span class="hotelTitelBold"><a title="'+ oEncode['hotels'][nI]['object-name'] +'" href="javascript: submitFromHotel('+"'"+nI+"'"+')">'+ oEncode['hotels'][nI]['object-name'] +'</a></span><img title="'+ oEncode['hotels'][nI]['object-category'] +'" alt="'+ oEncode['hotels'][nI]['object-category'] +'" src="images/sterne'+ oEncode['hotels'][nI]['object-category'] +'.gif"/>';
																    			nzRegionContent += '</div>';
																    			if(oEncode['hotels'][nI]['object-city'] != ""){
																	    			nzRegionContent += '<div class="hotelLocation">';
																		    			nzRegionContent += '<span class="hotelTitelBold">Ort:</span>&nbsp;' + oEncode['hotels'][nI]['object-city'];
																	    			nzRegionContent += '</div>';
																	    		}
																    			nzRegionContent += '<div class="hotelContent">';
																    				nzRegionContent += oEncode['hotels'][nI]['object-region'] + '<br />Durchschnittliche Temperatur:&nbsp;' + oEncode['hotels'][nI]['temp-air'] + '<br />Wasser-Temperatur:&nbsp;' + oEncode['hotels'][nI]['temp-water'];
																					nzRegionContent += '<div class="price"><b>ab:<span class="red"> '+ oEncode['hotels'][nI]['pre-price'] +' &euro;</span></b></div></div><div class="hotelapplication">';
																					if(oEncode['hotels'][nI]['Wellness'] == 1) 				nzRegionContent += '<img title="Wellness" alt="Wellness" src="images/icon_wellness.jpg"/>';
																					if(oEncode['hotels'][nI]['Strandnah'] == 1) 			nzRegionContent += '<img title="in Strandnhe" alt="in Strandnhe" src="images/icon_strand.jpg"/>';
																					if(oEncode['hotels'][nI]['Strandnah'] == 1) 			nzRegionContent += '<img title="Sport" alt="Sport" src="images/icon_sport.jpg"/>';
																					if(oEncode['hotels'][nI]['Kinderfreundlich'] == 1) 		nzRegionContent += '<img title="Familie" alt="Familie" src="images/icon_family.jpg"/>';
																					if(oEncode['hotels'][nI]['Klima'] == 1) 				nzRegionContent += '<img title="Klimaanlage im Zimmer" alt="Klimaanlage im Zimmer" src="images/icon_klima.jpg"/>';
																					if(oEncode['hotels'][nI]['TV'] == 1) 					nzRegionContent += '<img title="TV" alt="TV" src="images/icon_tv.jpg"/></div>';
																    			nzRegionContent += '</div>';
																    			
																    			nzRegionContent += '</div></div>';
																    			
																    			
																    															    		
																    			//nzRegionContent += oEncode['hotels'][nI]['object-name']+'&nbsp;';
																				
																				if(nzHotelImageClass == 'hotelImageLeft') {
																					nzHotelImageClass = 'hotelImageRight';
																				}else{
																					nzHotelImageClass = 'hotelImageLeft';
																				}//end if holteImage
															    		 	}// end if object-name isset()
															    		 nI++;
															    		}//end of while resutls
															       if((oContentCache[oCCCounter]['PageCount'] >= 1) || ((oEncode['total'] - (oEncode['offset'] + nHotelItemsPerPage)) >= 1)){
																   		nzRegionContent += '<div id="HotelListPartX" class="hotelmitdaten"  style="_height: 30px; text-align: center; ">';
																	   if(oContentCache[oCCCounter]['PageCount'] >= 1 ) {
																	    	nzRegionContent += '<img src="images/zurueck.gif" onClick="getPastHotelPage();" style="cursor: pointer;" />&nbsp';
																	    }//end if													    			
																	    if((oEncode['total'] - (oEncode['offset'] + nHotelItemsPerPage)) >= 1) {
																	    	//alert('inside');
																	    	nzRegionContent += '<img src="images/weiter.gif" onClick="getNextHotelPage();" style="cursor: pointer;" />';
																	    }//end if
																	    nzRegionContent += '</div>';
																    }//end if more pages->div.display
																    
																    nzRegionContent += '<div id="HistoryNavigation" style="_height: 10px; float: left; display: inline; padding-top: 20px;">';
																	
																	if(oCCCounter >= 1) {
																		nzRegionContent += '<span style="padding-left:5px;font-size:0.8em;" class="hotelTitelBold">&nbsp;<a href="javascript:;" onClick="goBackward();" >Einen&nbsp;Schritt&nbsp;zur&uuml;ck</a></span>';
																	}//end if
																	
																	
																	nzRegionContent += '</div><div style="float: left; clear: both; display: none;">cleared layer</div><br><br>';

													    		
												    		 }else{
															    	nzRegionContent = '&nbsp;&nbsp;&nbsp;<p>Es wurden leider keine Angebote in diesem Zeitraum gefunden!</p>';
															 }//end if regions
		return(nzRegionContent);
	}//end of makeHotelList
	
	
	getNextHotelPage = function() {
								oContent = document.getElementById('content');
								if(oContentCache[oCCCounter]['type']   == 'HotelList') {
								
									//oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['hotels']
									if(oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount'] + 1]) {
											oContent.style.display = 'none';
											oContentCache[oCCCounter]['PageCount']++;
											oContent.innerHTML = oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['html'];
											oContent.style.display = 'block';
									}else{
											oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['params']['98'] = (parseInt(oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['params']['98']) + parseInt(nTerminItemsPerPage));
											oStdConnectionConfig.params = oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['params'];
											 
											Ext.Msg.wait( 'Hoteldaten werden geladen','Bitte warten');
											oHttpConnection.request(oStdConnectionConfig);
									}//end if no request needed
								}//end if HotelList
							}//end of getNextHotelPage
							
							
	getPastHotelPage = function() {
	
								if(oContentCache[oCCCounter]['type']   == 'HotelList' && oContentCache[oCCCounter]['PageCount'] >= 1 ) {
									oContent = document.getElementById('content');
									oContentCache[oCCCounter]['PageCount']--;
											oContent.style.display = 'none';
											oContent.innerHTML = oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['html'];
											oContent.style.display = 'block';
								}//end if htmlArrayCount
							}//end of getPastHotelPage
				

	

	submitFromHotel = function(nPositon) {
		           	//alert(nzIbeParameter);
	                	var nzErrorText = false;
	                
	                	//if controlblock to check user input
	                	if(nPositon == ''){
							nzErrorText = 'Zuordnungs Fehler<br />Keine Parameter f&uuml;r dieses Hotel gefunden, bitte rufen Sie die Seite sp&auml;ter nocheinmal auf!<br /><br />';
	                	}else{
	                		Ext.Msg.wait('Detailseite wird geladen','Bitte warten');
							makeHotelDetailSite(nPositon);
						}//end if check user input valid
						
					  		if(nzErrorText != false) {
					  		
					  				    Ext.Msg.show({
										   title:'Achtung',
										   msg: nzErrorText,
										   buttons: Ext.Msg.OK,
										   //fn: processResult,
										   //animEl: 'elId',
										   icon: Ext.MessageBox.WARNING
										});
					  		
					  		}//end if nzErrorText
					 	//return false;
					  
	}//end of submitFromHotel
									
/******************************************************************************/
/************************ Create Hotellist END ********************************/
/******************************************************************************/



/******************************************************************************/
/*********************** Create HotelDetail START *****************************/
/******************************************************************************/

openHotelDetail = function(detailPath, objectName){
	window.open(detailPath, 'Hoteldetail', 'width=640,height=750,status=yes,scrollbars=yes,resizable=yes');
}

//Function to create the hotellist from response START 
	var makeHotelDetailSite = function(nI) {
	
    						var nzRegionContent = '';	
    						var oHotels = oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['hotels'];
							
							oCCCounter++;
							oContentCache[oCCCounter] = new Object();								    		
															    			//sets the selected hotel so user can chance params without start from begin
															    			
															    			nzLastHotelFromList = oHotels[nI]['object-id'];
															    			
															    			nzRegionContent += '<div style="padding:10px;"><h1>' + oHotels[nI]['object-name'] + '</h1> <img src="images/sterne' + oHotels[nI]['object-category'] + '.gif" alt="' + oHotels[nI]['object-category'] + ' Sterne" title="' + oHotels[nI]['object-category'] + ' sterne" /><br />';
										                                      //nzRegionContent += ' <p>Ruhig gelegen, nur durch die Kstenstrae vom schmalen, leicht abfallenden Sandstrand getrennt. Dieser wird durch eine Unterfhrung erreicht. Ca. 4 km zum Zentrum mit Restaurants, Tavernen, Bars, Cafs und Geschften. Ca. 25 km zur Inselhauptstadt Chalkida. Ca. 65 km nach Athen entfernt (mit Fhre).</p>';
										                                      nzRegionContent += ' </div><table class="hotelInfos" style="margin-left:8px;">';
										                                      nzRegionContent += '        <tr>';
										                                      nzRegionContent += '            <td style="padding:0px;padding-top:5px;"><b>Ort:</b></td>';
										                                      nzRegionContent += '            <td style="padding:0px;padding-top:5px;">' + oHotels[nI]['object-name'] + '</td>';
										                                      nzRegionContent += '            <td rowspan="7"><div style="background:url(images/hotelDetailRahmen.png);background-repeat:no-repeat;padding:7px 0px 0px 6px;width:196px;height:133px;">';
										                                      nzRegionContent += '                <img height="110" width="184" style="cursor:pointer;" title="'+ oHotels[nI]['object-name'] +'" alt="'+ oHotels[nI]['object-name'] +'" src="'+oHotels[nI]['object-pict-path']+'" onClick="openHotelDetail(' + "'" +  oHotels[nI]['object-detail-path'] + "','"  + oHotels[nI]['object-name'] + "'" +');"/>';
										                                      nzRegionContent += '            </div></td>';
										                                      nzRegionContent += '        </tr>';
										                                      nzRegionContent += '        <tr>';
										                                      nzRegionContent += '            <td style="padding:0px;"><b>Region:</b></td>';
										                                     nzRegionContent += '             <td style="padding:0px;">' + oHotels[nI]['object-region'] + '</td>';
										                                     nzRegionContent += '         </tr>';
										                                      nzRegionContent += '        <tr>';
										                                      nzRegionContent += '            <td style="padding:0px;"><b>Temperatur:</td>';
										                                     nzRegionContent += '             <td style="padding:0px;">im Durchschnitt ' + oHotels[nI]['temp-air'] + ' Grad</td>';
										                                      nzRegionContent += '        </tr>';
										                                       nzRegionContent += '        <tr>';
										                                      nzRegionContent += '            <td style="padding:0px;"><b>&nbsp;</td>';
										                                     nzRegionContent += '             <td style="padding:0px;">&nbsp;</td>';
										                                      nzRegionContent += '        </tr>';
										                                       nzRegionContent += '        <tr>';
										                                      nzRegionContent += '            <td style="padding:0px;"><b>&nbsp;</td>';
										                                     nzRegionContent += '             <td style="padding:0px;">&nbsp;</td>';
										                                      nzRegionContent += '        </tr>';
										                                       nzRegionContent += '        <tr>';
										                                      nzRegionContent += '            <td style="padding:0px;"><b>&nbsp;</td>';
										                                     nzRegionContent += '             <td style="padding:0px;">&nbsp;</td>';
										                                      nzRegionContent += '        </tr>';
										                                       nzRegionContent += '        <tr>';
										                                      nzRegionContent += '            <td style="padding:0px;"><b>&nbsp;</td>';
										                                     nzRegionContent += '             <td style="padding:0px;">&nbsp;</td>';
										                                      nzRegionContent += '        </tr>';
										                                   /*  nzRegionContent += '         <tr>';
										                                     nzRegionContent += '             <td><b>Lage:</b></td>';
										                                      nzRegionContent += '            <td>Am Ortsrand von Georgioupolis, ca. 500m vom Zentrum und ca. 150m vom langen, flach abfallenden Sandstrand entfernt.</td>';
										                                     nzRegionContent += '         </tr>';
										                                     nzRegionContent += '         <tr>';
										                                     nzRegionContent += '             <td><b>Ausstattung:</b></td>';
										                                     nzRegionContent += '             <td>Familir gefhrte Ferienanlage, bestehend aus Haupthaus und 4 Nebengebuden, 3 Pools, Sonnen-/Sitzterrasse (Liegen und Schirme inkl.) Pool-/Snackbar.</td>';
										                                     nzRegionContent += '         </tr>';*/
										                                     nzRegionContent += '  </table>';
										                                     nzRegionContent += '&nbsp;<a href="javascript: openHotelDetail(' + "'" +  oHotels[nI]['object-detail-path'] + "','"  + oHotels[nI]['object-name'] + "'" +');" style="font-size:0.9em; color:#041658;" class="hotelTitelBold" >Hotel Detailinformationen</a><br><br>';
										                                    // nzRegionContent += '  <h2>Ihre Suchergebnisse</h2>';
															    			
																    			
																    		
																	    			
																	    			/*nzRegionContent += '<img title="'+ oHotels[nI]['object-category'] +'" alt="'+ oHotels[nI]['object-category'] +'" src="images/sterne'+ oHotels[nI]['object-category'] +'.gif"/>';
																    			
																	    			nzRegionContent += oHotels[nI]['object-city'];
																    			
																    				nzRegionContent += oHotels[nI]['object-region'] + '<br />Durchschnittliche Temperatur:&nbsp;' + oHotels[nI]['temp-air'] + '<br />Wasser- Temperatur:&nbsp;' + oHotels[nI]['temp-water'];
																					nzRegionContent += '<div class="price"><b>ab:<span class="red"> '+ oHotels[nI]['pre-price'] +' &euro;</span></b></div></div><div class="hotelapplication">';
																					if(oHotels[nI]['Wellness'] == 1) 			nzRegionContent += '<img title="Wellness" alt="Wellness" src="images/icon_wellness.jpg"/>';
																					if(oHotels[nI]['Strandnah'] == 1) 			nzRegionContent += '<img title="in StrandnÃ¤he" alt="in StrandnÃ¤he" src="images/icon_strand.jpg"/>';
																					if(oHotels[nI]['Strandnah'] == 1) 			nzRegionContent += '<img title="Sport" alt="Sport" src="images/icon_sport.jpg"/>';
																					if(oHotels[nI]['Kinderfreundlich'] == 1) 	nzRegionContent += '<img title="Familie" alt="Familie" src="images/icon_family.jpg"/>';
																					if(oHotels[nI]['Klima'] == 1) 				nzRegionContent += '<img title="Klimaanlage im Zimmer" alt="Klimaanlage im Zimmer" src="images/icon_klima.jpg"/>';
																					if(oHotels[nI]['TV'] == 1) 					nzRegionContent += '<img title="TV" alt="TV" src="images/icon_tv.jpg"/></div>';
																    		*/
																			nzRegionContent += '<table border="0" style="width: 200px;height: 20px;float:left;" valign="top"><tr><td style="width: 60px;" valign="top"><h1 style="display:inline;">Ihre&nbsp;Suchergebnisse:</h2>&nbsp;</td><td style="width: 30px;paddin" valign="top">&nbsp;&nbsp;<h2 style="display:inline;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sortieren&nbsp;nach:</h2>&nbsp;</td><td style="width: 30px;" valign="top"><div id="sortDropDownContainer" style="width:140px;height: 40px;"></div></td><td style="width: 30px;" valign="top"><img src="images/aktualisierenOnly.gif" onClick="sortTerminList();" id="aktualisierenSort" style="display: none;"></td></tr></table>';
															    			nzRegionContent += '<div id="TerminListContainer" style="padding-top:0px;"></div>';
															    			
															    			
															    			if(oCCCounter >= 1) {
															    				
															    				nzRegionContent += '<div id="HistoryNavigation" style="float:left;display:inline;"><span style="padding-left:5px;font-size:0.8em;float:left;" class="hotelTitelBold"><a href="#" onClick="goBackward();" class="hotelTitelBold">zur&uuml;ck zur Hotelliste</a></span></div><div style="float: left; clear: both; display: none;">cleared layerforIe</div>';
															    			}//end if
				//write hoteldata and termin container to content
				  //oContentObject['HotelDetail'] = nzRegionContent;
				  //document.getElementById('content').innerHTML = nzRegionContent + '<div id="HotelTerminList" ></div>';	
				  //document.getElementById('content').innerHTML = nzRegionContent;
					

														    		
					oContentCache[oCCCounter]['type'] 		= 'DetailPage';
					oContentCache[oCCCounter]['HotelName']  = nzLastHotelFromList;
					
					oContentCache[oCCCounter]['HotelInfo'] 	= nzRegionContent;
					oContentCache[oCCCounter]['lastIbeParameters'] = oHotels[nI]['ibe-parameters'];
					//oContentCache[oCCCounter]	= new object();
					oContent = document.getElementById('content');
					oContent.style.display = 'none';
					document.getElementById('content').innerHTML = oContentCache[oCCCounter]['HotelInfo'];
					//oContent.style.display = 'none';
						delete SortDropDownList;
						MakeSortDropDownList();
						SortDropDownList.render("sortDropDownContainer"); //Rendert den Sortierungs-DropDown in den Container	
			
															    	
															    			
						//Create TerminList START
		                	//if controlblock to check user input
		                	if(oHotels[nI]['ibe-parameters'] == ''){
			                	Ext.Msg.show({
												   title:'Achtung',
												   msg: nzErrorText,
												   buttons: Ext.Msg.OK,
												   //fn: processResult,
												   //animEl: 'elId',
												   icon: Ext.MessageBox.WARNING
												});
								nzErrorText = 'Zuordnungs Fehler<br />Keine Parameter f&uuml;r diese Region gefunden, bitte rufen Sie die Seite sp&auml;ter nocheinmal auf!<br /><br />';
		                	}else{
		                			Ext.Msg.wait( 'Terminliste wird geladen','Bitte warten');
		                			
								  //set get parameter
									SortRequest(oHotels[nI]['ibe-parameters']);
							}//end if check user input valid
						//Create TerminList END												    			
															  
	}//end of makeHotelList
/******************************************************************************/
/************************** Sortierungs DropDown START ************************/
/******************************************************************************/

							function SortRequest(ibeParameters){
							
									var nzTempType 				= oContentCache[oCCCounter]['type'];
									var nzTempHotelInfo 		= oContentCache[oCCCounter]['HotelInfo'];
									var nzLastIbePrarameters 	= oContentCache[oCCCounter]['lastIbeParameters'];
									var nzLastHotelName			= oContentCache[oCCCounter]['HotelName'];
									
									delete oContentCache[oCCCounter];
									oContentCache[oCCCounter] = new Object();
									
									oContentCache[oCCCounter]['type'] = nzTempType;
									oContentCache[oCCCounter]['HotelInfo'] = nzTempHotelInfo;
									oContentCache[oCCCounter]['lastIbeParameters'] = nzLastIbePrarameters;
									oContentCache[oCCCounter]['HotelName'] = nzLastHotelName;
									
									oContentCache[oCCCounter]['notFirstRun'] = 0;
									Ext.Msg.wait( 'Terminliste wird geladen','Bitte warten');
		                			
								  //set get parameter
									oStdConnectionConfig.params = {
																			'Uri' 		: encodeURI(nzStdTargetServer + 'cgi-bin'),
																			'FileName'	: encodeURI(nzStdPauschCgi),	
																																		
																			'temp'		: '0&' + ibeParameters,
																			'12'		: nTerminListSort,
																			'98'		: '0',//offset
																			'99'		: nTerminItemsPerPage//Anzahl der zu Liefernden Ergebnisse
																		 };
									
	
									oHttpConnection.request(oStdConnectionConfig);
							}//END Funktion SortRequest
							
						var aSortDropDown = [
										 	[1,'Abflughafen'],
										 	[2,'Abreisetag'],
										 	[3,'Veranstalter'],
										 	[4, 'Preis aufsteigend']
										 ];
										 
						var SortDropDownStore = new Ext.data.SimpleStore({
											        fields: [
											           {name: 'value'},
											           {name: 'name'}
											        ]
											    });		
											    
						SortDropDownStore.loadData(aSortDropDown);
							
							
MakeSortDropDownList = function() {
												
													
						SortDropDownList = new Ext.form.ComboBox({
											fieldLabel: 'sortlist',
											id: 'sortListDropDown',
											tpl: '<tpl for="."><div ext:qtip="{name}" class="x-combo-list-item" style="text-align:left;">{name}</div></tpl>',
											store: SortDropDownStore,
											displayField:'name',
											valueField:'value',
											typeAhead: true,
											mode: 'local',
											triggerAction: 'all',
											//emptyText:'beliebig',
											selectOnFocus:true,
											width: 125,
											Cls: 'x-form-searchDropDown',
											minListWidth: 115,
											forceSelection: true,
											allowBlank: false,
											value: nTerminListSort
											//renderTo: 'durationList'
											});	
											
						var bSortDropDownFirst = true;
						
						SortDropDownList.on('valid', function(){
							if(bSortDropDownFirst) bSortDropDownFirst = false;
							else  document.getElementById("aktualisierenSort").style.display = "";
							
						});
						
						sortTerminList = function(){
							document.getElementById('aktualisierenSort').style.display = 'none';
							nTerminListSort = SortDropDownList.getValue();
							//alert(nTerminListSort);
							SortRequest(oContentCache[oCCCounter]['lastIbeParameters']);
						}
						
}//end of MakeSortDropDownList
											
/******************************************************************************/
/************************** Preis Sortierungs DropDown START ******************/
/******************************************************************************/

/******************************************************************************/
/*********************** Create HotelDetail END *******************************/
/******************************************************************************/
					    		


/******************************************************************************/
/************************ Create TerminList START *****************************/
/******************************************************************************/




//Function to create the hotellist from response START 
	var makeTerminList = function(oEncode) {
			var nzRegionContent = '';
			var aTerminList = oEncode['journey'];
				
				nzRegionContent += '<br><br><br><table class="results table-terminliste table-hotelliste" style="float: left;border:0px;font-size: 1em;width:700px;_width:695px;" ><tr><td bgcolor="#FFE1C5"><b>Abflughafen</b></td><td bgcolor="#FFE1C5"><b>Abreisetag</b></td><td bgcolor="#FFE1C5"><b>Dauer</b></td><td bgcolor="#FFE1C5"><b>Anbieter</b></td><td bgcolor="#FFE1C5"><b>Leistung</b></td><td bgcolor="#FFE1C5"><b>Preis p.P.</b></td><td bgcolor="#FFE1C5"><b>Frei?</b></td></tr>';
					
					var nI = 0;
					var nBgColor = '#FFEEDE';
					while(aTerminList[nI]) {
						nBgColor = (nBgColor == '#FFEEDE') ? '#FEF2E6' : '#FFEEDE';
					  nzRegionContent += '<tr>';
					   nzRegionContent += '<td bgcolor="'+nBgColor+'">' + aTerminList[nI]['from-airport'] + '</td>';
					   nzRegionContent += '<td bgcolor="'+nBgColor+'">' + aTerminList[nI]['from-date'] 	 + '</td>';
					   nzRegionContent += '<td bgcolor="'+nBgColor+'">' + aTerminList[nI]['duration'] 	 + '</td>';
					   nzRegionContent += '<td bgcolor="'+nBgColor+'"><img height="14" width="32" title="' + aTerminList[nI]['operator'] + '" alt="' + aTerminList[nI]['operator'] + '" src="' + aTerminList[nI]['operator-logo'] + '"/>';
					   nzRegionContent += '<td bgcolor="'+nBgColor+'">' + aTerminList[nI]['room-category'] + '</td>';
					   nzRegionContent += '<td bgcolor="'+nBgColor+'">' + aTerminList[nI]['price'] + ' Euro</td>';
					   nzRegionContent += '<td id="CheckTableButton'+aTerminList[nI]['id']+'"  bgcolor="'+nBgColor+'">';
					   nzRegionContent += '<input type="image" src="images/pruefen.jpg" onclick="checkTerminIfAvailable('+"'"+ encodeURI(aTerminList[nI]['ibe-check']) +"'"+', '+"'"+aTerminList[nI]['id'] +"'"+', '+ nI + ');" id="button'+aTerminList[nI]['id']+'" />&nbsp;';
					   
					   nzRegionContent += '</td>';
					  nzRegionContent += '</tr>';
					  
					  nI++;
					}//end of while
					
				//nzRegionContent += '</table>';
				nzRegionContent += '<tr><td colspan="7" style="text-align: center;"  bgcolor="#FFEEDE">';
				
				if(oContentCache[oCCCounter]['PageCount'] && oContentCache[oCCCounter]['PageCount'] >= 1 ) {
					nzRegionContent += '<img src="images/zurueck.gif" onClick="getLastTerminPage();" style="cursor:pointer;" />&nbsp;';
				}//end if													    			
				if((oEncode['total'] - (oEncode['offset'] + nTerminItemsPerPage)) >= 1) {
					nzRegionContent += '<img src="images/weiter.gif" onClick="getNextTerminPage();" style="cursor:pointer;"  />';
				}//end if
				
				nzRegionContent += '</td></tr>';
				nzRegionContent += '</table>';
		/*
         "free" : "",
         "ibe-book" : "00=B&01=PDBTR3&04=MRv7IgNK&11=25.10.2008&12=1&13=MUC&14=bu&15=BU&16=LP&17=X01P0236C500001F004D0&18=2882&19=IBZ 1C3&20=MÃ¼nchen&21=1",
         "ibe-check" : "00=B&01=PDBTR3&04=MRv7IgNK&09=J&11=25.10.2008&12=1&13=MUC&14=bu&15=BU&16=LP&17=X01P0236C500001F004D0&18=2882&19=IBZ 1C3&20=MÃ¼nchen&21=1",
        */
        
		return(nzRegionContent);
		}//end of makeTerminList
		

		var oCheckTerminSuccess = function(responseObject) {
				var oEncode = false;
					    	
				oEncode = Ext.util.JSON.decode(responseObject.responseText);	
				
				if(oEncode['check']){
					
					var nI		  = 0;
					var nFor1	  = 0;
					var nFor2	  = 0;
					var nIWhile   = 0;

					//var oDataSet	  = false;
					
					while(oEncode['check'][nI]) {
						
						for(nFor1 = 0; nFor1 <= oContentCache[oCCCounter]['PageCount']; nFor1++) {
							nFor2 = 0;
							while(oContentCache[oCCCounter][nFor1]['data']['journey'][nFor2]) {
								if(oContentCache[oCCCounter][nFor1]['data']['journey'][nFor2]['id'] == oEncode['check'][nI]['id']) {
									oContentCache[oCCCounter][nFor1]['data']['journey'][nFor2]['free'] = oEncode['check'][nI]['free'];
									if(nFor1 == oContentCache[oCCCounter]['PageCount']) {
										if(oEncode['check'][nI]['free'] == 1) {
											document.getElementById('CheckTableButton'+oEncode['check'][nI]['id']).innerHTML = '<input type="image" src="images/buchen.jpg" onclick="makeIframeForm('+"'"+ encodeURI(oContentCache[oCCCounter][nFor1]['data']['journey'][nFor2]['ibe-book']) +"'"+')" />';
										} else if(oEncode['check'][nI]['free'] == 0) {
											document.getElementById('CheckTableButton'+oEncode['check'][nI]['id']).innerHTML = '<image src="images/belegt.jpg" />';
											if(oContentCache[oCCCounter]['lastCheck']){
												if(oContentCache[oCCCounter]['lastCheck']['id'] == oEncode['check'][nI]['id']){
												
													
													nIWhile = oContentCache[oCCCounter]['lastCheck']['nCount'];
													//alert("button" + oEncode['check'][nI]['id']);
													nIWhile++;
													while(nIWhile < nTerminItemsPerPage){
														if(oContentCache[oCCCounter][nFor1]['data']['journey'][nIWhile] && document.getElementById("button" + oContentCache[oCCCounter][nFor1]['data']['journey'][nIWhile]['id'])){
															
								 							disableTerminList(oContentCache[oCCCounter][nFor1]['data']['journey'][nIWhile]['id']);
															oCheckTerminConnectionConfig.params = {
																'Uri' 		: encodeURI(nzStdTargetServer + 'cgi-bin'),
																'FileName'	: encodeURI(nzStdPauschCgi),	
																														
																'temp'		: '0&' + encodeURI(oContentCache[oCCCounter][nFor1]['data']['journey'][nIWhile]['ibe-check'])
																};
													
															 oContentCache[oCCCounter]['lastCheck'] = new Object();
															 oContentCache[oCCCounter]['lastCheck']['id'] = oContentCache[oCCCounter][nFor1]['data']['journey'][nIWhile]['id'];
															 oContentCache[oCCCounter]['lastCheck']['nCount'] = nIWhile;
															 //alert(oContentCache[oCCCounter]['lastCheck']['id']+ " - " + oContentCache[oCCCounter]['lastCheck']['nCount']);
															 oHttpConnection.request(oCheckTerminConnectionConfig);
															 nIWhile = nTerminItemsPerPage;
														}														
														nIWhile++;
													}
												}
											}
										}//end if free
										
									}//end if currently visible
								}//end if id is equal
							nFor2++;
							}//end while
						}//end for1
						
						//oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['journey'][nDataSet]['ibe-check']
						
					nI++;
					}//end of while
					enableTerminList();
				
				}//end if oEncode
														    				
				Ext.Msg.hide();					
			};
		
		var oCheckTerminConnectionConfig = {	
													    //url: './php/pass_through.php?uri=' + urlencode('http://192.168.202.112/cgi-bin/pdbjsonexport.cgi?01=PDBJDL'),
													    url: './php/passThroughExt.php',
													    method: 'GET',
													    success: oCheckTerminSuccess,
														failure: function() {
													    	 		Ext.Msg.show({
																	   title:'Verbindungs- Timeout',
																	   msg: 'Eine Verbindung war leider nicht m&ouml;glich bitte versuchen Sie es sp&auml;ter erneut!',
																	   buttons: Ext.Msg.OK,
																	   icon: Ext.MessageBox.ERROR
																	});
													     },
													     timeout: nConnectionTimeOut
											};
											

		getNextTerminPage = function() {
								oContent = document.getElementById('content');
								if(oContentCache[oCCCounter]['type']   == 'DetailPage') {
									//oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['hotels']
									if(oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount'] + 1]) {
											oContent.style.display = 'none';
											oContentCache[oCCCounter]['PageCount']++;
											document.getElementById('TerminListContainer').innerHTML = oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['html'];
											updateCheckButtons();
											oContent.style.display = 'block';
									}else{
											oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['params']['98'] = (parseInt(oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['params']['98']) + parseInt(nTerminItemsPerPage));
											oStdConnectionConfig.params = oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['params'];
											//alert(oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['params']['98']); 
											oStdConnectionConfig.params['11'] = 'Y'; 
											oStdConnectionConfig.params['12'] = nTerminListSort;
											 updateCheckButtons();
											Ext.Msg.wait( 'Terminliste wird geladen','Bitte warten');
											oHttpConnection.request(oStdConnectionConfig);
									}//end if no request needed
								}//end if HotelList
							}//end of getNextHotelPage
							
							
		getLastTerminPage = function() {
								oContent = document.getElementById('content');
								if(oContentCache[oCCCounter]['type']   == 'DetailPage' && oContentCache[oCCCounter]['PageCount'] >= 1 ) {
									oContentCache[oCCCounter]['PageCount']--;
									oContent.style.display = 'none';
									document.getElementById('TerminListContainer').innerHTML = oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['html'];
									updateCheckButtons();
									oContent.style.display = 'block';
								}//end if htmlArrayCount
							}//end of getPastHotelPage
		updateCheckButtons = function(){
									
									var nI = 0;
									while(oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['journey'][nI]) {
									//alert(oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['journey'][nI]['free']);
											if(oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['journey'][nI]['free'] == 1) {
										   		document.getElementById('CheckTableButton'+oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['journey'][nI]['id']).innerHTML = '<input type="image" src="images/buchen.jpg" onclick="makeIframeForm('+"'"+ encodeURI(oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['journey'][nI]['ibe-book']) +"'"+')" />';
										   	}else if(oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['journey'][nI]['free'] == 0){
										   		document.getElementById('CheckTableButton'+oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['journey'][nI]['id']).innerHTML = '<image src="images/belegt.jpg" />';
										   	}//end if status
									nI++;
									}//end of while
		}
		checkTerminIfAvailable = function(nzIbeParameter, nId, nCount) {
						if(nzIbeParameter == ''){
							Ext.Msg.show({
										   title:'Achtung',
										   msg: 'Zuordnungs Fehler<br />Keine Parameter f&uuml;r diese Hotel gefunden, bitte rufen Sie die Seite sp&auml;ter nocheinmal auf!<br /><br />',
										   buttons: Ext.Msg.OK,
										   //fn: processResult,
										   //animEl: 'elId',
										   icon: Ext.MessageBox.WARNING
										});
	                	}else{
				             if(oContentCache[oCCCounter]['type'] == 'DetailPage') {
								//set get parameter
								  disableTerminList(nId);
								  oCheckTerminConnectionConfig.params = {
																'Uri' 		: encodeURI(nzStdTargetServer + 'cgi-bin'),
																'FileName'	: encodeURI(nzStdPauschCgi),	
																														
																'temp'		: '0&' + nzIbeParameter
																};
													
								  oContentCache[oCCCounter]['lastCheck'] = new Object();
								  oContentCache[oCCCounter]['lastCheck']['id'] = nId;
								  oContentCache[oCCCounter]['lastCheck']['nCount'] = nCount;
								  //alert("checkTerminIfAvailable: " + oContentCache[oCCCounter]['lastCheck']['id']  + " - " + oContentCache[oCCCounter]['lastCheck']['nCount']);
								
								  setConversion('pauschal/GAbetatigungPruefenButton.html');
								  oHttpConnection.request(oCheckTerminConnectionConfig);
								  
							}//end if check
						}//end if nzIbeParameters
					
			}//end of checkTerminIfAvailable
			
			
		disableTerminList = function(nId) {
		
								var nI = 0;
								var oButton = false;
								while(oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['journey'][nI]) {
										
										oButton = document.getElementById('button' + oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['journey'][nI]['id']);
										//alert(oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['journey'][nI]['id']);
										if(oButton) {
											if(oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['journey'][nI]['id'] == nId){
												//alert("Loading...");
												oButton.src = "images/loader.gif";
											}else{
												//alert("Not Loading...");
												oButton.disabled = true;
											}
											
										
										}//end if oButton
										
										/*	if(oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['journey'][nI]['free'] == 1) {
										   		document.getElementById('CheckTableButton'+oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['journey'][nI]['id']).innerHTML = '<input type="image" src="images/buchen.jpg" onclick="makeIframeForm('+"'"+ encodeURI(oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['journey'][nI]['ibe-book']) +"'"+')" />';
										   	}else if(oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['journey'][nI]['free'] == 0){
										   		document.getElementById('CheckTableButton'+oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['journey'][nI]['id']).innerHTML = '<image src="images/belegt.jpg" />';
										   	}//end if status*/
								nI++;
								}//end of while	
		
							}//end disableTerminList
							
							
							
		enableTerminList = function() {
		
								var nI = 0;
								var oButton = false;
								while(oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['journey'][nI]) {
										
										oButton = document.getElementById('button' + oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['journey'][nI]['id']);
										
										if(oButton) {
											oButton.disabled = false;
										}
										
										
																				
										//end if oButton
										
										/*	if(oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['journey'][nI]['free'] == 1) {
										   		document.getElementById('CheckTableButton'+oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['journey'][nI]['id']).innerHTML = '<input type="image" src="images/buchen.jpg" onclick="makeIframeForm('+"'"+ encodeURI(oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['journey'][nI]['ibe-book']) +"'"+')" />';
										   	}else if(oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['journey'][nI]['free'] == 0){
										   		document.getElementById('CheckTableButton'+oContentCache[oCCCounter][oContentCache[oCCCounter]['PageCount']]['data']['journey'][nI]['id']).innerHTML = '<image src="images/belegt.jpg" />';
										   	}//end if status*/
								nI++;
								}//end of while	
		
							}//end enableTerminList
							

/******************************************************************************/
/*********************** Create TerminList END ********************************/
/******************************************************************************/	





/******************************************************************************/
/*********************** Create FormIframe START ******************************/
/******************************************************************************/

makeIframeForm = function(nzIframeLink) {
								
								if(nzIframeLink != '') {
									oCCCounter++;
									oContent = document.getElementById('content');
									
									oContent.style.display = 'none';
									oContent.innerHTML = '<iframe id="JspMask" src="'+nzStdServerUri+'?Uri='+encodeURI(nzStdTargetServer + 'cgi-bin')+'&FileName='+encodeURI(nzStdPauschCgi)+'&'+encodeURI(nzIframeLink)+'" height="900px" name="JspMask" frameborder="0"  scrolling="auto" style="margin: 0px;padding:0px;padding-top:20px;padding-left:18px;" marginheight="0" marginwidth="0" ></iframe>';
									//setConversion('pauschal/GAsendFormular.html');
									oContent.style.display = 'block';
								}
								
							}//end makeIframeForm

/******************************************************************************/
/*********************** Create FormIframe END ********************************/
/******************************************************************************/


/******************************************************************************/
/*********************** Start Submit from Link START *************************/
/******************************************************************************/
			
			
			
								var oOfferHttpConnection = new Ext.data.Connection();
								  
								var oOfferConnectionConfig = {	
													    //url: './php/pass_through.php?uri=' + urlencode('http://192.168.202.112/cgi-bin/pdbjsonexport.cgi?01=PDBJDL'),
													    url: './php/teaserPassThrough.php',
													    method: 'GET',
													    //params: '',
													    success: oStdSuccess,
														failure: function() {
													    	 		Ext.Msg.show({
																	   title:'Verbindungs- Timeout',
																	   msg: 'Eine Verbindung war leider nicht mglich bitte versuchen Sie es spÃ¤ter erneut!',
																	   buttons: Ext.Msg.OK,
																	   icon: Ext.MessageBox.ERROR
																	});
													     },
													     timeout: nConnectionTimeOut
											};
								  
								  //set get parameter
									
			

		 	

/******************************************************************************/
/*********************** Start Submit from Link END ***************************/
/******************************************************************************/

/******************************************************************************/
/*********************** Start Themenwelt call START **************************/
/******************************************************************************/
			function querystring(key){
				var value = null;
				for (var i=0;i<querystring.keys.length;i++){
					if (querystring.keys[i]==key){
						value = querystring.values[i];
						break;
					}
				}
				return value;
			}
			querystring.keys = new Array();
			querystring.values = new Array();
				
			function querystring_parse(nzParams){
				//var query = window.location.search.substring(1);
				var query = nzParams;
				var pairs = query.split("&");
				
				for (var i=0;i<pairs.length;i++){
				var pos = pairs[i].indexOf('=');
					if (pos >= 0){
						var argname = pairs[i].substring(0,pos);
						var value = pairs[i].substring(pos+1);
						querystring.keys[querystring.keys.length] = argname;
						querystring.values[querystring.values.length] = value;
					}
				}
			}
			
callThemenwelt = function(nzParams) {

			querystring_parse(nzParams); 
			closeMe('travelcategorieContentStartseite');
			                                       
			                                        
			updateHotellist();
			                                        
			                                        
			//new request reset
			    delete oContentCache;
			    oContentCache	= new Object();
				oCCCounter 		= -1;
	                
	                	document.getElementById('destinationListButton').style.display = 'none';
	                	document.getElementById('contentIframe').style.display = 'none';
	                	document.getElementById('content').style.display = 'block';


	oOfferConnectionConfig.params = {									
						'Link'		: decodeURI(nzParams)
	};
	
	Ext.Msg.wait( 'Reisedaten werden geladen','Bitte warten');
	
	var newStartDate = querystring("startDate");
		var newReturnDate = querystring("returnDate");
		
		if(!querystring("startDate") || !querystring("returnDate")){
			newStartDate  =  todayDate.add(Date.DAY, 30);
			newReturnDate =  todayDate.add(Date.DAY, 300);
		}
		
		window.vonPicker.setValue(newStartDate);
		window.bisPicker.setValue(newReturnDate);
		
		if(querystring("duration")) DauerList.setValue(querystring("duration")); else DauerList.setValue(7);
		if(querystring("adults"))   AdultList.setValue(querystring("adults"));   else AdultList.setValue(2);
		
		nzLastRegionFromList = querystring("destination");
		nzLastHotelFromList  = (querystring("hotelId") == '' || querystring("hotelId") == null)? '' : querystring("hotelId");
		
	oOfferHttpConnection.request(oOfferConnectionConfig);

}//end of callThemenwelt

							
			if(nzFrmsrc && nzFrmsrc != '') {
									callThemenwelt(nzFrmsrc);
		 	}//end if nzFrmsrc

/******************************************************************************/
/*********************** Start Themenwelt call END ****************************/
/******************************************************************************/

//END of Pauschalmask Function
}//end of createDynamicMaskFields
