
function createLoginForm(parentDiv){
	
	var content ="<div id ='logout' class='logout hidden'>"
							+"<a href='#' onclick='logoutSend()'>Abmelden</a>"							
					+"</div>"
				 	+"<div id ='message' class='message hidden'></div>"	
					+"<div id ='progress' class='progress'></div>"
					+"<div id='loginContent'>"
						+"<div id='lh_1' class='loginHeader_1'>"
	      					+"Melden Sie sich an mit Ihrem \"Map and Route\"-Konto"
	      				+"</div>"
						+"<form  id='loginform' action='' method='post' onsubmit='return loginSend();' >"
	      					+"<div id='loginbox' class='loginbox'>"
	      						+"<div id='loginMail' class='loginMail'>"
		      						+"<div>E-Mail:</div>"									   
									+"<input type='text' name='l_email' id='l_email' /> "
									+"<span  title='login_mail'  class ='formToolTip bgControls'></span>"
								+"</div>"
								+"<div id='loginPass' class='loginPass'>"																				  
									+"<div>Passwort:</div>"
									+"<input  type='password' name='l_passwd' id='l_passwd'  size='18' />"
									+"<span  title='login_pass' class ='formToolTip bgControls'></span>"
								+"</div>"
								+"<div id='loginSubmit' class='loginSubmit'>"
									+"<input type='submit' class='submit' name='submit' id='signIn' value='Anmelden'/>"
								+"</div>"
							+"</div>"
						+"</form>"					
						+"<div id='lh_2' class='loginHeader_2'>"
							+"Sie haben noch kein Konto?"	  							
						+"</div>"
						+"<div id='lcb_1' class='loginCreateBox'>"
							+"<a href='#' onclick='setContentAktiv(\"createAccountContent\"); return false;' >"
							 +" Jetzt ein Konto anlegen"
							+" </a>"
						+"</div>"
						+"<div id='lh_3' class='loginHeader_3'>"
							 +"Sie haben Ihr Passwort vergessen?"	  							
						+"</div>"
						+"<div id='lcb_2' class='loginCreateBox'>"
							+"<a href='#' onclick='setContentAktiv(\"emailRequestContent\"); return false;' >"
							 +"Jetzt Passwort anfordern"
							+" </a>"
						+"</div>"
						+"<div id='lh_4' class='loginHeader_4'>"
							 +"M\u00F6chten Sie Ihr Konto l\u00F6schen?"	  							
						+"</div>"
						+"<div d='lcb_3' class='loginCreateBox'>"
							+"<a href='#' onclick='setContentAktiv(\"deleteAccountContent\"); return false;' >"
							 +" Jetzt Konto l\u00F6schen"
							 +"</a>"
						+"</div>"
	  				+"</div>"
	  				+"<div id='createAccountContent' class='hidden'>"
	  					+"<div id='ah_1' class='accountHeader_1'>"
	      					+"Konto erstellen"
	      				+"</div>"  				
	  					+"<div id='accountText' class='accountText'>"
	      					+"Mit Ihrem Favoriten-Konto k\u00F6nnen Sie POIs erstellen und verwalten."
	      				+"</div>"
						+"<div id='ah_2' class='accountHeader_2'>"
	      					+"Erforderliche Information  f\u00FCr das Favoriten-Konto"
	      				+"</div>"	
						+"<form  id='createAccountForm'  action='' method='post' onsubmit='return createAccountSend();' >"
	      					+"<div id='accountbox' class='accountbox'>"
	      						+"<div id='currentEMail' class='accountfields'>"
		      						+"<div>Ihre derzeitige E-Mail-Adresse:</div>"									   
									+"<input type='text' name='email' id='email' /> "
									+"<span title='createLogin_email' class ='formToolTip bgControls'></span>"
								+"</div>"
								+"<div id='createPass' class='accountfields'>"																				  
									+"<div>Passwort w\u00E4hlen:</div>"
									+"<input  type='password' name='passwd' id='passwd'  size='18'  />"
									+"<span title='createLogin_pass' class ='formToolTip bgControls'></span>"
								+"</div>"
								+"<div id='repeatePass' class='accountfields'>"
									+"<div>Passwort nochmals eingeben:</div>"
									+"<input  type='password' name='passwdRep' id='passwdRep'  size='18'  />"
									+"<span title='createLogin_passRep' class ='formToolTip bgControls'></span>"
								+"</div>"
								+"<div id='createLoginSubmit' class='loginSubmit'>"
									+"<input type='button'  value='Zur\u00FCck'onclick='setContentAktiv(\"loginContent\"); return false;'/>"
									+"<input type='submit' class='submit' name='' id='createLogin' value='Konto erstellen'/>"
								+"</div>"
							+"</div>"
						+"</form>"						
					+"</div>"
					+"<div id='emailRequestContent' class='hidden'>"
	  					+"<div id='emailRequestHeader' class='emailRequestHeader'>"
	      					+"Passwort anfordern"
	      				+"</div>"	      				
	  					+"<div id='emailRequestText' class='emailRequestText'>"
	      					+"Geben Sie zum Zusenden Ihres Passworts die vollst\u00E4ndige E-Mail-Adresse ein, die Sie bei der Anmeldung in Ihrem Favoriten-Konto verwenden."
	      				+"</div>"
						+"<form  id='emailRequestForm'  action='' method='post' onsubmit='return requestMailSend();' >"
	      					+"<div id='emailRequestBox' class='emailRequestbox'>"
	      						+"<div id='emailRequestMail' class='emailRequestfields'>"
		      						+"<div>Ihre derzeitige E-Mail-Adresse:</div>"									   
									+"<input type='text' name='erEmail' id='erEmail'  />" 
								+"</div>"								
								+"<div id='emailRequestSubmit' class='loginSubmit'>"
									+"<input type='button'  value='Zur\u00FCck'onclick='setContentAktiv(\"loginContent\"); return false;'/>"
									+"<input type='submit' class='submit' name='' id='emailRequest' value='Senden'/>"
								+"</div>"
							+"</div>"
						+"</form>"						
					+"</div>"
					+"<div id='deleteAccountContent' class='hidden'>"
						+"<div id='deleteAccountHeader' class='deleteAccountHeader'>"
	      					+"Melden Sie sich an mit Ihrem 'Map and Route'-Konto. Nach der Anmeldung wurde Ihr Konto gel\u00F6scht."
	      				+"</div>"
						+"<form  id='deleteForm' action='' method='post' onsubmit='return loginAndDeleteAccountSend();' >"
	      					+"<div id='deleteBox' class='deleteBox'>"
	      						+"<div id='deleteAccountMail' class='deleteAccountMail'>"
		      						+"<div>E-Mail:</div>"									   
									+"<input type='text' name='deleteAccount_email' id='deleteAccount_email' /> "
									+"<span title='deleteAccount_mail' class ='formToolTip bgControls'></span>"
								+"</div>"
								+"<div id='deleteAccountPass' class='deleteAccountPass'>"																				  
									+"<div>Passwort:</div>"
									+"<input  type='password' name='deleteAccount_passwd' id='deleteAccount_passwd'  size='18' />"
									+"<span title='deleteAccount_pass' class ='formToolTip bgControls'></span>"
								+"</div>"
								+"<div id='deleteAccountSubmit' class='loginSubmit'>"
									+"<input type='button' value='zur\u00FCck' onclick='setContentAktiv(\"loginContent\"); return false;'>"
									+"<input type='submit' class='submit' name='submit'  value='Konto l\u00F6schen'/>"
								+"</div>"
							+"</div>"
						+"</form>"	  								
					+"</div>"
					+"<div id='poiListContent' class='hidden'>"
						+"<div id='divOverlayList' class='overlayList' >"									
							+"<INPUT TYPE='CHECKBOX' id='cbPoiList' name='cbPoiList' checked onClick='showPrivatePOIs(this.checked);'>"
							+"<label for='cbPoiList' id='labelCbPoiList' >Favoriten auf der Karte einblenden.</label>"	
						+"</div>"
						+"<div id='poiListHeader' class='poiListHeader'>"
	      					+"Ihre Favoriten:"  					
	      				+"</div>"
	      				+"<form  id='poiListForm'  action='' method='post' onsubmit='return poiListSend();' >"
		      				+"<table border='1'>"
		      					+"<thead>"
		      						+"<tr>"		      							
		      							+"<td><b>Name</b></td>"
		      							+"<td><b>Symbol</b></td>"
		      							+"<td><b>\u00D6ffentl.</b></td>"	      							     							
		      						+"</tr>"
		      					+"<thead>"
		      				+"</table>"
		      				+"<div id='poiListSubmit' class='loginSubmit'>"
		      					+"<input type='button' value='Favorit hinzuf\u00FCgen' onclick='return clearCreateForm();'>"		      					
								+"<input type='submit' class='submit' name='' id='poiList' value='Favoriten ver\u00F6ffentlichen'/>"
							+"</div>"
							+"<input type='hidden' name='userId' id='userId' value=''>"
	      				+"</form>"
					+"</div>"
					+"<div id='poiSaveContent' class='hidden'>"
						+"<div id='poiSaveHeader' class='poiSaveHeader'>"
	      					+"Favoriten-Eintrag bearbeiten"
	      				+"</div>"
	      				+"<form  id='poiSaveForm'  action='' method='post' onsubmit='return savePoiSend()' >"
	      					+"<div id='poiSaveBox' class='poiSaveBox'>"
	      						+"<div id='poiName' class='poiFormEntry'>"
		      						+"<div class='poiFormLabel'>Name:</div>	"								   
									+"<input type='text' name='poiNameText' id='poiNameText' class='poiFormTextLang'  />" 
								+"</div>"
								+"<div id='plzOrt'  class='poiFormEntry'>"																				  
									+"<div class='poiFormLabel'>PLZ Ort:</div>"
									+"<input type='text' name='plz' id='plz' class='poiFormTextKurz' />" 
									+"<input type='text' name='ort' id='ort' class='poiFormTextMittel' /> "
								+"</div>"
								+"<div id='strasseHnr' class='poiFormEntry'>"
									+"<div class='poiFormLabel'>Stra\u00dfe Hnr:</div>"
									+"<input type='text' name='strasse' id='strasse' class='poiFormTextMittel' />" 
									+"<input type='text' name='hnr' id='hnr' class='poiFormTextKurz' />"
								+"</div>"	
								+"<div id='beschreibung' class='poiFormEntry'>"
		      						+"<div class='poiFormLabel'>Text:</div>"									   
									+"<input type='text' name='beschreibungText' id='beschreibungText' class='poiFormTextLang'  />" 
								+"</div>"	
								+"<div id='logoSave' class='poiFormEntry'>"
		      						+"<div class='poiFormLabel'>Symbol:</div>"									   
									+"<select name='logoCombo' id='logoCombo' >"								       
								        +"<option> standard1.gif </option>"
								        +"<option> standard2.gif</option>"
								        +"<option> standard3.gif </option>"
								    +"</select>"
								    +"<img id ='logoComboImage' alt='' src='' >"
								+"</div>"						
								+"<div id='saveSubmit' class='loginSubmit'>"
									+"<input type='button' value='zur\u00FCck zur Liste' onclick='return returnToPoiList();'>"
									+"<input type='button' value='L\u00F6schen' onclick='return deletePoiSend();'>"
									+"<input type='submit' class='submit' name='' id='saveSubmit' value='Speichern'/>"
								+"</div>"
							+"</div>"
							+"<input type='hidden' name='x' id='x' value='' readonly='readonly'>"
							+"<input type='hidden' name='y' id='y' value='' readonly='readonly'>"
							+"<input type='hidden' name='userId' id='userId' value=''>"
							+"<input type='hidden' name='poiId' id='poiId' value=''>"
							+"<input type='hidden' name='publish' id='publish' value=''>"
						+"</form>"
						+"<div id='adressSearchResult'/>"
						+"</div>";
	
	parentDiv.innerHTML=content;
}			function formatTMCPro(record,firstContent,moreTargets)
	{
		var div = document.createElement('div');
		div.style.position = 'relative';
		var iconDiv = document.createElement('div');
		iconDiv.style.position = 'absolute';
		iconDiv.style.width = '40px';
		iconDiv.style.top = '0px';
		iconDiv.style.left = '0px';
		
	    if(firstContent == false || moreTargets==true){
			iconDiv.style.top = '10px';
		    div.appendChild(createEmptyParagraph('10px'));
		}
	    if(firstContent == false &&  moreTargets==true){
	    	
			var divLine = getCutLine();
			div.appendChild(divLine);
			div.appendChild(createEmptyParagraph('10px'));
			iconDiv.style.top = '20px';
		}
		div.appendChild(iconDiv);
		iconDiv.appendChild(addTMCIcon(parseInt(record.EvtEffCode)));

		var arr_date = record.DateNow.substring(0, 10).split("-");
		var arr_time = record.DateNow.substring(11).split(":");
	    var arr_dateStart = record.DateStart.substring(0, 10).split("-");
		var arr_timeStart = record.DateStart.substring(11).split(":");
	    var formattedDate = arr_date[2] + "." + arr_date[1] + "." + arr_date[0] + " " + arr_time[0] + ":" + arr_time[1];
	    var formattedDateStart = arr_dateStart[2] + "." + arr_dateStart[1] + "." + arr_dateStart[0] + " " + arr_timeStart[0] + ":" + arr_timeStart[1];

	    var text = 'Auf der <b>' + record.xmlRoad + ' von ' + record.DirFrom + ' nach ' + record.DirTo + ' </b>';
	    text = text.replace(/\u0020/g, '&nbsp;');
	    div.appendChild(createTextParagraphTMC(text));

	    text = (record.xmlLocTo.length == 0 ? 'bei ' + record.xmlLocFrom : 'zwischen ' + record.xmlLocFrom + ' und ' + record.xmlLocTo) + ' ' ;
	    text = text.replace(/\u0020/g, '&nbsp;');
	    div.appendChild(createTextParagraphTMC(text));

	    text =  '<b>' + record.EvtEffTxt  + '</b>' + ' '+ (record.EvtCauTxt.length == 0 ? '' : 'wegen ' + record.EvtCauTxt);
	    text = text.replace(/\u0020/g, '&nbsp;');
	    div.appendChild(createTextParagraphTMC(text));

	    text = (record.AvSpeed == '0' ? '' : '( zu erwartende Geschwindigkeit ' + record.AvSpeed + ' km/h)')   ;
	    text = text.replace(/\u0020/g, '&nbsp;');
	    div.appendChild(createTextParagraphTMC(text));

	    div.appendChild(createTextParagraph('<br>'));

	    text = 'Beginn: ' + formattedDateStart   ;
	    text = text.replace(/\u0020/g, '&nbsp;');
	    div.appendChild(createTextParagraphTMC(text));

	    text = 'Stand: ' + formattedDate  ;
	    text = text.replace(/\u0020/g, '&nbsp;');
	    div.appendChild(createTextParagraphTMC(text));

		return div;
	}
	
	function formatDate(dateString)
	{
		var date = dateString.split('T')[0];
		var day = date.split('-')[2];
		var month = date.split('-')[1];
		var year = date.split('-')[0];
		var time = dateString.split('T')[1];
		var monthName = '';		
		if (month == '01') {monthName = 'Jan';}		
		else if (month == '02') {monthName = 'Feb';}		
		else if (month == '03')	{monthName = 'Mrz';}
		else if (month == '04')	{monthName = 'Apr';}
		else if (month == '05')	{monthName = 'Mai';}
		else if (month == '06') {monthName = 'Jun';}
		else if (month == '07')	{monthName = 'Jul';}
		else if (month == '08')	{monthName = 'Aug';}
		else if (month == '09')	{monthName = 'Sep';}
		else if (month == '10')	{monthName = 'Okt';}
		else if (month == '11')	{monthName = 'Nov';}
		else if (month == '12')	{monthName = 'Dez';}		
		return '<nobr>' + day + '&nbsp;' + monthName + '&nbsp;' + year + ',&nbsp;' + time;
	}
	

	/*
	 * Returns an corresponding image for the TMC code.
	 * 
	 * @param {int} code @return {Image} img
	 */
	function addTMCIcon(code)
	{
		var img = document.createElement('img');

		if (code == 26 || code == 27)
		{
			img.src = iwconst.GLOBAL_APP_URL+'/img/symbols/tmc/tmc_verengung.png';
		}
		else if (code == 28 || code == 44 || code == 45 || (code >= 62 && code <= 65))
		{
			img.src = iwconst.GLOBAL_APP_URL+'/img/symbols/tmc/tmc_sperrung.png';
		}
		else if (code >= 30 && code <= 38)
		{
			img.src = iwconst.GLOBAL_APP_URL+'/img/symbols/tmc/tmc_baustelle.png';
		}
		else if (code == 51 || (code >= 74 && code <= 174))
		{
			img.src = iwconst.GLOBAL_APP_URL+'/img/symbols/tmc/tmc_vorsicht.png';
		}
		else
		{
			img.src = iwconst.GLOBAL_APP_URL+'/img/symbols/tmc/tmc_stau.png';
		}

		return img;
	}
	 function createTextParagraph(text,paddingLeft)
	    {
	        var p = document.createElement('p');
	        p.style.margin = '0px';
	        p.style.padding = '0px';
	        p.style.color='#1B57B1';
	       
	        if(paddingLeft){
	        	p.style.paddingLeft = paddingLeft;     
	        }
	        text = trim(text);		
	        p.innerHTML = text;
	        return p;
	    }
	    function createEmptyTextParagraph(fontSize)
	    {
	    	var p = createTextParagraph('text');
	    	p.style.fontSize=fontSize+'px';
	        p.style.visibility = 'hidden';
	        return p;
	    }
	    
	    function createEmptyParagraph(lineHeight){
	        
	    	 var p = document.createElement('p');

	         p.style.margin = '0px';
	         p.style.padding = '0px';
	 		 p.style.lineHeight = lineHeight;
	         p.innerHTML = '&nbsp;';
	         return p;

	        
	    }
	    function createTextParagraphTMC(text)
	    {
	        var p = document.createElement('p');

	        p.style.margin = '0px';
	        p.style.padding = '0px';
	        p.style.paddingLeft = '40px'; 
	        p.style.color='#1B57B1';       
	        p.innerHTML = text;
	        return p;
	    }
	    function formatZusatzContent(record,firstContent,moreTargets,coordinate){
	    	
			var d;
		     var ovlType = record.OVL_TYP;
		     if(ovlType == 'Geldautomaten'){
		    	var div =  formatGeldautomatenContent(record,firstContent,moreTargets,coordinate);
		    	return div; 
		     }
		     if(ovlType == 'Apotheken'){
			    	var div =  formatApothekenContent(record,firstContent,moreTargets,coordinate);
			    	return div; 
			     }

		     if(ovlType == 'Kino'){
		    	 var div =  formatKinoContent(record,firstContent,moreTargets,coordinate);
			    	return div; 
			 }
			 if(ovlType == 'Event'){
		    	 var div =  formatEventContent(record,firstContent,moreTargets,coordinate);
			    	return div; 
			 }
			 if(ovlType == 'Parkplatz'){
				
		    	 var div =  formatParkplatzContent(record,firstContent,moreTargets,coordinate);
			    	return div; 
			 }
			 if(ovlType == 'Wetter'){					
		    	 var div =  formatWetterContent(record,firstContent,moreTargets,coordinate);
			    	return div; 
			 }
			 if(ovlType == 'Radar'){					
		    	 var div =  formatRadarContent(record,firstContent,moreTargets,coordinate);
			    	return div; 
			 }
			 if(ovlType == 'Museen'){					
		    	 var div =  formatMuseenContent(record,firstContent,moreTargets,coordinate);
			    	return div; 
			 }
			 if(ovlType == 'Wlan'){					
		    	 var div =  formatWlanContent(record,firstContent,moreTargets,coordinate);
			    	return div; 
			 }
		   return d;  
		}
	    function formatWlanContent(record,firstContent,moreTargets,coordinate){
	    	
	    	var div = document.createElement('div');
			div.style.position = 'relative';
			
			var iconDiv = document.createElement('div');
			iconDiv.style.position = 'absolute';
			iconDiv.style.width = '40px';
			iconDiv.style.top = '5px';
			iconDiv.style.left = '0px';
			var wlan = record.wlan;	
			
			var img = document.createElement('img');
			img.src = appUrl+'/'+appName+'img/poi/W-LAN.gif';
			
			iconDiv.appendChild(img); 
			
			if(firstContent== false || moreTargets == true){
				div.appendChild(createEmptyTextParagraph(6));
				iconDiv.style.top = '15px';
				iconDiv.style.paddingTop ='7 px';
			}
			if(firstContent == false &&  moreTargets==true){
		    	
				var divLine = getCutLine();
				div.appendChild(divLine);
				div.appendChild(createEmptyTextParagraph(10));
				iconDiv.style.top = '20px';
				iconDiv.style.paddingTop ='7 px';
			}
					
			div.appendChild(iconDiv);
			
			var wlan = record.wlan;				
			
	    	var id =wlan.id;
	    	var zip = wlan.zip;
	    	var ort = wlan.ort;	    	
	    	var strasse = wlan.strasse;
	    	var hnr = wlan.hnr;
	    	var country = wlan.country;
	    	var name = wlan.name;
	    	var provider = wlan.provider;
	    	var commerzProvider = wlan.commercProvider;
	    	var locationType = wlan.locationType;
	    	var rates = wlan.rates;
	    	
			var boldName =createTextParagraph(name.replace(/\u0020/g, '&nbsp;'),'40px');
	    	boldName.style.fontWeight = 'bold';
		    boldName.style.color ='black';
		    boldName.style.whiteSpace='nowrap';
		    div.appendChild(boldName);
		    var p = createTextParagraph(strasse.replace(/\u0020/g, '&nbsp;')+" "+hnr.replace(/\u0020/g, '&nbsp;'),'40px');
		    p.style.whiteSpace='nowrap';
		    div.appendChild(p);
		    
		    var p = createTextParagraph(zip.replace(/\u0020/g, '&nbsp;')+" "+ort.replace(/\u0020/g, '&nbsp;'),'40px');
		    p.style.whiteSpace='nowrap';
		    div.appendChild(p);
		   
		    div.appendChild(createTextParagraph(country.replace(/\u0020/g, '&nbsp;'),'40px'));
		    div.appendChild(createEmptyTextParagraph(10));	
		    
		    var table = iw.create('table');
		    table.style.cellspacing = '0';
		    table.style.position ='relative';			   
		    var r =0;
		    if(provider != undefined && provider.length >0){			
				getAddData('Provider: ',provider.replace(/\u0020/g, '&nbsp;'),r,table);
				r++;			
			}
		   
		    if(commerzProvider != undefined && commerzProvider =="Y"){	
		    	var ratesArr = rates.split(";");
		    	for( var i=0;i<ratesArr.length;i++) {
		    		if(i==0 && ratesArr[i].length >0) {
		    			getAddData('Geb\u00FChr: ',ratesArr[i],r,table);
		    			r++;
		    		}
		    		else {
		    			getAddData('',ratesArr[i],r,table);
		    			r++;
		    		}
		    	}
			}
		    
		    if(locationType != undefined && locationType.length >0){			
				getAddData('Standort: ',locationType.replace(/\u0020/g, '&nbsp;'),r,table);
				r++;			
			}
		    
		    div.appendChild(table);
		    div.appendChild(createEmptyTextParagraph(5));
		    if(userId!=undefined && userId !=null){
				div.appendChild(createEmptyTextParagraph(10));
	            var ugc = createTextParagraph('<a href="#" onclick="return fillCreateForm(\''+name+'\',\''+zip+'\',\''+city+'\',\''+strasse+'\',\''+hnr+'\','+coordinate.getX()+','+coordinate.getY()+');">POI \u00FCbernehmen</a>','7px');
	            ugc.style.fontWeight = 'bold';
	            div.appendChild(ugc);				
			}
	    	return div;
	    }
	    
	    function formatPODContent(record,firstContent,moreTargets,coordinate){
	    	
	    	var div = document.createElement('div');
	        div.style.position = 'relative';
	        if(firstContent== false || moreTargets== true){
	        	div.appendChild(createEmptyParagraph('7px'));
			}
			if(firstContent == false &&  moreTargets==true){
		    	
				var divLine = getCutLine();
				div.appendChild(divLine);
				div.appendChild(createEmptyParagraph('10px'));
				
			}
	        var name = record.Name;

	        var boldName = createTextParagraph(name.replace(/\u0020/g, '&nbsp;'));
	        boldName.style.fontWeight = 'bold';
	        boldName.style.color ='black';
	        div.appendChild(boldName);
	        if(record.Street){
	        	div.appendChild(createTextParagraph(record.Street.replace(/\u0020/g, '&nbsp;') + '&nbsp;' + record.HNR.replace(/\u0020/g, '&nbsp;')));
	        }
	        if(record.zipCode){
	        	 div.appendChild(createTextParagraph(record.zipCode.replace(/\u0020/g, '&nbsp;') + '&nbsp;' + record.place.replace(/\u0020/g, '&nbsp;')));
	        }
	        div.appendChild(createEmptyParagraph('10px'));
	        var desc = record.desc.split("|");
	        var buch = createTextParagraph(desc[2]);//\u00D6
	        buch.style.fontWeight = 'bold';
	        div.appendChild(buch);
	        div.appendChild(createTextParagraph("Buch: "+desc[9]+" ("+desc[8]+")"));
	        var aktion ="";
	        console.log(desc[4]);
	        if(desc[4]!='00.00.0000'){
	        	aktion = "Verf\u00FCgbar von : "+desc[4];
	        }
	        if(desc[5]!='00.00.0000'){
	        	aktion += " bis: "+desc[5];
	        }
	        div.appendChild(createTextParagraph(aktion));
	        if(userId!=undefined && userId !=null){
				div.appendChild(createEmptyTextParagraph(10));
	            var ugc = createTextParagraph('<a href="#" onclick="return fillCreateForm(\''+name+'\',\''+record.zipCode+'\',\''+record.place+'\',\''+record.Street+'\',\''+record.HNR+'\','+coordinate.getX()+','+coordinate.getY()+');">POI \u00FCbernehmen</a>','7px');
	            ugc.style.fontWeight = 'bold';
	            div.appendChild(ugc);				
			}	
	    	return div;
	    }
	    function formatMuseenContent(record,firstContent,moreTargets,coordinate){
	    	
	    	var div = document.createElement('div');
			div.style.position = 'relative';
			
			if(firstContent== false || moreTargets == true){
				div.appendChild(createEmptyTextParagraph(6));				
			}
			if(firstContent == false &&  moreTargets==true){		    	
				var divLine = getCutLine();
				div.appendChild(divLine);
				div.appendChild(createEmptyTextParagraph(10));				
			}
			var museum = record.museum;				
			
	    	var id =museum.id;
	    	var zip = museum.zip;
	    	var ort = museum.ort;	    	
	    	var strasse = museum.strasse;
	    	var hnr = museum.hnr;
	    	var country = museum.country;
	    	var title = museum.title;
	    	
	    	var namelong = museum.namelong;
			var countryCode = museum.countryCode;
			var phone1 = museum.phone1;
			var url1 = museum.url1;
			var url2= museum.url2;
			var fax1= museum.fax1;
			var textLong = museum.textLong;
			var mail1 = museum.mail1;
			var landkreis = museum.landkreis;
			var oeffZeit = museum.oeffZeit;
			var standDatum = museum.standDatum;
			var startDatum = museum.startDatum;
			var endDatum = museum.endDatum;
	    	var pictureUrl = museum.pictureUrl;
	    	
			var boldName =createTextParagraph(title.replace(/\u0020/g, '&nbsp;'));
	    	boldName.style.fontWeight = 'bold';
		    boldName.style.color ='black';
		    boldName.style.whiteSpace='nowrap';
		    div.appendChild(boldName);
		    var p = createTextParagraph(strasse.replace(/\u0020/g, '&nbsp;')+" "+hnr.replace(/\u0020/g, '&nbsp;')+", "+zip.replace(/\u0020/g, '&nbsp;')+" "+ort.replace(/\u0020/g, '&nbsp;'));
		    p.style.whiteSpace='nowrap';
		    div.appendChild(p);
		    div.appendChild(createEmptyTextParagraph(10));	    
		    
		    if(pictureUrl.length >0) {
		    	var iconDiv = document.createElement('div');
				iconDiv.style.position = 'relative';
				iconDiv.style.marginRight = '10px';
				iconDiv.style.marginBottom = '10px';
				iconDiv.style.top = '5px';
				iconDiv.style.left = '0px';
				iconDiv.style.cssFloat = 'left';
				iconDiv.style.styleFloat = 'left';
				iconDiv.style.width='60px';
				iconDiv.style.height='120px';
				
				var img = document.createElement('img');
				img.src = pictureUrl;
				img.style.width='60px';
				img.style.height='120px';
				iconDiv.appendChild(img);
				div.appendChild(iconDiv);
		    	
		    }
		    if(textLong.length >0) {
		    	
		    	 div.appendChild(createTextParagraph(textLong,10));	
		    }
		    div.appendChild(createEmptyTextParagraph(10));
		   
		    if(url1 != undefined && url1.length >0){	
		    	if( url1.substring(0, 4)!='http'){
		    		url1 = 'http://'+url1;
		        }
		    	var pUrl = createTextParagraph('<a href="' + url1 + '" target="_blank"><IMG SRC="'+mapApiUrl+appName+'img/poi/mehrInfo_kl.gif" border="0"></a>');
			    pUrl.style.cssFloat = 'left';
		    	pUrl.style.height='25px';
		    	div.appendChild(pUrl);
			}
		    if(url2 != undefined && url2.length >0){	
		    	if( url2.substring(0, 4)!='http'){
		    		url2 = 'http://'+url2;
		        }
		    	var pUrl = createTextParagraph('<a href="' + url2 + '" target="_blank"><IMG SRC="'+mapApiUrl+appName+'img/poi/mehrInfo_kl.gif" border="0"></a>');
		    	pUrl.style.height='25px';
		    	div.appendChild(pUrl);
			}
		    var table = iw.create('table');
		    table.style.cellspacing = '0';
		    table.style.position ='relative';
		    table.style.clear='both';
		    var r =0;
		    if(phone1 != undefined && phone1.length >0){			
				getAddData('Telefon:',phone1.replace(/\u0020/g, '&nbsp;'),r,table);
				r++;			
			}
		    if(fax1 != undefined && fax1.length >0){			
				getAddData('FAX:',fax1.replace(/\u0020/g, '&nbsp;'),r,table);
				r++;			
			}
		    
		    if(mail1 != undefined && mail1.length >0){			
				getAddData('E-Mail:',mail1.replace(/\u0020/g, '&nbsp;'),r,table);
				r++;			
			}
		    if(oeffZeit != undefined && oeffZeit.length >0){			
				getAddData('\u00D6ffnungszeiten:',oeffZeit.replace(/\u0020/g, '&nbsp;'),r,table);
				r++;			
			}
		    if(standDatum != undefined && standDatum.length >0){			
				getAddData('Stand:',standDatum.replace(/\u0020/g, '&nbsp;'),r,table);
				r++;			
			}
		    div.appendChild(table);		   
		    div.appendChild(createEmptyTextParagraph(5));
		    if(userId!=undefined && userId !=null){
				div.appendChild(createEmptyTextParagraph(10));
	            var ugc = createTextParagraph('<a href="#" onclick="return fillCreateForm(\''+title+'\',\''+zip+'\',\''+ort+'\',\''+strasse+'\',\''+hnr+'\','+coordinate.getX()+','+coordinate.getY()+');">POI \u00FCbernehmen</a>','7px');
	            ugc.style.fontWeight = 'bold';
	            div.appendChild(ugc);				
			}
	    	return div;
	    }
	    function formatRadarContent(record,firstContent,moreTargets,coordinate){
	    	
			var radar = record.radar;	
	    	var id =radar.id;
	    	var zip = radar.zip;
	    	var ort = radar.ort;
	    	var ortsTeil = radar.ortsTeil;
	    	var land = radar.land;
	    	var bLand = radar.bundesLand;
	    	var region = radar.region;
	    	var strasse = radar.strasse;
	    	var hnr = radar.hnr;
	    	
	    	var beschr = radar.beschreibung;
			var speed = radar.speed;
			var gpsStatus = radar.gpsStatus;
			var typeDescr = radar.typeDescr;
			var statusDescr= radar.statusDescr;
			var directDescr= radar.directDescr;
			var aktual = radar.dateStr;
	    	
			var div = document.createElement('div');
			div.style.position = 'relative';
			
			var iconDiv = document.createElement('div');
			iconDiv.style.position = 'absolute';
			iconDiv.style.width = '40px';
			iconDiv.style.height = '40px';
			iconDiv.style.top = '5px';
			iconDiv.style.left = '0px';
			
			var img = document.createElement('img');
			img.style.width = '35px';
			img.style.height = '30px';
			if(statusDescr =='aktiv') {
				img.src = appUrl+'/'+appName+'img/poi/radarAktiv.png';		
			}
			else {
				img.src = appUrl+'/'+appName+'img/poi/radarInaktiv.png';		
			}
			
			iconDiv.appendChild(img); 
			
			if(firstContent== false || moreTargets == true){
				div.appendChild(createEmptyTextParagraph(6));
				iconDiv.style.top = '15px';
				iconDiv.style.paddingTop ='7 px';
			}
			if(firstContent == false &&  moreTargets==true){
				var divLine = getCutLine();
				div.appendChild(divLine);
				div.appendChild(createEmptyTextParagraph(10));
				iconDiv.style.top = '20px';
				iconDiv.style.paddingTop ='7 px';
			}
			div.appendChild(iconDiv); 			
			
	    	if(speed.length >0) {
	    		speed = "(max.: "+speed+")";
	    		
	    	}
			var boldName =createTextParagraph(typeDescr.replace(/\u0020/g, '&nbsp;')+" "+speed.replace(/\u0020/g, '&nbsp;'),'40px');
	    	boldName.style.fontWeight = 'bold';
		    boldName.style.color ='black';
		    boldName.style.whiteSpace='nowrap';
		    div.appendChild(boldName);
		    div.appendChild(createTextParagraph("Status: "+statusDescr.replace(/\u0020/g, '&nbsp;'),'40px'));
		    div.appendChild(createTextParagraph("Datum: "+aktual,'40px'));
		    div.appendChild(createEmptyTextParagraph(10));
		   
		    div.appendChild(createTextParagraph(strasse+" "+hnr+" "+beschr.replace(/\u0020/g, '&nbsp;')));
		    div.appendChild(createTextParagraph(directDescr.replace(/\u0020/g, '&nbsp;')));
		    if(ortsTeil.length >0) {
		    	ortsTeil ="("+ortsTeil+")";
		    }
		    div.appendChild(createTextParagraph(zip+" "+ort.replace(/\u0020/g, '&nbsp;')+" "+ortsTeil));
		    if(userId!=undefined && userId !=null){
				div.appendChild(createEmptyTextParagraph(10));
	            var ugc = createTextParagraph('<a href="#" onclick="return fillCreateForm(\''+typeDescr.replace(/\u0020/g, '&nbsp;')+" "+speed.replace(/\u0020/g, '&nbsp;')+'\',\''+zip+'\',\''+ort+'\',\''+strasse+'\',\''+hnr+'\','+coordinate.getX()+','+coordinate.getY()+');">POI \u00FCbernehmen</a>','7px');
	            ugc.style.fontWeight = 'bold';
	            div.appendChild(ugc);				
			}
		    return div;
	    }
	    function formatWetterContent(record,firstContent,moreTargets){

			var div = document.createElement('div');
			div.style.position = 'relative';
			if(firstContent== false || moreTargets == true){
				div.appendChild(createEmptyTextParagraph(6));
			}
			if(firstContent == false &&  moreTargets==true){
				var divLine = getCutLine();
				div.appendChild(divLine);
				div.appendChild(createEmptyTextParagraph(10));
			}
			var wetter = record.wetter;		
		    var id = wetter.id;	
		    var zip = wetter.zip;
		    var city = wetter.ort;
		    
		    var boldName = createTextParagraph(city.replace(/\u0020/g, '&nbsp;'));
		    boldName.style.fontWeight = 'bold';
		    boldName.style.color ='black';
		    div.appendChild(boldName);
		    
		    var boldPlz = createTextParagraph(zip );
		    boldPlz.style.fontWeight = 'bold';
		    boldPlz.style.color ='black';
		    div.appendChild(boldPlz);
		   
		   div.appendChild(createEmptyTextParagraph(6));
		   
		   var boldHeute = createTextParagraph('Heute');
		   boldHeute.style.fontWeight = 'bold';
		   boldHeute.style.color ='black';
		   div.appendChild(boldHeute);
		   
		   var minHeute = wetter.Heute.min;
		   var maxHeute = wetter.Heute.max;
		   var textHeute = wetter.Heute.text;
		   var regenHeute = wetter.Heute.rain;
		    
		   var iconDiv = document.createElement('div');
		   iconDiv.style.position = 'absolute';
		   iconDiv.style.width = '40px';		   
		   iconDiv.style.left = '0px';
		   var symbol = wetter.Heute.symbol;
		   var img = document.createElement('img');
		   img.src = getWetterImage(symbol) ;
		   img.style.width = '40px';
			iconDiv.appendChild(img);
			div.appendChild(iconDiv);
		   
		   div.appendChild(createTextParagraph('min.: '+minHeute+'°C - max.: '+maxHeute+'°C','45px'));
		   div.appendChild(createTextParagraph(regenHeute+'% Regenwahrscheinlichkeit','45px'));
		   div.appendChild(createTextParagraph(textHeute,'45px'));
		   
		   div.appendChild(createEmptyTextParagraph(6));
		   
		   var boldMorgen = createTextParagraph('Morgen');
		   boldMorgen.style.fontWeight = 'bold';
		   boldMorgen.style.color ='black';
		   var minMorgen = wetter.Morgen.min;
		   var maxMorgen = wetter.Morgen.max;
		   var textMorgen = wetter.Morgen.text;
		   var regenMorgen = wetter.Morgen.rain;
		    
		   div.appendChild(boldMorgen);
		   iconDiv = document.createElement('div');
		   iconDiv.style.position = 'absolute';
		   iconDiv.style.width = '40px';		   
		   iconDiv.style.left = '0px';
		   var symbol = wetter.Morgen.symbol;
		   var img = document.createElement('img');
		   img.src = getWetterImage(symbol) ;
		   img.style.width = '40px';
			iconDiv.appendChild(img);
			div.appendChild(iconDiv);
		   div.appendChild(createTextParagraph('min.: '+minMorgen+'°C - max.: '+maxMorgen+'°C','45px'));
		   div.appendChild(createTextParagraph(regenMorgen+'% Regenwahrscheinlichkeit','45px'));
		   div.appendChild(createTextParagraph(textMorgen,'45px'));
		   
		   div.appendChild(createEmptyTextParagraph(6));
		   
		   var boldUeberm = createTextParagraph('\u00DCbermorgen');
		   boldUeberm.style.fontWeight = 'bold';
		   boldUeberm.style.color ='black';
		   var minUeberm = wetter.Uebermorgen.min;
		   var maxUeberm = wetter.Uebermorgen.max;
		   var textUeberm = wetter.Uebermorgen.text;
		   var regenUeberm = wetter.Uebermorgen.rain;
		    
		   div.appendChild(boldUeberm);
		   iconDiv = document.createElement('div');
		   iconDiv.style.position = 'absolute';
		   iconDiv.style.width = '40px';		   
		   iconDiv.style.left = '0px';
		   var symbol = wetter.Uebermorgen.symbol;
		   var img = document.createElement('img');
		   img.src = getWetterImage(symbol) ;
		   img.style.width = '40px';
		   iconDiv.appendChild(img);
		   div.appendChild(iconDiv);
		   div.appendChild(createTextParagraph('min.: '+minUeberm+'°C - max.: '+maxUeberm+'°C','45px'));
		   var p = createTextParagraph(regenUeberm+'% Regenwahrscheinlichkeit','45px');
		   p.style.whiteSpace='nowrap';
		   div.appendChild(p);
		   div.appendChild(createTextParagraph(textUeberm,'45px'));
		 	
			return div;

		}	
	    function getWetterImage(symbol) {
	    	var image="";
	    	switch (symbol) {
			    case "1": {
			    	image = appUrl+'/'+appName+'img/poi/wetter/ico_wetter_01.png';
			        break;
			    }			 
			    case "2": {
			    	image = appUrl+'/'+appName+'img/poi/wetter/ico_wetter_02.png';
			        break;
			    }
			    case "3": {
			    	image = appUrl+'/'+appName+'img/poi/wetter/ico_wetter_03.png';
			        break;
			    }
			    case "4":{
			    	image = appUrl+'/'+appName+'img/poi/wetter/ico_wetter_04.png';
			        break;
			    }
			    case "5": {
			    	image = appUrl+'/'+appName+'img/poi/wetter/ico_wetter_05.png';
			        break;
			        }			
			    case "6": {
			    	image = appUrl+'/'+appName+'img/poi/wetter/ico_wetter_06.png';
			        break;
			    }
			    case "7": {
			    	image = appUrl+'/'+appName+'img/poi/wetter/ico_wetter_07.png';
			        break;
			    }	
			    case "8": {
			    	image = appUrl+'/'+appName+'img/poi/wetter/ico_wetter_08.png';
			        break;
			    }	
			    case "9": {
			    	image = appUrl+'/'+appName+'img/poi/wetter/ico_wetter_09.png';
			        break;
			    }	
			    case "10": {
			    	image = appUrl+'/'+appName+'img/poi/wetter/ico_wetter_10.png';
			        break;
			    }	
			    case "11": {
			    	image = appUrl+'/'+appName+'img/poi/wetter/ico_wetter_11.png';
			        break;
			    }	
			    case "12": {
			    	image = appUrl+'/'+appName+'img/poi/wetter/ico_wetter_12.png';
			        break;
			    }	
			    case "13": {
			    	image = appUrl+'/'+appName+'img/poi/wetter/ico_wetter_13.png';
			        break;
			    }	
			    case "14": {
			    	image = appUrl+'/'+appName+'img/poi/wetter/ico_wetter_14.png';
			        break;
			    }
			    default: {
			    	image = appUrl+'/'+appName+'img/poi/wetter/ico_wetter_01.png';
			        break;
			    }			
			  }		
	    	return image;
	    	
	    }
	function formatParkplatzContent(record,firstContent,moreTargets,coordinate){

		var div = document.createElement('div');
		div.style.position = 'relative';	    
		var iconDiv = document.createElement('div');
		iconDiv.style.position = 'absolute';
		iconDiv.style.width = '40px';
		iconDiv.style.top = '5px';
		iconDiv.style.left = '0px';
		var parkplatz = record.parkplatz;
		var typeKey = parkplatz.typeKey;
		var img = document.createElement('img');
		if(typeKey =="1"){
			img.src = appUrl+'/'+appName+'img/poi/PARK_RIDE.gif';
		}	
		else if(typeKey =="2"){
			img.src = appUrl+'/'+appName+'img/poi/parkhaus.gif';
		}
		else{
			img.src = appUrl+'/'+appName+'img/poi/parkplatz1.gif';
		}		
		
		iconDiv.appendChild(img); 
		
		if(firstContent== false || moreTargets == true){
			div.appendChild(createEmptyTextParagraph(6));
			iconDiv.style.top = '15px';
			iconDiv.style.paddingTop ='7 px';
		}
		if(firstContent == false &&  moreTargets==true){
	    	
			var divLine = getCutLine();
			div.appendChild(divLine);
			div.appendChild(createEmptyTextParagraph(10));
			iconDiv.style.top = '20px';
			iconDiv.style.paddingTop ='7 px';
		}
				
		div.appendChild(iconDiv);
		
		var name = parkplatz.name ;
	    var boldName = createTextParagraph(name.replace(/\u0020/g, '&nbsp;'),'40px');
	    boldName.style.fontWeight = 'bold';
	    boldName.style.color ='black';
	    div.appendChild(boldName);
	    	
	    var id = parkplatz.id;
	    var strasse = parkplatz.str;
	    var hnr = parkplatz.hnr;
	    var zip = parkplatz.zip;
	    var city = parkplatz.city;
	  
	   
	    var type = parkplatz.type;

	    var zahlung = parkplatz.zahlung;
	  
	    var isPlBehi = parkplatz.isPlBehi;
	    var isPlFrau = parkplatz.isPlFrau;
	    var isPlSocket = parkplatz.isPlSocket;
	    var isPlFamily = parkplatz.isPlFamily;
		var bw = parkplatz.bw;
		var h = parkplatz.h;
		var b = parkplatz.b;
		var url = parkplatz.url;		
		var off = parkplatz.offen;
		var waerung = parkplatz.waerung;
	    	
	   div.appendChild(createTextParagraph(strasse.replace(/\u0020/g, '&nbsp;') + '&nbsp;' + hnr,'40px'));
	   div.appendChild(createTextParagraph(zip + '&nbsp;' + city.replace(/\u0020/g, '&nbsp;'),'40px'));
	   div.appendChild(createEmptyTextParagraph(12));

	   if(type && bw){
		  
		   div.appendChild(createTextParagraph(type+ ' ('+bw+')'));
	   }
	   else if(bw){
		   
			   div.appendChild(createTextParagraph(bw));
		}
	   else if(type){
		   
		   div.appendChild(createTextParagraph(type));
	   }  
   //PKW<br>4: Bus<br>6: LKW<br>7: Motorrad
	   var pkw=parkplatz.PKW;
	   var pkwPreis = parkplatz.Preis_PKW;
	   var bus=parkplatz.Bus;
	   var busPreis = parkplatz.Preis_Bus;
	   var lkw=parkplatz.LKW;
	   var lkwPreis = parkplatz.Preis_LKW;
	   var motRad=parkplatz.Motorrad;
	   var motRadPreis = parkplatz.Preis_Motorrad;
	   
	   div.appendChild(createEmptyTextParagraph(12));
	   if(pkwPreis){
		   var f = createTextParagraph('PKW');
		   f.style.fontWeight = 'bold';	   
		   div.appendChild(f);
		   div.appendChild(createEmptyTextParagraph(7));
		   if(pkw){
			   div.appendChild(createTextParagraph('Freie Pl\u00E4tze '+pkw.plFrei+' von '+pkwPreis.plGesamt));
		   }
		   else{
			   div.appendChild(createTextParagraph('Parkpl\u00E4tze gesamt: '+pkwPreis.plGesamt));
		   }
		   div.appendChild(createEmptyTextParagraph(7));
		   div.appendChild(createTextParagraph('Parkgeb\u00FChr:'));
		    t = iw.create('table');
		    t.style.cellspacing = '0';
		    t.style.marginLeft = '5px';
		    t.style.position ='relative';
		    var r =0;
		    if(pkwPreis.commentWorkDay && pkwPreis.commentWorkDay.length >0){
			   getAddData('Werktage - ',pkwPreis.commentWorkDay.replace(/\?/g,'\u20AC'),r,t);
			   r++;
		   }
		   else{
			   getAddData('Werktage - ',pkwPreis.workDay+" "+waerung,r,t);
			   r++;
		   }
		    if(pkwPreis.commentSaturday && pkwPreis.commentSaturday.length >0){
			   getAddData('Samstags - ',pkwPreis.commentSaturday.replace(/\?/g,'\u20AC'),r,t);
			   r++;
		   }
		   else{
			   getAddData('Samstags - ',pkwPreis.saturday+" "+waerung,r,t);
			   r++;
		   }
		   if(pkwPreis.commentSunday && pkwPreis.commentSunday.length >0){
			   getAddData('Sontags - ',pkwPreis.commentSunday.replace(/\?/g,'\u20AC'),r,t);
			   r++;
		   }
		   else{
			   getAddData('Sontags - ',pkwPreis.sunday+" "+waerung,r,t);
			   r++;
		   }
		   div.appendChild(t);
	   }
	   if(busPreis){
		   var f = createTextParagraph('Bus');
		   f.style.fontWeight = 'bold';	
		   div.appendChild(createEmptyTextParagraph(7));
		   div.appendChild(f);
		   div.appendChild(createEmptyTextParagraph(7));
		   if(bus){
			   div.appendChild(createTextParagraph('Freie Pl\u00E4tze '+bus.plFrei+' von '+busPreis.plGesamt));
		   }
		   else{
			   div.appendChild(createTextParagraph('Parkpl\u00E4tze gesamt: '+busPreis.plGesamt));
		   }
		   div.appendChild(createEmptyTextParagraph(7));
		   div.appendChild(createTextParagraph('Parkgeb\u00FChr:'));
		    t = iw.create('table');
		    t.style.cellspacing = '0';
		    t.style.marginLeft = '5px';
		    t.style.position ='relative';
		    var r =0;
		    if(busPreis.commentWorkDay && busPreis.commentWorkDay.length >0){
			   getAddData('Werktage - ',busPreis.commentWorkDay.replace(/\?/g,'\u20AC'),r,t);
			   r++;
		   }
		   else{
			   getAddData('Werktage - ',busPreis.workDay+" "+waerung,r,t);
			   r++;
		   }
		    if(busPreis.commentSaturday && busPreis.commentSaturday.length >0){
			   getAddData('Samstags - ',busPreis.commentSaturday.replace(/\?/g,'\u20AC'),r,t);
			   r++;
		   }
		   else{
			   getAddData('Samstags - ',busPreis.saturday+" "+waerung,r,t);
			   r++;
		   }
		   if(busPreis.commentSunday && busPreis.commentSunday.length >0){
			   getAddData('Sontags - ',busPreis.commentSunday.replace(/\?/g,'\u20AC'),r,t);
			   r++;
		   }
		   else{
			   getAddData('Sontags - ',busPreis.sunday+" "+waerung,r,t);
			   r++;
		   }
		   div.appendChild(t);
		   
	   }
	   if(lkwPreis){
		   var f = createTextParagraph('LKW');
		   f.style.fontWeight = 'bold';	 
		   div.appendChild(createEmptyTextParagraph(7));
		   div.appendChild(f);
		   div.appendChild(createEmptyTextParagraph(7));
		   if(lkw){
			   div.appendChild(createTextParagraph('Freie Pl\u00E4tze '+lkw.plFrei+' von '+lkwPreis.plGesamt));
		   }
		   else{
			   div.appendChild(createTextParagraph('Parkpl\u00E4tze gesamt: '+lkwPreis.plGesamt));
		   }
		   div.appendChild(createEmptyTextParagraph(7));
		   div.appendChild(createTextParagraph('Parkgeb\u00FChr:'));
		    t = iw.create('table');
		    t.style.cellspacing = '0';
		    t.style.marginLeft = '5px';
		    t.style.position ='relative';
		    var r =0;
		    if(lkwPreis.commentWorkDay && lkwPreis.commentWorkDay.length >0){
			   getAddData('Werktage - ',lkwPreis.commentWorkDay.replace(/\?/g,'\u20AC'),r,t);
			   r++;
		   }
		   else{
			   getAddData('Werktage - ',lkwPreis.workDay+" "+waerung,r,t);
			   r++;
		   }
		    if(lkwPreis.commentSaturday && lkwPreis.commentSaturday.length >0){
			   getAddData('Samstags - ',lkwPreis.commentSaturday.replace(/\?/g,'\u20AC'),r,t);
			   r++;
		   }
		   else{
			   getAddData('Samstags - ',lkwPreis.saturday+" "+waerung,r,t);
			   r++;
		   }
		   if(lkwPreis.commentSunday && lkwPreis.commentSunday.length >0){
			   getAddData('Sontags - ',lkwPreis.commentSunday.replace(/\?/g,'\u20AC'),r,t);
			   r++;
		   }
		   else{
			   getAddData('Sontags - ',lkwPreis.sunday+" "+waerung,r,t);
			   r++;
		   }
		   div.appendChild(t);
		   
	   }
	   if(motRadPreis){
		   var f = createTextParagraph('Motorrad');
		   f.style.fontWeight = 'bold';	   
		   div.appendChild(createEmptyTextParagraph(7));
		   div.appendChild(f);
		   div.appendChild(createEmptyTextParagraph(7));
		   if(motRad){
			   div.appendChild(createTextParagraph('Freie Pl\u00E4tze '+motRad.plFrei+' von '+motRadPreis.plGesamt));
		   }
		   else{
			   div.appendChild(createTextParagraph('Parkpl\u00E4tze gesamt: '+motRadPreis.plGesamt));
		   }
		   div.appendChild(createEmptyTextParagraph(7));
		   div.appendChild(createTextParagraph('Parkgeb\u00FChr:'));
		    t = iw.create('table');
		    t.style.cellspacing = '0';
		    t.style.marginLeft = '5px';
		    t.style.position ='relative';
		    var r =0;
		    if(motRadPreis.commentWorkDay && motRadPreis.commentWorkDay.length >0){
			   getAddData('Werktage - ',motRadPreis.commentWorkDay.replace(/\?/g,'\u20AC'),r,t);
			   r++;
		   }
		   else{
			   getAddData('Werktage - ',motRadPreis.workDay+" "+waerung,r,t);
			   r++;
		   }
		    if(motRadPreis.commentSaturday && motRadPreis.commentSaturday.length >0){
			   getAddData('Samstags - ',motRadPreis.commentSaturday.replace(/\?/g,'\u20AC'),r,t);
			   r++;
		   }
		   else{
			   getAddData('Samstags - ',motRadPreis.saturday+" "+waerung,r,t);
			   r++;
		   }
		   if(motRadPreis.commentSunday && motRadPreis.commentSunday.length >0){
			   getAddData('Sontags - ',motRadPreis.commentSunday.replace(/\?/g,'\u20AC'),r,t);
			   r++;
		   }
		   else{
			   getAddData('Sontags - ',motRadPreis.sunday+" "+waerung,r,t);
			   r++;
		   }
		   div.appendChild(t);
	   }
	   div.appendChild(createEmptyTextParagraph(12));
	   var table = iw.create('table');
	   table.style.cellspacing = '0';
	   table.style.position ='relative';
	   
	   var r =0;	  
	   if(off){
			var tr = table.insertRow(r);
			tr.style.height='1px';
			var td = tr.insertCell(0);	
			td.style.verticalAlign='top';		
			tdText = createTextParagraph('Ge\u00F6ffnet: ');
			td.appendChild(tdText);		
			td = tr.insertCell(1);	
				
			tdText = createTextParagraph(off);		
			if(off.length < 50){
				tdText.style.whiteSpace='nowrap';	
			}
			td.appendChild(tdText);	
			r++;
	   }
	   div.appendChild(table);
	   var table = iw.create('table');
	   table.style.cellspacing = '0';
	   table.style.position ='relative';
	   var r =0;
	  var additionData = false;
	  if(zahlung != undefined && zahlung.length >0){	
			
			additionData=true;	
		
			var tr = table.insertRow(r);
			tr.style.height='1px';
			var td = tr.insertCell(0);	
			td.style.verticalAlign='top';		
			tdText = createTextParagraph('Zahlungsarten: ');
			td.appendChild(tdText);		
			td = tr.insertCell(1);	
				
			tdText = createTextParagraph(zahlung);		
			if(zahlung.length < 50){
				tdText.style.whiteSpace='nowrap';	
			}
				
			td.appendChild(tdText);	
			
			r++;
			
		}
		var h = parkplatz.h;
		var b = parkplatz.b;
		

		if(h != undefined && h.length >0 || b != undefined && b.length >0){
			if(h != undefined && h.length >0 && h!='0'){
				additionData=true;	
				getAddData('Beschr\u00E4nkung: ','max. H\u00F6he '+h+' cm.',r,table);	
				r++;
				if(b!='0'){
					getAddData('','max. Breite '+b+' cm.',r,table);	
					r++;
				}
			}
			else if(b != undefined && b.length >0 && b!='0'){
				additionData=true;	
				getAddData('Beschr\u00E4nkung: ','max. Breite '+b+' cm.',r,table);	
				r++;
				if(h!='0'){
					getAddData('','max. H\u00F6he '+h+' cm.',r,table);	
					r++;
				}
			}
		}
		
		if(url != undefined && url.length >0){
			additionData=true;	
			getAddData('Internet: ','<a href="' + url + '" target="_blank">' + url + '</a>',r,table);
			r++;				
		}
		if(additionData == true){			
			div.appendChild(table);
		}
		var tableImages = iw.create('table');
	    tableImages.style.cellspacing = '0';
	    tableImages.style.position ='relative';
	   
	    var trImages = tableImages.insertRow(0);
	    tableImages.style.height='1px';
		var besond = false;

	    if(isPlFrau != undefined && isPlFrau.length >0){		
			if(	isPlFrau !='0'){		
				besond = true;
				var td = trImages.insertCell(0);
							
				var bgImage ="img/poiContent/Parkplatz_Frauen2.png";
				var text ="Frauenparkpl\u00E4tze vorhanden. ";				
				td.innerHTML ='<div style="width:25px;height:25px;background-image:url('+bgImage+');background-repeat:no-repeat;cursor:default;" onmouseover ="Tip(\''+text+'\')" onmouseout="UnTip()">'
				+'</div>';
			}
			UnTip();						
		}
	    if(isPlBehi != undefined && isPlBehi.length >0){
			if(	isPlBehi !='0'){
				besond = true;
				var td = trImages.insertCell(0);
				var bgImage ="img/poiContent/Behindertenparkplatz_25.png";
				var text ="Behindertenparkpl\u00E4tze vorhanden. ";				
				td.innerHTML ='<div style="width:25px;height:25px;background-image:url('+bgImage+');background-repeat:no-repeat;cursor:default;" onmouseover ="Tip(\''+text+'\')" onmouseout="UnTip()">'
				+'</div>';
			}
			UnTip();						
		}
	    if(isPlSocket != undefined && isPlSocket.length >0){
			if(	isPlSocket !='0'){
				besond = true;
				var td = trImages.insertCell(0);
				var bgImage ="img/poiContent/Behindertenparkplatz_25.png";
				var text ="Steckdosen vorhanden. ";				
				td.innerHTML ='<div style="width:25px;height:25px;background-image:url('+bgImage+');background-repeat:no-repeat;cursor:default;" onmouseover ="Tip(\''+text+'\')" onmouseout="UnTip()">'
				+'</div>';
			}
			UnTip();						
		}
	    if(isPlFamily != undefined && isPlFamily.length >0){
			if(	isPlFamily !='0'){
				besond = true;
				var td = trImages.insertCell(0);
				var bgImage ="img/poiContent/Behindertenparkplatz_25.png";
				var text ="Familienfreundliche Parkpl\u00E4tze vorhanden. ";				
				td.innerHTML ='<div style="width:25px;height:25px;background-image:url('+bgImage+');background-repeat:no-repeat;cursor:default;" onmouseover ="Tip(\''+text+'\')" onmouseout="UnTip()">'
				+'</div>';
			}
			UnTip();						
		}	   
		if(besond == true){
			
			var tr = table.insertRow(r);
			tr.style.height='1px';
			var td = tr.insertCell(0);	
			td.style.whiteSpace='nowrap';	
			td.style.lineHeight= '10px';		
			tdText = createTextParagraph('Besonderheiten: ');
			td.appendChild(tdText);		
			td = tr.insertCell(1);	
			td.style.whiteSpace='nowrap';	
			td.style.lineHeight= '10px';		
			td.appendChild(tableImages);	
			r++;
		}
		if(userId!=undefined && userId !=null){
			div.appendChild(createEmptyTextParagraph(10));
            var ugc = createTextParagraph('<a href="#" onclick="return fillCreateForm(\''+name+'\',\''+zip+'\',\''+city+'\',\''+strasse+'\',\''+hnr+'\','+coordinate.getX()+','+coordinate.getY()+');">POI \u00FCbernehmen</a>','7px');
            ugc.style.fontWeight = 'bold';
            div.appendChild(ugc);				
		}
		return div;
	}
	function formatEventContent(record,firstContent,moreTargets,coordinate){
			
		var div = document.createElement('div');
		div.style.margin='0px';
		div.style.padding='0px';
		div.style.position = 'relative';
				
			    
		var iconDiv = document.createElement('div');
		div.appendChild(iconDiv);
		iconDiv.style.position = 'absolute';
		iconDiv.style.width = '40px';
		iconDiv.style.height = '32px';
		iconDiv.style.top = '0px';
		iconDiv.style.left = '0px';		
		
		var img = document.createElement('img');			
		img.src = appUrl+'/'+appName+'img/poi/event_luftballon.gif';
		iconDiv.appendChild(img); 
			
		if(firstContent== false || moreTargets == true){
			div.appendChild(createEmptyTextParagraph(6));
			iconDiv.style.top = '15px';
			iconDiv.style.paddingTop ='7 px';
		}
		if(firstContent == false &&  moreTargets==true){
	    	
			var divLine = getCutLine();
			div.appendChild(divLine);
			div.appendChild(createEmptyTextParagraph(8));
			iconDiv.style.top = '20px';
			iconDiv.style.paddingTop ='7 px';
		}
		var location = record.location;
		var name = location.name ;
        var boldName = createTextParagraph(name.replace(/\u0020/g, '&nbsp;'),'40px');      
        boldName.style.fontWeight = 'bold';
        boldName.style.color ='black';
        div.appendChild(boldName);
        	
        var id = location.id;
        var strasse = location.str;
        var hnr = location.hnr;
        var zip = location.zip;
        var city = location.city;
       
        var infofax = location.infofax;
        var infofax2 = location.infofax2;
        var infourl = location.infourl;
        if(infourl.length >0 && infourl.substring(0, 4)!='http'){
        	infourl = 'http://'+infourl;
        }
        var infourl2 = location.infour2;
        if(infourl2.length >0 && infourl2.substring(0, 4)!='http'){
        	infourl2 = 'http://'+infourl2;
        }
        var infomail = location.infomail;
        var infomail2 = location.infomail2;
        var infophone = location.infophone;
        var infophone2 = location.infophone2;

		var str =  createTextParagraph(strasse.replace(/\u0020/g, '&nbsp;') + '&nbsp;' + hnr,'40px');
		div.appendChild(str);
		var z= createTextParagraph(zip + '&nbsp;' + city.replace(/\u0020/g, '&nbsp;'),'40px');
		div.appendChild(z);
		div.appendChild(createEmptyTextParagraph(10));
		var table = iw.create('table');
		table.style.cellspacing = '0';
		table.style.position ='relative';
		div.appendChild(table);
       	var r =0;
		var additionData = false;
		if(infophone != undefined && infophone.length >0){
			additionData=true;	
			getAddData('Telefon: ',infophone,r,table);
			r++;
		}
		if(infophone2 != undefined && infophone2.length >0){
			additionData=true;	
			getAddData('Telefon: ',infophone2,r,table);
			r++;
		}
		if(infofax != undefined && infofax.length >0){	
			additionData=true;	
			getAddData('Fax: ',infofax,r,table);	
			r++;
		}
		if(infofax2 != undefined && infofax2.length >0){	
			additionData=true;	
			getAddData('Fax: ',infofax2,r,table);	
			r++;
		}
		if(infourl != undefined && infourl.length >0){
			additionData=true;								
			getAddData('Internet: ','<a href="' + infourl + '" target="_blank">' + infourl + '</a>',r,table);
			r++;
		}
		if(infourl2 != undefined && infourl2.length >0){
			additionData=true;				
			getAddData('Internet: ', '<a href="' + infourl2 + '" target="_blank">' + infourl2 + '</a>',r,table);
			r++;
		}
		if(infomail != undefined && infomail.length >0){	
			additionData=true;	
			getAddData('E-Mail: ',infomail,r,table);	
			r++;
		}
	  	if(infomail2 != undefined && infomail2.length >0){	
			additionData=true;	
			getAddData('E-Mail: ',infomail2,r,table);	
			r++;
		}
	  	div.appendChild(createEmptyTextParagraph(10));
	  	var url = appUrl+'/'+appName+'location.html?ID='+id+'&name='+name;	
	  	//var url = 'http://mapandroute.de/location.html?ID='+id+'&name='+name;	
	  	var a = '<a href="#" style="text-decoration:underline;" onclick="return showMoreInfo(\''+url+'\');">Mehr Information</a>'	;
		var info = createTextParagraph(a,'5px');	
		info.style.textDecoration='underline';
		div.appendChild(info);		
		div.appendChild(createEmptyTextParagraph(3));
		if(userId!=undefined && userId !=null){
			div.appendChild(createEmptyTextParagraph(10));
            var ugc = createTextParagraph('<a href="#" onclick="return fillCreateForm(\''+name+'\',\''+zip+'\',\''+city+'\',\''+strasse+'\',\''+hnr+'\','+coordinate.getX()+','+coordinate.getY()+');">POI \u00FCbernehmen</a>','7px');
            ugc.style.fontWeight = 'bold';
            div.appendChild(ugc);				
		}
		return div;
	}
	
	function formatKinoContent(record,firstContent,moreTargets,coordinate){
			var div = document.createElement('div');
			div.style.margin='0px';
			div.style.padding='0px';
			div.style.position = 'relative';	
			    
			var iconDiv = document.createElement('div');
			iconDiv.style.position = 'absolute';
			iconDiv.style.width = '40px';
			iconDiv.style.top = '5px';
			iconDiv.style.left = '0px';
			
			var img = document.createElement('img');			
			img.src = appUrl+'/'+appName+'img/poi/KINO.gif';
			iconDiv.appendChild(img); 
			
			if(firstContent== false || moreTargets == true){
				div.appendChild(createEmptyTextParagraph(6));
				iconDiv.style.top = '15px';
				iconDiv.style.paddingTop ='7 px';
			}
			if(firstContent == false &&  moreTargets==true){
				var divLine = getCutLine();
				div.appendChild(divLine);
				div.appendChild(createEmptyTextParagraph(10));
				iconDiv.style.top = '20px';
				iconDiv.style.paddingTop ='7 px';
			}
					
			div.appendChild(iconDiv);
			var kino = record.kino;		
			var name = kino.name ;
	        var boldName = createTextParagraph(name.replace(/\u0020/g, '&nbsp;'),'40px');
	        boldName.style.fontWeight = 'bold';
	        boldName.style.color ='black';
	        div.appendChild(boldName);
	        
			var strasse = kino.str;
			var hnr = kino.hnr;
			var zip = kino.zip;
			var city = kino.city;
			
			var telefon = kino.telefon;
			var fax = kino.fax;
			var internet = kino.internet;
			var preis = kino.preis;
			var cineday = kino.cineday;
			var note = kino.note;
			var byPublic = kino.byPublic;
			var byCar = kino.byCar;
			var id = kino.id;
	        	
	       div.appendChild(createTextParagraph(strasse.replace(/\u0020/g, '&nbsp;') + '&nbsp;' + hnr,'40px'));
	       div.appendChild(createTextParagraph(zip + '&nbsp;' + city.replace(/\u0020/g, '&nbsp;'),'40px'));
	       div.appendChild(createEmptyTextParagraph(10));
	       var url = appUrl+'/'+appName+'/kinoProxy.html?cmd=getFilmProgramm&ID='+id+'&key=programm&name='+name;	
			
	       var a = '<a href="#" style="text-decoration:underline;" onclick="return showMoreInfo(\''+url+'\');">(Kinoprogramm)</a>';		
	       var programm = createTextParagraph(a,'10px');	
	       programm.style.textDecoration='underline';
	       div.appendChild(programm);	
	       div.appendChild(createEmptyTextParagraph(10));	
	       var table = iw.create('table');
	       table.style.cellspacing = '0';
	       div.appendChild(table);
	       var r =0;
			
	      	var additionData = false;
			
			if(telefon != undefined && telefon.length >0){
				additionData=true;	
				getAddData('Telefon: ',telefon,r,table);
				r++;
			}
			if(fax != undefined && fax.length >0){	
				additionData=true;	
				getAddData('Fax: ',fax,r,table);	
				r++;
			}
			
			  	if(internet != undefined && internet.length >0){
				additionData=true;			
				getAddData('Internet: ','<a href="' + internet + '" target="_blank">' + internet + '</a>',r,table);
				r++;
			}

			  	if(preis != undefined && preis.length >0){	
					additionData=true;	
					getAddData('Preis: ',preis,r,table);	
					r++;
				}
			  	if(cineday != undefined && cineday.length >0){	
					additionData=true;	
					getAddData('Kinotag: ',cineday,r,table);	
					r++;
				}
			  	
			  if(byPublic != undefined && byPublic.length >0){	
				  div.appendChild(createEmptyTextParagraph(10));
				  var verkm = createTextParagraph('Anreise mit \u00F6ffentlichen Verkehrsmitteln: ','5px');
				  verkm.style.whiteSpace='nowrap';	
			  	  div.appendChild(verkm);
			  	  div.appendChild(createTextParagraph(byPublic,'20px'));
			  		
				}
			  	if(byCar != undefined && byCar.length >0){	
			  		div.appendChild(createEmptyTextParagraph(10));
			  		div.appendChild(createTextParagraph('Anreise mit Auto: ','5px'));
			  		div.appendChild(createTextParagraph(byCar.replace(/\u0020/g, '&nbsp;'),'20px'));
				}
			  	if(note != undefined && note.length >0){	
			  		div.appendChild(createEmptyTextParagraph(10));
			  		div.appendChild(createTextParagraph('Zus\u00E4tzliche Information: ','5px'));
			  		div.appendChild(createTextParagraph(note.replace(/\u0020/g, '&nbsp;'),'20px'));
				}
			  	if(userId!=undefined && userId !=null){
					div.appendChild(createEmptyTextParagraph(10));
		            var ugc = createTextParagraph('<a href="#" onclick="return fillCreateForm(\''+name+'\',\''+zip+'\',\''+city+'\',\''+strasse+'\',\''+hnr+'\','+coordinate.getX()+','+coordinate.getY()+');">POI \u00FCbernehmen</a>','7px');
		            ugc.style.fontWeight = 'bold';
		            div.appendChild(ugc);				
				}
			return div;
		}
	
		function showMoreInfo(url){
			var contentString = "<iframe id='popupIframe' src='"+url+"' width='100%' marginwidth='0' height='100%' marginheight='0' scrolling='auto' allowtransparency='true' frameborder='0' style='position:absolute; left:0px; top:0px'></iframe>";
			showPopup(new IWSize(520, 360), null, contentString, true);
		
		}
		
		function showPopup(size, coordinate, contentString, centered){
			
			if (popupWindow != null)
			{
				iw.remove(popupWindow.getContainer());
				popupWindow = null;
			}
			if (coordinate == null)
				coordinate = map.getCenter();
			
			popupWindow = new IWWindowOverlayGS(map, coordinate, contentString);
	        popupWindow.setVisible(false);
			popupWindow.setSize(size);
			
			if (centered == true)
				popupWindow.setCentered(true);

			iw.append(map.getWindowOverlayContainer(),popupWindow.getContainer());
			popupWindow.redraw();
			popupWindow.setVisible(true);
			
		};
		function  removePopups (){
			
			if (popupWindow && popupWindow.getContainer().parentNode)
			{
				iw.remove(popupWindow.getContainer());
				popupWindow = null;
			}
		}
		function formatGeldautomatenContent(record,firstContent,moreTargets,coordinate){
			
			var div = document.createElement('div');
			div.style.margin='0px';
			div.style.padding='0px';
			div.style.position = 'relative';
			  
			var iconDiv = document.createElement('div');
			iconDiv.style.position = 'absolute';
			iconDiv.style.width = '40px';
			iconDiv.style.height = '32px';
			iconDiv.style.top = '0px';
			iconDiv.style.left = '0px';
			iconDiv.style.bottom = '0px';
			
			var img = document.createElement('img');			
			img.src = appUrl+'/'+appName+'img/poi/Geldautomat.gif';
			
			iconDiv.appendChild(img); 
					
			if(firstContent== false || moreTargets == true){
				var p = createEmptyTextParagraph(6);
				div.appendChild(p);
				iconDiv.style.top = '10px';
				iconDiv.style.paddingTop ='7 px';
			}
			if(firstContent == false &&  moreTargets==true){
		    	
				var divLine = getCutLine();
				div.appendChild(divLine);
				div.appendChild(createEmptyTextParagraph(10));
				iconDiv.style.top = '20px';
				iconDiv.style.paddingTop ='7 px';
			}
			
			 div.appendChild(iconDiv);
				
			var geldAutomat = record.geldautomat;
			var name = geldAutomat.name ;
	        var boldName = createTextParagraph(name.replace(/\u0020/g, '&nbsp;'),'40px');
	        
	        boldName.style.fontWeight = 'bold';
	        boldName.style.color ='black';

	        div.appendChild(boldName);
	        
	        var strasse = geldAutomat.str;
	        var hnr = geldAutomat.hnr;
	        var zip = geldAutomat.zip;
	        var city = geldAutomat.city;
	        var oeffZeiten = geldAutomat.oeffnungszeiten;
	        var blz = geldAutomat.bankcode;
	        var anzGeldAutomaten = geldAutomat.anzahlAutomaten ;
	        var bankGruppe = geldAutomat.description;
	        var overnight = geldAutomat.z24H;
	    
	        var str = createTextParagraph(strasse.replace(/\u0020/g, '&nbsp;') + '&nbsp;' + hnr,'40px');
	        div.appendChild(str);

	       var z = createTextParagraph(zip + '&nbsp;' + city.replace(/\u0020/g, '&nbsp;'),'40px');
	       div.appendChild(z);
	       div.appendChild(createEmptyTextParagraph(10));

	       var table = iw.create('table');     
	      
	       table.style.top = '0px';
	       table.style.left = '0px';
	       table.style.whiteSpace='nowrap';
	       div.appendChild(table);
			
			var tr = table.insertRow(0);
			tr.cellSpacing = '0px';
			tr.cellPadding='0px';	
			var td = tr.insertCell(0);					
			td.style.lineHeight= '10px';
			var tdText = createTextParagraph('\u00D6ffnungszeiten: ');
			
			td.appendChild(tdText);	
				
			td = tr.insertCell(1);		
			td.style.lineHeight= '10px';
			td.style.whiteSpace='nowrap';
			tdText = createTextParagraph(oeffZeiten.replace(/\u0020/g, '&nbsp;'));			
			td.appendChild(tdText);
					
			tr = table.insertRow(1);		
			tr.style.lineHeight= '10px';
			td = tr.insertCell(0);		
				
			tdText = createTextParagraph('Bankleitzahl: ');
			td.appendChild(tdText);		
			td = tr.insertCell(1);
			td.style.whiteSpace='nowrap';		
			td.style.lineHeight= '10px';
			tdText = createTextParagraph(blz);
			td.appendChild(tdText);
			
			tr = table.insertRow(2);		
			td = tr.insertCell(0);		
			td.style.lineHeight= '10px';	
			tdText = createTextParagraph('Bankengruppe: ');
			td.appendChild(tdText);		
			td = tr.insertCell(1);
			td.style.whiteSpace='nowrap';		
			td.style.lineHeight= '10px';
			tdText = createTextParagraph(bankGruppe.replace(/\u0020/g, '&nbsp;'));
			td.appendChild(tdText);	
			
			if(userId!=undefined && userId !=null){
				div.appendChild(createEmptyTextParagraph(10));
	            var ugc = createTextParagraph('<a href="#" onclick="return fillCreateForm(\''+name+'\',\''+zip+'\',\''+city+'\',\''+strasse+'\',\''+hnr+'\','+coordinate.getX()+','+coordinate.getY()+');">POI \u00FCbernehmen</a>','7px');
	            ugc.style.fontWeight = 'bold';
	            div.appendChild(ugc);				
			}			
			return div;
		}
		function formatApothekenContent(record,firstContent,moreTargets,coordinate){

			var div = document.createElement('div');
			div.style.margin='0px';
			div.style.padding='0px';
			div.style.position = 'relative';
				    
			var iconDiv = document.createElement('div');
			iconDiv.style.position = 'absolute';
			iconDiv.style.width = '40px';
			iconDiv.style.height = '32px';
			iconDiv.style.top = '0px';
			iconDiv.style.left = '0px';
			iconDiv.style.bottom = '0px';
			iconDiv.style.lineHeight= '10px'; 
			var img = document.createElement('img');			
			img.src = appUrl+'/'+appName+'img/poi/Apotheke_0.gif';
			iconDiv.appendChild(img); 
			
			if(firstContent== false || moreTargets == true){
				var p = createEmptyTextParagraph(6);			
				div.appendChild(p);
				iconDiv.style.top = '10px';
				iconDiv.style.paddingTop ='7 px';
			}
			if(firstContent == false &&  moreTargets==true){
		    	
				var divLine = getCutLine();
				div.appendChild(divLine);
				div.appendChild(createEmptyTextParagraph(10));
				iconDiv.style.top = '20px';
				iconDiv.style.paddingTop ='7 px';
			}
					
			div.appendChild(iconDiv);
				
			var apotheke = record.apotheke;			
			var name = apotheke.name ;
	        var boldName = createTextParagraph(name.replace(/\u0020/g, '&nbsp;'),'40px');
	        boldName.style.fontWeight = 'bold';
	        boldName.style.color ='black';
	        div.appendChild(boldName);
	        var strasse = apotheke.str;
	        var hnr = apotheke.hnr;
	        var zip = apotheke.zip;
	        var city = apotheke.city;
	        
	        var telefon = apotheke.telefon;
	        var mobil = apotheke.mobil;
	        var internet = apotheke.internet;
	        var mail = apotheke.mail;
	        var oeffnungszeiten = apotheke.oeffnungszeiten;
	        var fax = apotheke.fax;

	        var str = createTextParagraph(strasse.replace(/\u0020/g, '&nbsp;') + '&nbsp;' + hnr,'40px');
	         div.appendChild(str);
	        	
	       var z = createTextParagraph(zip + '&nbsp;' + city.replace(/\u0020/g, '&nbsp;'),'40px');
	       div.appendChild(z);
	       div.appendChild(createEmptyTextParagraph(10));      
	       var table = iw.create('table');      
	       table.style.top = '0px';
	       table.style.left = '0px';
	       div.appendChild(table);
	       var r =0;
			var additionData = false;
			if(oeffnungszeiten != undefined && oeffnungszeiten.length >0){
				additionData=true;
				var tr = table.insertRow(r);
				tr.style.height='1px';
				var td = tr.insertCell(0);	
				td.style.verticalAlign='top';		
				tdText = createTextParagraph('\u00D6ffnungszeiten: ');
				td.appendChild(tdText);		
				td = tr.insertCell(1);	
						
				tdText = createTextParagraph(oeffnungszeiten);		
				if(oeffnungszeiten.length < 50){
					tdText.style.whiteSpace='nowrap';	
				}
				td.appendChild(tdText);	
				r++;
			}
			if(telefon != undefined && telefon.length >0){
				additionData=true;	
				getAddData('Telefon: ',telefon,r,table);
				r++;
			}
			if(fax != undefined && fax.length >0){	
				additionData=true;	
				getAddData('Fax: ',fax,r,table);	
				r++;
			}
			if(mobil != undefined && mobil.length >0){
				additionData=true;	
				getAddData('Mobil: ',mobil,r,table);
				r++;
			}
			if(internet != undefined && internet.length >0){
				additionData=true;			
				getAddData('Internet: ','<a href="' + internet + '" target="_blank">' + internet + '</a>',r,table);
				r++;
			}
			if(mail != undefined && mail.length >0){
				additionData=true;	
				getAddData('Email: ',mail,r,table);				
				r++;
			}
	       
	       var emerArr = apotheke.emersArray;
	      if(emerArr.length > 0){
	    	 if(additionData==true){
	    		 div.appendChild(createEmptyTextParagraph(10));			
	   		}
	       
	       var notfall = createTextParagraph('Notdienst','5px');
	       notfall.style.fontWeight = 'bold';
	       div.appendChild(notfall);
	       table = iw.create('table');
	       table.style.cellspacing = '0';
	       div.appendChild(table);
	       var row = 0;
			for(var i=0;i<emerArr.length;i++){
						
				var emer = emerArr[i].emer;		
					
				var monat =emer.month;			
				if(trim(monat).length ==1){				
					monat="0".concat(monat);				
				} 
				
				var begin = emer.begin;				
				if(trim(begin).length ==8){
					begin = begin.substring(0,5);
					
				}
				var end = emer.end;
				
				if(trim(end).length ==8){
					end = end.substring(0,5);
					
				}
				
				// begin:'09:00:00',end:'09:00:00',month:'4',year:'2009',overnight:'true',day:'18'
				tr = table.insertRow(row);
					
				tr.style.height='1px';
				td = tr.insertCell(0);	
				td.style.cellpadding='0px';
				td.style.cellspacing='0px';			
				td.style.lineHeight= '10px';
				var datum = createTextParagraph(emer.day+'.'+monat+'.'+emer.year);
				
				datum.style.fontWeight = 'bold';				
				td.appendChild(datum);		
				td = tr.insertCell(1);		
				td.style.lineHeight= '10px';
				tdText = createTextParagraph(begin+" - "+end);
				td.appendChild(tdText);
						

				if(emer.overnight == 'true'){					
						
					td = tr.insertCell(2);		
					td.style.lineHeight= '10px';		
					tdText = createTextParagraph('(\u00FCbernacht ge\u00F6ffnet.)');
					td.appendChild(tdText);	
				}
				row++;	
			}
	       }
	      	if(userId!=undefined && userId !=null){
				div.appendChild(createEmptyTextParagraph(10));
	            var ugc = createTextParagraph('<a href="#" onclick="return fillCreateForm(\''+name+'\',\''+zip+'\',\''+city+'\',\''+strasse+'\',\''+hnr+'\','+coordinate.getX()+','+coordinate.getY()+');">POI \u00FCbernehmen</a>','7px');
	            ugc.style.fontWeight = 'bold';
	            div.appendChild(ugc);				
			}	
			return div;
		}
		function trim(string){
			if(typeof string!='undefined'&& string !=null){
				
				return string.replace (/^\s+/, '').replace (/\s+$/, '');
			}
			return "";
		}
		
		function getAddData(title,value,r,table){
			var tr = table.insertRow(r);
			tr.style.height='1px';
			var td = tr.insertCell(0);	
			td.style.whiteSpace='nowrap';	
			td.style.lineHeight= '10px';		
			tdText = createTextParagraph(title);
			td.appendChild(tdText);		
			td = tr.insertCell(1);	
			td.style.whiteSpace='nowrap';	
			td.style.lineHeight= '10px';		
			tdText = createTextParagraph(value);
			td.appendChild(tdText);	
			return tr;
		}
		
		
		function formatBVGContent (record,firstContent,moreTargets){
			var nachUrl ="http://www.fahrinfo-berlin.de/Fahrinfo/bin/query.bin/dn?L=vs_gs&to=##&getstop=true&timesel=arrive&time=%2B01:00";
			var vonUrl = "http://www.fahrinfo-berlin.de/Fahrinfo/bin/query.bin/dn?L=vs_gs&from=##&getstop=true&timesel=arrive&time=%2B01:00";
			var div = document.createElement('div');
			div.style.position = 'relative';		
			
			if(firstContent== false || moreTargets== true){
				div.appendChild(createEmptyParagraph('7px'));
			}
			if(firstContent == false &&  moreTargets==true){
				var divLine = getCutLine();
				div.appendChild(divLine);
				div.appendChild(createEmptyParagraph('10px'));
			}
			var name = record.NAME;
	        var boldName = createTextParagraph(name.replace(/\u0020/g, '&nbsp;'));
	        boldName.style.fontWeight = 'bold';
	        boldName.style.color ='black';
	        div.appendChild(boldName);
	        div.appendChild(createEmptyTextParagraph(7));	
	        
	        
	        var im = record.OnMouseover;
	        var images = im.split('|');
	        for(var i=0;i<images.length;i++){
	        	var divImage = document.createElement('div');
	        	divImage.style.width="20px";
	        	divImage.style.marginRight="5px";
	        	divImage.style.cssFloat="left";
	        	divImage.style.styleFloat ="left";
	        	var img = document.createElement('img');
	        	img.src = appUrl+'/'+appName+'img/poi/'+images[i]+'.gif';
	        	img.width='20';
	        	img.height='20';
	        	divImage.appendChild(img);
	        	div.appendChild(divImage);	        	
	        }
			
			div.appendChild(createEmptyParagraph('20px'));
			
	        var httpstr = record.Www.substr(0, 4);
            if(httpstr != 'http'){
            	record.Www ='http://'+record.Www;
            }
            var id = record.Tooltip;
            nachUrl = nachUrl.replace(/##/, id);
            vonUrl=vonUrl.replace(/##/, id);
            var nach = createTextParagraph('<a href="#" onclick="return showFahrplanInfo(\''+nachUrl+'\');"><img border="0" src="'+mapApiUrl+appName+'img/poiContent/pfeil_grau.gif">Ankommen</a>','7px');
            nach.style.clear="both";
            div.appendChild(nach);
            div.appendChild(createEmptyTextParagraph(5));	
            var von = createTextParagraph('<a href="#" onclick="return showFahrplanInfo(\''+vonUrl+'\');"><img border="0" src="'+mapApiUrl+appName+'img/poiContent/pfeil_grau.gif">Abfahren</a>','7px');
            div.appendChild(von); 
            div.appendChild(createEmptyTextParagraph(5));
            var internet = createTextParagraph('<a href="#" onclick="return showFahrplanInfo(\''+record.Www+'\');"><img border="0" src="'+mapApiUrl+appName+'img/poiContent/pfeil_grau.gif">Haltestelleninformation&nbsp;</a>','7px');
    		internet.style.whiteSpace='nowrap';
            div.appendChild(internet);
            return div;
		}
		function formatDBContent (record,firstContent,moreTargets){
			var id = record.desc;			
			var abfahren=record.link.replace(/\$S=id\$/, "S="+id);			
			var ankommen=record.link.replace(/\$S=id\$/, "Z="+id);			
			var tafel=record.www.replace(/\$id\$/, id);			
			tafel=tafel.replace(/\$boardType\$/, "dep");
				
			var div = document.createElement('div');
			div.style.position = 'relative';		
			
			if(firstContent== false || moreTargets== true){
				div.appendChild(createEmptyParagraph('7px'));
			}
			if(firstContent == false &&  moreTargets==true){
				var divLine = getCutLine();
				div.appendChild(divLine);
				div.appendChild(createEmptyParagraph('10px'));
			}
			var name = record.Name;
	        var boldName = createTextParagraph(name.replace(/\u0020/g, '&nbsp;'));
	        boldName.style.fontWeight = 'bold';
	        boldName.style.color ='black';
	        div.appendChild(boldName);
	        div.appendChild(createEmptyTextParagraph(7));
			
	        var im = record.extImage;
	        var images = im.split('|');
	        for(var i=0;i<images.length;i++){
	        	var divImage = document.createElement('div');
	        	if(images[i]=='DB.gif'){
	        		divImage.style.width="30px";
	        	}
	        	else{
	        		divImage.style.width="20px";
	        	}
	        	
	        	divImage.style.marginRight="5px";
	        	divImage.style.cssFloat="left";
	        	divImage.style.styleFloat ="left";
	        	var img = document.createElement('img');
	        	img.src = appUrl+'/'+appName+'img/poi/'+images[i];		        	
	        	img.height='20';
	        	divImage.appendChild(img);
	        	div.appendChild(divImage);	        	
	        }
			
			div.appendChild(createEmptyParagraph('30px'));
           
            var nach = createTextParagraph('<a href="#" onclick="return showFahrplanInfo(\''+ankommen+'\');"><img border="0" src="'+mapApiUrl+appName+'img/poiContent/pfeil_grau.gif">Ankommen</a>','7px');
            nach.style.clear="both";
            div.appendChild(nach);
            div.appendChild(createEmptyTextParagraph(5));	
            var von = createTextParagraph('<a href="#" onclick="return showFahrplanInfo(\''+abfahren+'\');"><img border="0" src="'+mapApiUrl+appName+'img/poiContent/pfeil_grau.gif">Abfahren</a>','7px');
            div.appendChild(von); 
            div.appendChild(createEmptyTextParagraph(5));
            var internet = createTextParagraph('<a href="#" onclick="return showFahrplanInfo(\''+tafel+'\');"><img border="0" src="'+mapApiUrl+appName+'img/poiContent/pfeil_grau.gif">Haltestelleninformation&nbsp;</a>','7px');
    		internet.style.whiteSpace='nowrap';
            div.appendChild(internet);
            return div;
		}
		function showFahrplanInfo(urlExtern) {			
			var url = appUrl+appName+"jsp/fahrplan.jsp?url="+escape(urlExtern);			
			var keys = "url";
			var values = urlExtern;			
			
			var newWindow = window.open(url, "Fahrplan","toolbar=no,titlebar=no,resizable=yes,scrollbars=yes");
			if (!newWindow) {				
				return false;
			}
			
			return true;
		}
	    function formatContent(record,firstContent,moreTargets,coordinate)
	    {
	        var div = document.createElement('div');
	        div.style.position = 'relative';
	        if(firstContent== false || moreTargets== true){
	        	div.appendChild(createEmptyParagraph('7px'));
			}
			if(firstContent == false &&  moreTargets==true){
		    	
				var divLine = getCutLine();
				div.appendChild(divLine);
				div.appendChild(createEmptyParagraph('10px'));
				
			}
	        var name = record.Name;

	        var boldName = createTextParagraph(name.replace(/\u0020/g, '&nbsp;'));
	        boldName.style.fontWeight = 'bold';
	        boldName.style.color ='black';
	        div.appendChild(boldName);
	        if(record.Street){
	        	div.appendChild(createTextParagraph(record.Street.replace(/\u0020/g, '&nbsp;') + '&nbsp;' + record.HNR.replace(/\u0020/g, '&nbsp;')));
	        }
	        if(record.zipCode){
	        	 div.appendChild(createTextParagraph(record.zipCode.replace(/\u0020/g, '&nbsp;') + '&nbsp;' + record.place.replace(/\u0020/g, '&nbsp;')));
	        }

	        if (record.www)
	        {
	            var httpstr = record.www.substr(0, 4);
	            if(httpstr != 'http'){
	            	record.www ='http://'+record.www;
	            }
	            var internet = createTextParagraph('Internet:&nbsp;<a href="' + record.www + '" target="_blank">' + record.www + '</a>');
	            div.appendChild(internet);
	        }
	        if(userId!=undefined && userId !=null){
				div.appendChild(createEmptyTextParagraph(10));
	            var ugc = createTextParagraph('<a href="#" onclick="return fillCreateForm(\''+name+'\',\''+record.zipCode+'\',\''+record.place+'\',\''+record.Street+'\',\''+record.HNR+'\','+coordinate.getX()+','+coordinate.getY()+');">POI \u00FCbernehmen</a>','7px');
	            ugc.style.fontWeight = 'bold';
	            div.appendChild(ugc);				
			}	
	        return div;
	    }
function formatAngebotContent(record,firstContent,moreTargets,coordinate){
	    	var res = record;																
			var div = document.createElement('div');
			div.style.position = 'relative';
			div.appendChild(createEmptyTextParagraph(3));
			var title = "Supersonderangebot";
			var boldTitle = createTextParagraph(title.replace(/\u0020/g, '&nbsp;'));
			boldTitle.style.fontWeight = 'bold';
	        boldTitle.style.color ='black';
	        boldTitle.style.fontSize='16px';
	        div.appendChild(boldTitle);
	        
	        div.appendChild(createEmptyParagraph('10px'));						        
	        var text = "Greifen Sie jetzt zu...";
			var boldText = createTextParagraph(text.replace(/\u0020/g, '&nbsp;'));
			boldText.style.fontWeight = 'bold';
	        boldText.style.color ='#ff0000';						     
	        div.appendChild(boldText);
	        div.appendChild(createEmptyParagraph('10px'));				        
   
			var name = res.Name;
			var boldName = createTextParagraph(name.replace(/\u0020/g, '&nbsp;'));
	      
	        div.appendChild(boldName);
	        div.appendChild(createEmptyParagraph('5px'));
	        if(res.Street){
	        	div.appendChild(createTextParagraph(res.Street.replace(/\u0020/g, '&nbsp;') + '&nbsp;' + res.HNR.replace(/\u0020/g, '&nbsp;')));
	        }
	        if(res.zipCode){
	        	 div.appendChild(createTextParagraph(res.zipCode.replace(/\u0020/g, '&nbsp;') + '&nbsp;' + res.place.replace(/\u0020/g, '&nbsp;')));
	        }

	        if (res.www){
	            var httpstr = res.www.substr(0, 4);
	            if(httpstr != 'http'){
	            	res.www ='http://'+res.www;
	            }
	            var internet = createTextParagraph('Internet:&nbsp;<a href="' + res.www + '" target="_blank">' + res.www + '</a>');
	            div.appendChild(internet);
	        }
	        div.appendChild(createEmptyParagraph('5px'));
	        
	        if(res.desc!=null && res.desc.length >0){
	        	div.appendChild(createEmptyTextParagraph(5));
	        	//div.appendChild(createTextParagraph(res.desc));
	        	var table = iw.create('table');
				table.style.cellspacing = '0';
				table.style.position ='relative';			   
			    var r =0;
			    var tr = table.insertRow(r);
				tr.style.height='1px';
				var td = tr.insertCell(0);										
				td.style.lineHeight= '10px';		
				tdText = createTextParagraph(res.desc);
				td.appendChild(tdText);		
				div.appendChild(table);
	        }  
	      div.appendChild(createEmptyTextParagraph(10));
	        
			return div;	        
			
	    }
	    function getCutLine(){
	    	var divLine = document.createElement('div');			
			with (divLine.style) {
				position = 'relative';
				borderTop = '1px solid #cfcfd1';			
				height = '1px';			
			}
			return divLine;
	    }   
		/**
 * Creates a new routing magnifier content factory.
 * 
 * @class <code>IWRoutingMagnifierFactory</code> is a class to create contents used to display the surroundings of a routing point in an <code>IWInfoBalloon</code>.
 * 
 * @constructor
 * 
 * @param {IWMap}
 *            map a map
 * 
 * @author JAN, BRE
 * @since 0.72
 */
function GSRoutingMagnifierFactory(map) {
	var _self = this;
	var _map = map;	
	var mapRM = null;
	var currentMapType = null;
	var currentZoom = null;
	

	/**
	 * This function creates a <code>div</code> showing the routing magnifier.
	 * 
	 * @private
	 * @param {IWCoordinate}
	 *            coordinate the coordinate of the routing point to magnify
	 * @return {HTMLDivElement} div
	 */
	this.createRoutingMagnifierContent = function(coordinate,entries,result) {
		
		var divMap = document.getElementById('divMap');
		var _entries = entries;
		var _result = result;
		var div = iw.create('div');
		with (div.style) {
			position = 'relative';
			width = '230px';
			height = '250px';
		}

		var mapDiv = iw.create('div');		
		iw.append(div, mapDiv);		
		
		mapRM = new IWMap(mapDiv);
		var options = mapRM.getOptions();
		options.setSize(new IWSize(230,250));
		
		var roadmap= options.getMapTypeByName("roadmap") ;		
		var hybrid= options.getMapTypeByName("hybrid") ;	
		
		options.setLeftMouseAction(IWMapOptions.CONTROL_NONE);		
		options.setRightMouseAction(IWMapOptions.CONTROL_NONE);
		options.setDoubleClickAction(IWMapOptions.CONTROL_NONE);
		options.setMouseWheelAction(IWMapOptions.CONTROL_ZOOM);
		options.setDoubleClickAction(IWMapOptions.CONTROL_NONE);
		mapRM.getCopyrightControl().getContainer().style.display = 'none';	
		
		var routeLayer = divMap.mapReference.getLayerByName('Route');
		
		if(routeLayer!=null ) {
			var newLayer = new IWLayer(mapRM, routeLayer.getLayerTitle(), routeLayer.getLayerName(), routeLayer.getIdfLayerName());
			newLayer.setVisible(routeLayer.isVisible());

			var shapes = routeLayer.getShapes();
			for ( var i = 0; i < shapes.length; i++) {
				newLayer.addShape(shapes[i]);
			}
			mapRM.addLayer(newLayer);
			
		}		
		
		IWEventManager.addListener(mapRM, 'oncenter',function (event)   {			
			var bounds = mapRM.getBounds() ;
			$(_entries).each(function (index) {
				var c = new IWCoordinate(_result[this.id + 'X'], _result[this.id + 'Y']);
				if(bounds.containsCoordinate(c) ){					
					var marker = new IWMarker(mapRM, c);
					marker.setDefaultIcon(new IWIcon(iwconst.GLOBAL_APP_URL + '/img/controls/routing/bullet_white_10.gif',
							new IWPoint(10, 10)));
					var div = iw.create('div');
					div.id ='routeSegment';
					marker.getContainer().appendChild(div);
					div.innerHTML = '<p align="center" style="margin: 0px">' + (index+1) + '</p>';					
					mapRM.getOverlayManager().getLayer(layerIndexOfRoutingPoints).addOverlay(marker);
				}				
			});
			
		});		
		
		mapRM.setCenter(coordinate,15, roadmap); 
		currentMapType = roadmap;
			
		var imgZoomIn = iw.create('img');
		iw.append(mapDiv, imgZoomIn);
		
		imgZoomIn.src = iwconst.GLOBAL_APP_URL + 'img/controls/magnifier/zoomIn.gif';

		with (imgZoomIn.style) {
			position = 'absolute';
			top = '5px';
			left = '5px';
			cursor = 'pointer';
			zIndex = 100;
		}

		imgZoomIn.onclick = function() {
			
			currentZoom = mapRM.getZoom();
			if(currentZoom >= 5 && currentZoom <16) {
				
				var zoomNeu = currentZoom +1;
				mapRM.setCenter(coordinate,zoomNeu, currentMapType); 
				
			}
				
		}.iwclosure(_self);

		// adding the zoomOut image
		var imgZoomOut = iw.create('img');
		iw.append(mapDiv, imgZoomOut);
		imgZoomOut.src = iwconst.GLOBAL_APP_URL + 'img/controls/magnifier/zoomOut.gif';

		with (imgZoomOut.style) {
			position = 'absolute';
			top = '23px';
			left = '5px';
			cursor = 'pointer';
			zIndex = 100;
		}

		imgZoomOut.onclick = function() {
			currentZoom = mapRM.getZoom();
			if(currentZoom > 5 && currentZoom <= 16) {
				
				var zoomNeu = currentZoom -1;
				mapRM.setCenter(coordinate,zoomNeu, currentMapType); 
			}
			
		}.iwclosure(_self);

		// adding the map type image
		var imgMap = iw.create('img');
		iw.append(mapDiv, imgMap);
		imgMap.src = iwconst.GLOBAL_APP_URL + 'img/controls/magnifier/map.gif';

		with (imgMap.style) {
			position = 'absolute';
			top = '5px';
			left = '30px';
			cursor = 'pointer';
			zIndex = 100;
		}

		imgMap.onclick = function() {
			mapRM.setCenter(coordinate,mapRM.getZoom(), roadmap);
			currentMapType = roadmap;
			
		}.iwclosure(_self);

		// adding the hybrid type image
		var imgHybrid = iw.create('img');
		iw.append(mapDiv, imgHybrid);
		imgHybrid.src = iwconst.GLOBAL_APP_URL + 'img/controls/magnifier/air.gif';

		with (imgHybrid.style) {
			position = 'absolute';
			top = '5px';
			left = '77px';
			cursor = 'pointer';
			zIndex = 100;
		}
		imgHybrid.onclick = function() {
			mapRM.setCenter(coordinate,mapRM.getZoom(), hybrid); 
			currentMapType = hybrid;
			
		}.iwclosure(_self);

		return div;
	};

	

	
}/**
 * Creates a new window object.
 * 
 * @class <code>IWInfoBalloon</code> is an example implementation of the <code>IWWindowOverlay</code> interface.
 *        <code>IWInfoBalloon</code> can be used to display informations in front of the map.
 * @extends IWWindowOverlay
 * 
 * @constructor
 * 
 * @param {IWMap}
 *            map
 * @param {IWCoordinate}
 *            coordinate
 * @param {Object}
 *            [content] DOMElement or String
 * 
 * @author JAN, KUN
 * @since 0.66
 */
function InfoBalloon(map, coordinate, content,moreTargets)		
{
	// ********************************************************************
	// First we call the superclass constructor
	// ********************************************************************
	
	IWWindowOverlay.call(this, map, coordinate);

	// ********************************************************************
	// * Private attributes
	// ********************************************************************

	var self = this;
	var size = new IWSize(240, 180);
	

	var panMap = true;
	var borderWidth = 17;
	var borderHeight = 17;
	var arrowHeigth = 50;
	var arrowWidth=60;

	// ********************************************************************
	// * GUI Elements
	// ********************************************************************
	var container = this.getContainer();	
	var divMain = iw.create('div');	
	var divContent = iw.create('div');
	var divTitle = iw.create('div');
	var divImageArrow = iw.create('div');
	var imgClose = iw.create('div');
	var logger = log4javascript.getLogger('IWInfoBalloon');	

	// ********************************************************************
	// * Setup for multi language support
	// ********************************************************************

	var pack = new IWLanguagePack();
	pack.addLanguage(new IWLanguage('de', iwconst.LOCAL_APP_URL + 'lang/IWInfoBalloon.lang.de'));
	pack.addLanguage(new IWLanguage('en', iwconst.LOCAL_APP_URL + 'lang/IWInfoBalloon.lang.en'));
	pack.addLanguage(new IWLanguage('es', iwconst.LOCAL_APP_URL + 'lang/IWInfoBalloon.lang.es'));
	pack.addLanguage(new IWLanguage('fr', iwconst.LOCAL_APP_URL + 'lang/IWInfoBalloon.lang.fr'));
	pack.addLanguage(new IWLanguage('tr', iwconst.LOCAL_APP_URL + 'lang/IWInfoBalloon.lang.tr'));
	pack.addLanguage(new IWLanguage('it', iwconst.LOCAL_APP_URL + 'lang/IWInfoBalloon.lang.it'));

	IWMultiLanguageSupport.call(this, map, pack);

	// ********************************************************************
	// * Public methods
	// ********************************************************************

	/**
	 * If the whole popup should be visible in the map-viewport after appending, set "true". If not, set "false". Then
	 * its possible that the popup intersects the map-viewport-bounds. Default is "true".
	 * 
	 * @param {Bool}
	 *            panMapBool
	 * @return {void}
	 */
	this.setAutoPan = function(panMapBool)
	{
		panMap = panMapBool;
	};

	/**
	 * Returns the content of the infoballoon.
	 * 
	 * @return {Object}
	 */
	this.getContent = function()
	{
		return content;
	};

	/**
	 * Sets the content of the infoballoon.
	 * 
	 * @param {Object}
	 *            newContent the new content of the infoballoon
	 * @return {void}
	 */
	this.setContent = function(newContent)
	{
		content = newContent;
	};

	/**
	 * We use the callback method for positioning the map and displaying the info balloon.
	 * 
	 * @return {void}
	 */
	this.afterAppend = function()
	{
		logger.info('Calling afterAppend.');
		try{
			if(PIE.attach){
				PIE.attach(divMain);
				PIE.attach(divImageArrow);
				PIE.attach(divTitle);				
			}
		}
		catch(Exception){			
		}
		var maxHeight = 250;
        var maxWidth = 400;
		var minHeight=25;
		var minWidth=110;
		var scrollBalkeX = false;
		var scrollBalkeY = false;
		var contentSize = new IWSize(content.offsetWidth,content.offsetHeight);
		if (contentSize.getHeight() < minHeight)
        {
            contentSize.setHeight(minHeight);
        }
        else if (contentSize.getHeight() > maxHeight)
        {
            contentSize.setHeight(maxHeight);
            scrollBalkeX = true;
        }
        if (contentSize.getWidth() < minWidth)
        {
            contentSize.setWidth(minWidth);
            
        }
        else if (contentSize.getWidth() > maxWidth)
        {
            contentSize.setWidth(maxWidth);
            scrollBalkeY=true;
        }  
        if(scrollBalkeX == true) { 
        	contentSize.setWidth(contentSize.getWidth()+25);
        }
        if(scrollBalkeY == true) { 
        	contentSize.setHeight(contentSize.getHeight()+25);
        }
		this.setSize (new IWSize(contentSize.getWidth(),contentSize.getHeight()));
		
		container.style.visibility = 'visible';
		
		if (panMap)
		{
			var position = iw.absolute(container, map.getContainer());

			// ********************************************************************
			// * If the coordinate is inside the visible map area we use the panBy
			// * method to adjust the infoballoon at the screen. Otherwise we use
			// * the setCenter method to center the infoballoon.
			// ********************************************************************

			if (map.getBounds().containsCoordinate(coordinate))
			{
				var offsetRight = position.getX() + size.getWidth() + borderWidth + borderWidth 
						- map.getOptions().getSize().getWidth();
				var offsetLeft = position.getX();
				var offsetTop = position.getY() ;
				var offsetBottom = position.getY() + size.getHeight() + borderHeight + borderHeight 
						- map.getOptions().getSize().getHeight();

				if (offsetRight > 0 || offsetLeft < 0 || offsetTop < 0 || offsetBottom > 0)
				{
					var x = 0;
					var y = 0;

					if (offsetRight > 0)
					{
						x = -offsetRight;
					}
					else
						if (offsetLeft < 0)
						{
							x = -offsetLeft;
						}

					if (offsetTop < 0)
					{
						y = -offsetTop;
					}
					else
						if (offsetBottom > 0)
						{
							y = -offsetBottom;
						}

					map.panBy(new IWPoint(x, y), true);
				}
			}
			else
			{
				// ********************************************************************
				// * We adjust the infoballoon at the screen by calculating a new
				// * center coordinate.
				// ********************************************************************

				var projection = map.getCurrentMapType().getProjection();
				var pixelCoordinate = projection.meterToPixel(coordinate);
				// We calculate the y offset in pixel
				var pixelOffsetY = this.getSize().getHeight() / 2;
				var centerX = pixelCoordinate.getX();
				var centerY = pixelCoordinate.getY() - pixelOffsetY;
				var pixelCenter = new IWPoint(centerX, centerY);
				map.setCenter(projection.pixelToMeter(pixelCenter));
			}
		}
	};

	/**
	 * Resizes the balloon to the specified size.
	 * 
	 * @param {IWSize}
	 *            size the new size of the infoballoon
	 * @return {void}
	 */
	this.setSize = function(newSize)
	{
		logger.info('Calling setSize with ' + size);

		iw.strict( [ IWSize ], [ size ]);
		size = newSize;

		resize();

		this.setAnchor(new IWPoint(-(size.getWidth() / 2 ),
				-(size.getHeight() + borderHeight + borderHeight + arrowHeigth)));
	};

	/**
	 * Returns the size of the infoballoon.
	 * 
	 * @return {IWSize}
	 */
	this.getSize = function()
	{
		return size;
	};

	/**
	 * Destroys the infoballoon. Releases all DOM references and event listeners.
	 * 
	 * Call this method after the infoballoon has been removed from the map by calling the
	 * <code>removeWindowOverlay</code> method.
	 * 
	 * @return {void}
	 */
	this.destroy = function()
	{
		logger.info('Calling destroy');
		try{
			if(PIE.detach){
				PIE.detach(divMain);				
				PIE.detach(divImageArrow);
				PIE.detach(divTitle);
			}
		}
		catch(Exception){			
		}
		IWEventManager.clearInstanceListeners(this);

		this.destroyMultiLanguageSupport();
		this.destroyWindowOverlay();

		content = null;
		divMain = null;
		divContent = null;		
		divImageArrow = null;
		imgClose = null;
		container = null;
	};

	/**
	 * Returns a string representation of this infoballoon.
	 * 
	 * @return {String}
	 */
	this.toString = function()
	{
		return '[DPInfoBalloon]';
	};

	// ********************************************************************
	// * Private methods
	// ********************************************************************

	/**
	 * Creates the GUI.
	 * 
	 * @private
	 * @return {void}
	 */
	function buildGUI()
	{
		logger.debug('Calling buildGUI');
		if(moreTargets == true) {	
			borderHeight=20;			
		}
		container.style.height = size.getHeight() + borderHeight + borderHeight + 'px';
		container.style.width = size.getWidth() + borderWidth + borderWidth + 'px';
		container.style.visibility = 'hidden';

		// ********************************************************************
		// * Append the main DIV to our container
		// ********************************************************************
			
		iw.append(container, divMain);		
		divMain.style.position = 'absolute';
		divMain.style.top = '0px';
		divMain.style.left = '0px';
		divMain.style.width = size.getWidth() + 'px';
		divMain.style.height = size.getHeight() + 'px';
		divMain.className='infolayer-content';
		
		

		// ********************************************************************
		// * Append the content DIV
		// ********************************************************************

		divContent.id = 'divContent';
		iw.append(divMain, divContent);
		divContent.style.position = 'absolute';
		divContent.style.top = borderHeight + 'px';
		divContent.style.left = borderWidth + 'px';	
		divContent.style.overflow = 'auto';

		if(moreTargets == true) {	
			borderHeight=20;
			divTitle.className='title-content';			
			var title = document.createTextNode('Mehrere Treffer');
			divTitle.appendChild(title);
			iw.append(divMain, divTitle);
		}
		
		// ********************************************************************
		// * Append the user content DIV
		// ********************************************************************
		var div = iw.create('div');
		div.style.overflow = 'hidden';
		iw.append(divContent, div);
		iw.append(div, content);

		// ********************************************************************
		// * Append the close image
		// ********************************************************************

		iw.append(divMain, imgClose);
		self.addLabelFor(new IWLabel('CLOSE', imgClose, 'title'));
		self.addLabelFor(new IWLabel('CLOSE', imgClose, 'alt'));		
		imgClose.className='imgclose bgControls';

		// ********************************************************************
		// * Append the arrow image		
		// ********************************************************************

		iw.append(container, divImageArrow);
		divImageArrow.className='infolayer-pointer bgControls';
		divImageArrow.style.position = 'absolute';		
		divImageArrow.style.height = arrowHeigth + 'px';
		divImageArrow.style.width = '60px';
		divImageArrow.style.left = Math.round(size.getWidth() / 2) + 'px';

		imgClose.onclick = function()
		{
			map.removeWindowOverlay(self);
		};
		imgClose.onmousedown = function()
		{
			imgClose.className='imgclose imgclosedown';
		};
		imgClose.onmouseup = function()
		{
			imgClose.className='imgclose imgclosegrund';
		};
	}

	/**
	 * Resizes the GUI.
	 * 
	 * @private
	 * @return {void}
	 */
	function resize()
	{
		logger.debug('Calling resize.');

		var w = size.getWidth();
		var h = size.getHeight();

		container.style.height = h + borderHeight + borderHeight + 'px';
		container.style.width = w + borderWidth + borderWidth + 'px';

		divMain.style.width = w + borderWidth + borderWidth + 'px';
		divMain.style.height = h + borderHeight + borderHeight + 'px';

		divContent.style.width = w + 'px';
		divContent.style.height = h + 'px';	

		// substract one pixel to overlay the border
		divImageArrow.style.top = h + borderHeight + borderHeight + 'px';
		divImageArrow.style.left = Math.round(w / 2) + 'px';

	}

	// ********************************************************************
	// * Constructor implementation
	// ********************************************************************
	
	buildGUI();

	// ********************************************************************
	// * Sets the default anchor for this overlay
	// ********************************************************************

	this.setAnchor(new IWPoint(-(size.getWidth() / 2), -(size.getHeight())));	

	// ********************************************************************
	// * Loads the language pack for the control
	// ********************************************************************

	this.loadLanguagePack(map.getOptions().getLanguage());
	
}/**
 * This control shows an "Ortsschild" to search a address
 * 
 * @constructor
 * @extends IWControl
 * 
 * @author TBE
 */

function IWAddressStringSearchPane(map) {
	
	var geocodingComplet = true;	
	
	function buildGUI() {
		
		container.id='adressControlPane';
		container.className ='adressControlPane';
		container.appendChild(_addressDiv1);
		container.appendChild(_addressDiv2);		
		_addressDiv1.appendChild(createAddressFields());		
		show(_addressDiv1);
		
		_addressDiv2.id = 'addressSearch2';
		var table = $('<table id="searchPaneTable2" class="searchPane"></table>');
		
		$('<tr>').addClass("searchPaneHeader")
         .append( $('<td>').append( $('<H1 ></H1>').html('Adresse suchen'))) 
         .appendTo(table);
		 
		$('<tr id="backButton2">')  
		.append($('<td>').append(backButton)) 
		.appendTo(table);
		 
		table.appendTo(_addressDiv2);
		hide(_addressDiv2);

		var _onGeocodeListener = IWEventManager.addListener(_geocoderClient, 'ongeocode', function(event) {

			var results = event.results;
			hideMessage();
			if (results.length == 0) {
				
				showMessage('Die gesuchte Adresse wurde nicht gefunden! \u00C4ndern Sie die Eingabe und versuchen Sie noch ein Mal.');
				geocodingComplet = true;
				return;
			} 
			else {
				
				results.reverse();
				_geocodeAddresses.push(results);	
				$(".trDummy").remove();	
				
					for ( var i = 0; i < results.length; i++) {

					var text = this.formatAddressString(results[i].getAddress());
					var value = results[i].getAddress().getWGS84().getX() + ',' + results[i].getAddress().getWGS84().getY();
					
					if (results.length == 1) {
						selectedAdress = results[i].getAddress();
						showSelectedAddress(value,text);
					}
					var link = document.createElement('a');
					link.href = "#";
					link.className = "underlink";
					link.result = value;
					link.addText = text;
					link.adress = results[i].getAddress();
					link.onclick = function() {	
						var v = this.result;
						var t = this.addText;
						selectedAdress =this.adress;						
						showSelectedAddress(v,t);
						var selectValue = t.replace(/ Bez.: /, "");
						$('#addressInput').val(selectValue) ;
					};
					link.innerHTML = text + '</br>';
					
					 $('<tr>').addClass("trDummy").append($('<td >').append(link)).appendTo($('#searchPaneTable2') );              
			       
				}
		}
		
		if (results.length > 1)  {
			hide(_addressDiv1);	
			show(_addressDiv2);
			
			IWEventManager.trigger(_self, "onredraw", null);
		}
		geocodingComplet = true;
		}.iwclosure(this));

		IWEventManager.addListener(backButton, "onclick", function(event) {
			hide(_addressDiv2);
			show(_addressDiv1);			
		}.iwclosure(this));
		
	}

	function showSelectedAddress(value,text) {		

		var coordinate = parseCoordinate(value);
		var event = new IWAddressSearchEvent();

		var p = document.createElement("p");
		p.innerHTML = text;
		if(selectedAdress !=null) {
			event.address = selectedAdress;
			if (event.address.getHouseNumber() == null) {
				event.address.setHouseNumber('');
			}
		}
		event.coord = coordinate;	
		IWEventManager.trigger(_self, "aftersearch", event);
		backButton.click();
		
	}
	
	function parseCoordinate(stringCoordinate) {
		var coord = null;
		var coordM = null;
		try {
			var chunks = stringCoordinate.split(',');
			var x = parseFloat(chunks[0]);
			var y = parseFloat(chunks[1]);
			coord = new IWCoordinate(x, y, IWCoordinate.WGS84);// address.getWGS84().getX(), address.getWGS84().getY(), IWCoordinate.WGS84
			coordM = coord.toMercator();
		} catch (e) {
			throw 'Cant parse coordinate string: ' + stringCoordinate;
		}

		return coordM;
	}

	function show(pane) {
		pane.style.visibility = 'visible';
		pane.style.display = 'block';

	}

	function hide(pane) {
		pane.style.visibility = 'hidden';
		pane.style.display = 'none';
	}
	
	this.formatAddressString = function (address) {
		var s = '';

		if (address.getStreet() != null) {
			s = s.concat(address.getStreet());

			if (address.getHouseNumber() != null) {
				s = s.concat(' ');
				s = s.concat(address.getHouseNumber());
			}
		}
		if (address.getZipCode() != null) {
			if (s.length > 0) {
				s = s.concat(' ');
			}
			s = s.concat(address.getZipCode()).concat(' ');
		}
		if (address.getCity() != null) {
			s = s.concat(address.getCity());
		}
		if (address.getPart() != null) {
			var part = ' / ' + address.getPart();
			s = s.concat(part);
		}
		if (address.getDistrict() != null && address.getDistrict() != address.getCity()) {

			var district = ' ( Bez.: ' + address.getDistrict() + ') ';
			s = s.concat(district);

		}
		return s;
	}

	function startSearch() {
		if (!geocodingComplet)
			return;
		hideMessage();
		var addressString = document.getElementById("addressInput").value;		
		var buch = addressString.substr(0, 5).toLowerCase();
		if(buch == 'buch:') {
			geocodingComplet = true;
			var buchNr = addressString.match(/\d+/);			
			buchLayer = _map.getLayerByName('POIBUCH');
			if(buchLayer) {
				var shapes = buchLayer.getShapes() ;
				for (var i=0;i< shapes.length;i++){
					buchLayer.removeShape(shapes[i].getShapeName());
				}
				if(buchNr) {
					buchLayer.addShape(new IWShape('buch_'+buchNr, new IWRange(0, 20)));
					buchLayer.setVisibility(true);
					showBuchArea(buchNr);
				}
				else {
					buchLayer.setVisibility(false);
					_map.redraw();
				}
			}
			return;
		}
		var gebiet = addressString.substr(0, 7).toLowerCase();
		if(gebiet == 'gebiet:') {
			geocodingComplet = true;
			var gebietName = addressString.substr(7,addressString.length);
			gebietName=gebietName.replace (/^\s+/, '').replace (/\s+$/, '');
			gebietLayer = _map.getLayerByName('POIGEBIET');
			if(gebietLayer) {
				var shapes = gebietLayer.getShapes() ;
				for (var i=0;i< shapes.length;i++){
					gebietLayer.removeShape(shapes[i].getShapeName());
				}
				if(gebietLayer) {
					gebietLayer.addShape(new IWShape(gebietName+'_polygonsGroupped', new IWRange(0, 20)));
					gebietLayer.setVisibility(true);
					showGebietArea(gebietName);
				}
				else {
					gebietLayer.setVisibility(false);
					_map.redraw();
				}
			}
			return;
		}
		if(addressString.length ==0 ||addressString == 'Adresse eingeben') {
			showMessage("Geben Sie bitte die gesuchte Adresse in Adressfeld ein.");
			return;
		}
		countryCode = $('#adressCountryInput').val();
		geocodingComplet = false;	
		_geocodeAddresses = new Array();		
		if(countryCode =='VAE'){
			_geocoderClient.geocodeAddressString(addressString+',  Vereinigte Arabische Emirate', '', true);
		}
		else{
			_geocoderClient.geocodeAddressString(addressString, countryCode, true);
		}

	}
	this.startSearch = function(){
		startSearch();
	};
	
	function createAddressFields() {
		 
		 var table = $('<table id="searchPane" class="searchPane"></table>');				
         $('<tr>').addClass("searchPaneHeader")
         .append( $('<td>').append( $('<H1 ></H1>').html('Adresse suchen'))) 
         .appendTo(table);

         $('<tr id = "searchPaneAdressField" class="searchPaneAdressField"> ')
         .append( $('<td id = "addressData" class="addressData">').append(createInputField('addressInput', 'Adresse eingeben') ))         
         .appendTo(table);
                  
         $('<tr id = "searchPaneCountryField" class="searchPaneCountryField">')
         .append( $('<td>').append(country))
         .appendTo(table);
         
         $('<tr id = "searchPaneButton" class="searchPaneButton">')        
         .append( $('<td>').append(searchButton))
         .appendTo(table);
         
         $('<tr id="trMeldung">')         
         .append( $('<td id="dMeldung" class="dMeldung">').append($('<p id="pMeldung" class="pMeldung">')))
         .appendTo(table);     		 
        
		country.className = 'adressCountryInput';
		country.id = "adressCountryInput";
		country.options[0] = new Option('Deutschland', 'D');		
		country.options[0] = new Option('Albanien', 'ALB');
		country.options[1] = new Option('Andorra', 'AND');
		country.options[2] = new Option('Bosnien-Herzegowina', 'BIH');
		country.options[3] = new Option('Belgien', 'B');
		country.options[4] = new Option('Bulgarien', 'BGR');
		
		country.options[5] = new Option('Estland', 'EST');
		country.options[6] = new Option('D\u00E4nemark', 'DK');
		country.options[7] = new Option('Deutschland', 'D');
		country.options[8] = new Option('Finnland', 'FIN');
		country.options[9] = new Option('Frankreich', 'F');
		country.options[10] = new Option('Griechenland', 'GR');
		country.options[11] = new Option('Gro\u00DFbritannien', 'GB');
		
		country.options[12] = new Option('Iceland', 'IS');
		country.options[13] = new Option('Irland', 'IRL');
		country.options[14] = new Option('Italien', 'I');
		country.options[15] = new Option('Kroatien', 'HRV');
		country.options[16] = new Option('Lettland', 'LVA');
		country.options[17] = new Option('Litauen', 'LTU');
		country.options[18] = new Option('Luxemburg', 'L');
		country.options[19] = new Option('Makedonien', 'MKD');
		country.options[20] = new Option('Malta', 'MLT');
		country.options[21] = new Option('Moldavien', 'MDA');
		country.options[22] = new Option('Montenegro', 'MNE');
		country.options[23] = new Option('Niederlande', 'NL');
		
		country.options[24] = new Option('Norwegen', 'N');
		country.options[25] = new Option('\u00D6sterreich', 'A');
		country.options[26] = new Option('Polen', 'PL');
		country.options[27] = new Option('Portugal', 'P');
		country.options[28] = new Option('Rum\u00E4nien', 'ROU');
		country.options[29] = new Option('Russland', 'RUS');
		country.options[30] = new Option('San Marino', 'RSM');
		country.options[31] = new Option('Serbien', 'SRB');
		country.options[32] = new Option('Slowenien', 'SVN');
		country.options[33] = new Option('Slowakei', 'SK');
		country.options[34] = new Option('Spanien', 'E');
		country.options[35] = new Option('Schweden', 'S');
		country.options[36] = new Option('Schweiz', 'CH');
		country.options[37] = new Option('Tschechien', 'CZ');
		country.options[38] = new Option('T\u00FCrkei', 'TUR');
		country.options[39] = new Option('Ukraine', 'UKR');
		country.options[40] = new Option('Ungarn', 'HUN');
		country.options[41] = new Option('Vereinigte Arabische Emirate', 'VAE');
		country.options[42] = new Option('Weissrussland', 'RLR');
		country.options[43] = new Option('Weltweit', 'WW');
		
		setSelectedIndex(country, 'D');	
		IWEventManager.addListener(searchButton, "onclick", startSearch.iwclosure(searchButton));

		return table[0];
	}
	function showMessage (text) {		 
		 $('#trMeldung').css({"display":"block"});		 
		 $('#pMeldung').html(text);
	 }
	this.showMessage = function(tex){
		showMessage(tex);
	};
	
	function hideMessage() {		 
		$('#trMeldung').css({"display":"none"});
	 }
	
	function setSelectedIndex(elem, value) {
		for ( var i = 0; i < elem.options.length; i++) {
			if (elem.options[i].value == value) {
				elem.selectedIndex = i;
				return;
			}
		}
	}

	function getSelectedText(elem) {
		return elem.options[elem.selectedIndex].text;
	}

	function createInputField(name, value) {

		var input = iw.create('input');
		input.id = name;
		input.type = 'text';
		input.name = name;
		input.className = name;
		input.value = value;

		IWEventManager.addListener(input, 'onfocus', function() {
			if (this.value == value) {
				this.value = '';
			}
		}.iwclosure(input));

		IWEventManager.addListener(input, 'onblur', function() {
			if (this.value == '') {
				this.value = value;
			}
		}.iwclosure(input));

		IWEventManager.addListener(input, "onkeypress", function(event) {
			if (window.event) // for IE
					var keynum = window.event.keyCode;
				else
					var keynum = event.keyCode;

				if (keynum == 13) // RETURN pressed
				
				startSearch();
			}.iwclosure(input));

		return input;
	}

	 function showGebietArea (name){	
		 
		var params = {};
		params["name"]=name;		
		var url = 'http://'+appUrl+'/'+appName+'gebietsBerechnungUrl';

		jQuery_1_5_1.ajax({	
			type: 'GET',		
			crossDomain:true,			
			scriptCharset: "ISO-8859-1",
			dataType: "jsonp",
			url: url,
			data:params,			
			success: function  (json, textStatus, jqXHR) {				
				if(json.gebiet!= undefined && json.gebiet!=null) {
					var nw = new IWCoordinate(json.gebiet.xMin,json.gebiet.yMin);
					var so = new IWCoordinate(json.gebiet.xMax,json.gebiet.yMax);
					bounds = new IWBounds(nw,so);
					var zoom = _map.getBoundsZoomlevel(bounds);
					_map.setCenter(bounds.getCenter(),zoom,_map.getCurrentMapType());
				}
				else {
					showMessage('Gebiet mit Namen. '+name+' wurde nicht gefunden.');
					gebietLayer = _map.getLayerByName('POIGEBIET');
					gebietLayer.setVisibility(false);
					_map.redraw();
				}
			},		
			jsonpCallback: "ugcCallback",				
			error:errorCallback			
		});	
	}	

	function showBuchArea (id){	
		
		var params = {};
		params["buchId"]=id;
		
		var url = 'http://'+appUrl+'/'+appName+'BuchLocation';

		jQuery_1_5_1.ajax({	
			type: 'GET',		
			crossDomain:true,			
			scriptCharset: "ISO-8859-1",
			dataType: "jsonp",
			url: url,
			data:params,			
			success: function  (json, textStatus, jqXHR) {				
				if(json.buch!= undefined && json.buch!=null) {						
					var nw = new IWCoordinate(json.buch.x1,json.buch.y1);
					var so = new IWCoordinate(json.buch.x2,json.buch.y2);
					bounds = new IWBounds(nw,so);
					var zoom = _map.getBoundsZoomlevel(bounds);
					_map.setCenter(bounds.getCenter(),zoom,_map.getCurrentMapType());
				}
				else {
					showMessage('Buch Nr. '+id+' wurde nicht gefunden.');
					buchLayer = _map.getLayerByName('POIBUCH');
					buchLayer.setVisibility(false);
					_map.redraw();
				}
			},		
			jsonpCallback: "ugcCallback",				
			error:errorCallback			
		});	
	}	
	this.getContainer= function(){
		return container;
	};
	

	var _MAX_ADDRESSES_PER_GEOCODE = 100;	
	var _COUNTRY = 2;

	var container = document.createElement('div');
	var _geocoderClient = new IWSimpleGeocoderClient();
	_geocoderClient.setUrl(geocoderUrl + 'gc_simple/Simple.jsp?');
	var _self = this;
	var _map = map;
	
	var _addressDiv1 = iw.create('div');
	var _addressDiv2 = iw.create('div');
	var backButton = iw.create('button');
	
	var nextButton = iw.create('button');
	var searchButton = iw.create('button');
	var country = iw.create('select');
	
	var _inputAddresses = null;	
	var _addressIndex = 0;
	var _geocodeAddresses = null;
	var _marker = null;
	
	var selectedAdress = null;
	
	backButton.id = "backButton";
	backButton.className = 'buttonPane';
	backButton.innerHTML = 'Zur\u00FCck';
	
	searchButton.id = 'searchButtonPane';
	searchButton.className = 'buttonPane';
	searchButton.innerHTML='Zeigen';
	buildGUI();
	
}

function IWAddressSearchEvent() {
	this.address = null;
	this.coord = null;
}
/**
 * WindowOverlay interface.
 * 
 * @class An interface which has to be implemented by all window overlays.
 * @extends IWMapElement
 * 
 * @constructor
 * @param {IWMap}
 *            map the map
 * @param {IWCoordinate}
 *            coordinate the coordinate where the window overlay appears on the map
 * 
 * @author JAN
 */
function IWMarWindowOverlay(map, coordinate)
{
	// ********************************************************************
	// * Private attributes
	// ********************************************************************

	var self = this;
	var anchor = new IWPoint(0, 0);
	var logger = log4javascript.getLogger('IWMarWindowOverlay');

	// ********************************************************************
	// * First we call the superclass constructor
	// ********************************************************************

	IWMapElement.call(this, map.getControlContainer());

	/**
	 * Returns the anchor of the window overlay.
	 * 
	 * @return {IWPoint}
	 */
	this.getAnchor = function()
	{
		return anchor;
	};

	/**
	 * Sets the anchor of the window overlay.
	 * 
	 * @param {IWPoint}
	 *            newAnchor
	 * @return {void}
	 */
	this.setAnchor = function(newAnchor)
	{
		// logger.info('Calling setAnchor with ' + newAnchor);

		if (this.isDisplayed())
		{
			var container = this.getContainer();

			var top = parseInt(container.style.top);
			var left = parseInt(container.style.left);

			container.style.top = top - anchor.getY() + newAnchor.getY() + 'px';
			container.style.left = left - anchor.getX() + newAnchor.getX() + 'px';
		}
		anchor = newAnchor;
	};

	/**
	 * Sets the coordinate for this window overlay.
	 * 
	 * @param {IWCoordinate}
	 *            coordinate
	 * @return {void}
	 */
	this.setCoordinate = function(newCoordinate)
	{
		// logger.info('Calling setCoordinate with ' + newCoordinate);

		iw.strict( [ IWCoordinate ], [ newCoordinate ]);
		coordinate = newCoordinate;
	};

	/**
	 * Returns the coordinate for this window overlay.
	 * 
	 * @return {IWCoordinate}
	 */
	this.getCoordinate = function()
	{
		return coordinate;
	};

	/**
	 * Destroys the window overlay.
	 * 
	 * Releases all DOM references and event listeners.
	 * 
	 * @return {void}
	 */
	this.destroyWindowOverlay = function()
	{
		// logger.info('Calling destroyWindowOverlay.');

		IWEventManager.removeListener(afterCenteredListener);
		IWEventManager.removeListener(beforeZoomListener);
		IWEventManager.removeListener(afterZoomedListener);
		IWEventManager.removeListener(afterResizedListener);

		this.destroyMapElement();
	};

	/**
	 * Redraws the window overlay.
	 * 
	 * Calculates and sets the new pixel position where the window overlay appears on the map.
	 * 
	 * @return {void}
	 */
	this.redraw = function()
	{
		// logger.info('Calling redraw.');

		var container = this.getContainer();
		var parent = this.getParent();

		var pixel = map.getCurrentMapType().getProjection().meterToPixel(coordinate);

		container.style.top = pixel.getY() + anchor.getY() - parseInt(parent.style.top) + 'px';
		container.style.left = pixel.getX() + anchor.getX() - parseInt(parent.style.left) + 'px';
	};

	// ********************************************************************
	// * Constructor implementation
	// ********************************************************************

	var afterCenteredListener = IWEventManager.addListener(map, 'oncenter', function(e)
	{
		self.setVisible(false);
		self.redraw();
		self.setVisible(true);
	});

	var beforeZoomListener = IWEventManager.addListener(map, 'onzoomstart', function()
	{
		self.setVisible(false);
	});

	var afterZoomedListener = IWEventManager.addListener(map, 'onzoomend', function()
	{
		self.redraw();
		self.setVisible(true);
	});

	var afterResizedListener = IWEventManager.addListener(map, 'onresize', function()
	{
		self.redraw();
	});
}
function IWWindowOverlayGS(map, coordinate, content) {
	//********************************************************************
	// * Private attributes
	// ********************************************************************
	var _this = this;
	var _map = map;
	// var _size = new IWSize(256,154);
	var _size = new IWSize(268, 157);

	var _border = 3;
	var _content = content;
	var _centered = false;

	// first we call the superclass constructor
	IWWindowOverlay.call(this, map, coordinate);

	function beforeAppend() {
		if (!_centered) {
			var position = _map.getCurrentMapType().getProjection().meterToPixel(_this.getCoordinate());
			var offsetRight = position.getX() + _size.getWidth() + _border - _map.getOptions().getSize().getWidth();
			var offsetLeft = position.getX() - _border;
			var offsetTop = position.getY() - _border;
			var offsetBottom = position.getY() + _size.getHeight() + _border - _map.getOptions().getSize().getHeight();
			if (offsetRight > 0 || offsetLeft < 0 || offsetTop < 0 || offsetBottom > 0) {
				var x = 0;
				var y = 0;

				if (offsetRight > 0) {
					x = -offsetRight;
				} else if (offsetLeft < 0) {
					x = -offsetLeft;
				}

				if (offsetTop < 0) {
					y = -offsetTop;
				} else if (offsetBottom > 0) {
					y = -offsetBottom;
				}
				var diff = new IWPoint(x, y);
				var newCoord = _map.getCurrentMapType().getProjection().pixelToMeter(position.add(diff));
				_this.setCoordinate(newCoord);
			}
		}
	}
	;

	this.setSize = function(size) {
		_size = size;
		_container.style.width = _size.getWidth() + 'px';
		_container.style.height = _size.getHeight() + 'px';

		if (_centered)
			centerPosition();
	};

	this.setCentered = function(centered) {
		if (!_centered && centered)
			centerPosition();

		_centered = centered;
	};

	this.isCentered = function() {
		return _centered;
	};

	function centerPosition() {
		var mapSize = _map.getOptions().getSize();
		var left = Math.max(0, (mapSize.getWidth() - _size.getWidth()) / 2);
		var top = Math.max(0, (mapSize.getHeight() - _size.getHeight()) / 2);
		var coord = _map.getCurrentMapType().getProjection().pixelToMeter(new IWPoint(left, top));
		_this.setCoordinate(coord);
	}
	

	/*var coverage = '<div id="tooltipcontent" name="tooltipcontent">'
			+'<div id="tooltipp-5" class="gelb">'
			  	+'<table border="0" cellpadding="0" cellspacing="0" class="tt_gross">'
			  	   +'<tr>'
				    +'<td width="12"><img src="img/poiContent/px_trans.gif" width="12" height="1" /></td>'
				    +'<td width="3"><img src="img/poiContent/px_trans.gif" width="3" height="1" /></td>'
				    +'<td width="800"><img src="img/poiContent/px_trans.gif" width="3" height="1" /></td>'
				    +'<td width="3"><img src="img/poiContent/px_trans.gif" width="3" height="1" /></td>'
				    +'<td width="3"><img src="img/poiContent/px_trans.gif" width="3" height="1" /></td>'
			  	+'</tr>'
				+'<tr>'
					+'<td colspan="2" width="15" class="tt_frm_linksoben"><img src="img/poiContent/px_trans.gif" width="15" height="6" /></td>'
					+'<td class="tt_frm_oben"><img src="img/poiContent/px_trans.gif" width="1" height="1" /></td>'
					+'<td colspan="2" width="6" class="tt_frm_rechtsoben"><img src="img/poiContent/px_trans.gif" width="6" height="6" /></td>'
				+'</tr>'
			  	+'<tr>'
			  		+'<td class="tt_frm_links"><img src="img/poiContent/blank.gif" width="1" height="1" /></td>'
			  		+'<td colspan="3" style="background-color:#FFF; width:99%">'
			  			+'<div class="tt_balken">'
			  				+'<div class="headline">${name}</div>'
			  				+'<div class="close"><a href="#" onclick="removePopups()">'
				                  +'<img border="0" src="img/marInfoballon/close.png" /></a>'
				                  +'</div>'
			          		+'</div>'
							+'<div class="tt_content_gross2">'	
								+'<div id="uebersicht" class="tt_content_gross">'
									+'<div class="entryContainer">'
										+_content
									+'</div>'
								+'</div>'
							+'</div>'
			  		+'</td>'
			  		+'<td class="tt_frm_rechts"><img src="img/poiContent/blank.gif" width="1" height="1" /></td>'
			  	+'</tr>'
				+'<tr>'
					+'<td colspan="2"><img src="img/poiContent/lu_gross.gif" width="15" height="6" /></td>'
					+'<td class="tt_frm_unten_gross"><img src="img/poiContent/px_trans.gif" width="1" height="1" /></td>'
					+'<td colspan="2"><img src="img/poiContent/ru_gross.gif" width="6" height="6" /></td>'
			   +'</tr>'
			 +' </table>'
			+'</div>'
		+'</div>';*/
	
	var _container = this.getContainer();
	_container.style.position = 'absolute';
	_container.style.top = '0px';
	_container.style.left = '0px';
	_container.innerHTML = _content;
	
	var cl ='<div class="close"><a href="#" onclick="removePopups();">'
				+' <img border="0" src="'+appUrl+appName+'img/marInfoballon/close.png" /></a>'
			+'</div> ';
	_container.innerHTML =_container.innerHTML +cl;
	
	this.setSize(_size);

	// and the default anchor for this overlay
	this.setAnchor(new IWPoint(0, 0));
	// beforeAppend();

	IWEventManager.addListener(this, 'beforeredraw', function(e) {
		if (_centered)
			centerPosition();
	});
}function MarInfoCoordinateBallon(map, pixelCoordinate,sticky) {

	var self = this;
	var _size = new IWSize(200, 30);	
	var _border = 5;
	
	var divContOuter ;
	var hgImg= document.createElement('img');
	var p = document.createElement('input');	
	var width;	
	var _divMain = iw.create('div');	
	var _imgClose = null;
	var logger = log4javascript.getLogger('MarInfoCoordinateBallon');
	var parTopOff=4;
	var parLeftOff=5;	
	
	var maptype = map.getCurrentMapType();
	var projection = maptype.getProjection();
	var coordinate = projection.pixelToMeter(pixelCoordinate);			
	var cont = getMouseCoord(coordinate);	
	var _content = cont;
	var isActiv = false;
	
	IWMarWindowOverlay.call(this, map, coordinate);
	
	this.getContent = function() {
		return _content;
	};
	this.update= function(pixelCoordinate){
		var maptype = map.getCurrentMapType();
		var projection = maptype.getProjection();
		var coordinate = projection.pixelToMeter(pixelCoordinate);			
		var cont = getMouseCoord(coordinate);	
		this.setCoordinate(coordinate);					
		this.setContent(cont);
		this.redraw();
	};
	this.setContent = function(newContent) {		
		p.value =  newContent;
		divContOuter.style.backgroundColor='';
		this.updateSize();		
	};
	
	this.getWidth = function() {	
		return width;
	};
	this.getHeight = function() {	
		return _size.getHeight();
	};
	this.updateSize= function() {
		var wParagr=divContOuter.offsetWidth;	
		var wImageClose=0;
		if(_imgClose !=null){			
			wImageClose=11;	
		}
		width = wParagr+wImageClose+parLeftOff*2;
		hgImg.style.width=width+'px';
		hgImg.style.height=_size.getHeight()+'px';				
		this.setAnchor(new IWPoint(0, -(_size.getHeight())));
		_size=new IWSize(width, _size.getHeight());
	};
	function getMouseCoord(mouseCoordinate){
		var coordWgs = mouseCoordinate.toWGS84();
		var p = 1000000;
		var x = Math.round(coordWgs.getX()*p)/p;
		var y = Math.round(coordWgs.getY()*p)/p;		
		var cont = y+" / "+x;	
		return cont;
	}	
	
	IWEventManager.addListener(map, 'onmove',function (event)   {
		_container.style.left = parseInt(_container.style.left)+event.offsetX + 'px';
		_container.style.top = parseInt(_container.style.top)+event.offsetY + 'px';
		
	});
	/**
	 * We use the callback method for positioning the map and displaying the info balloon.
	 * 
	 * @return {void}
	 */
	this.afterAppend = function() {			
		logger.info('Calling afterAppend.');
		this.updateSize();		
		_container.style.visibility = 'visible';		
	};
	
	this.getSize = function() {
		return _size;
	};	
	
	this.destroy = function() {
		logger.info('Calling destroy');
		IWEventManager.clearInstanceListeners(this);	
		this.destroyMultiLanguageSupport();
		this.destroyWindowOverlay();
		_content = null;
		_divMain = null;			
		_imgClose = null;
		_container = null;
	};
	
	this.toString = function() {
		return '['+_container.id+']';
	};
	
	function buildGUI() {
		logger.debug('Calling buildGUI');
		_container.style.visibility = 'hidden';
		
		var imgSrc = appUrl+'/'+appName+"img/marInfoCoordinateBallon/coordPane.png" ;			      
        p.className='coordParagr';	
        p.id='coordText';
        p.value =  _content;
        p.readOnly=true;      
		_divMain= document.createElement('div');
		hgImg.src=imgSrc;
		
		iw.append(_divMain, hgImg);	
		divContOuter = document.createElement('div');	
		divContOuter.id='divContOuter';
		divContOuter.style.whiteSpace='nowrap';
		divContOuter.style.position='absolute';
		divContOuter.style.top=parTopOff+'px';
		divContOuter.style.left=parLeftOff+'px';		
		iw.append(divContOuter, p);	
		iw.append(_divMain, divContOuter);	
				
		if(sticky && sticky ==true)	{		
			_imgClose = document.createElement('img');			
			_imgClose.src = appUrl+'/'+appName+"img/marInfoCoordinateBallon/close_11.png";
			with (_imgClose.style) {
				position = 'absolute';
				top = '6px';
				right = '5px';
				cursor = 'pointer';
			}
			_divMain.appendChild(_imgClose);
			_imgClose.onclick = function() {
				map.removeWindowOverlay(self);
				self=null;
			};
		}
		iw.append(_container, _divMain);

	}	
	
	var _container = this.getContainer();
	_container.id = 'MarInfoCoordinateBallon';
	buildGUI();
	
}
/* Creates a new slider control.
 *
 * @class A control element which allows the user to zoom in and out the map
 *
 * @constructor
 * @extends IWControl
 *
 * @param {IWMap} map the map
 *
 * @author JAN, KUN
 */
function MarSliderControl(map) {
	IWControl.call(this, map, 'MarSliderControl');

	// ********************************************************************
	// * Private attributes
	// ********************************************************************

	var self = this;
	var lowValue = map.getCurrentMapType().getMinLevel();
	var highValue = map.getCurrentMapType().getMaxLevel();
	var offsetX = 23;
	var offsetY = 18;
	var maxSlide = 161 - offsetY;
	var currentZoom = map.getZoom();
	var mouseAdapter = new IWMouseAdapter();
	var container = this.getContainer();
	var logger = log4javascript.getLogger('MarSliderControl');
	var mouseWheelAdapter = new IWMouseWheelAdapter(map,container);
	var timeoutWheel = null;

	// ********************************************************************
	// * GUI elements
	// ********************************************************************

	var divSliderButton = null;
	var areaPlus = null;
	var areaMinus = null;

	// ********************************************************************
	// * Setup for multi language support
	// ********************************************************************

	var pack = new IWLanguagePack();
	pack.addLanguage(new IWLanguage('de', iwconst.LOCAL_APP_URL + 'lang/IWSliderControl.lang.de'));
	pack.addLanguage(new IWLanguage('en', iwconst.LOCAL_APP_URL + 'lang/IWSliderControl.lang.en'));
	pack.addLanguage(new IWLanguage('es', iwconst.LOCAL_APP_URL + 'lang/IWSliderControl.lang.es'));
	pack.addLanguage(new IWLanguage('tr', iwconst.LOCAL_APP_URL + 'lang/IWSliderControl.lang.tr'));
	pack.addLanguage(new IWLanguage('fr', iwconst.LOCAL_APP_URL + 'lang/IWSliderControl.lang.fr'));
	pack.addLanguage(new IWLanguage('it', iwconst.LOCAL_APP_URL + 'lang/IWSliderControl.lang.it'));

	IWMultiLanguageSupport.call(this, map, pack);

	// ********************************************************************
	// * Public methods
	// ********************************************************************

	function caluclateValueFromPixel(pixelTop) {
		var rangePercent = (pixelTop - offsetY) / maxSlide;
		var scaleRange = highValue - lowValue;
		return highValue - (scaleRange * rangePercent);
	}

	/**
	 * Returns the current value of the slider
	 * @return {int} the current value of the slider
	 */
	this.getValue = function(round) {
		// logger.info('Calling getValue');

		// TODO: Hier nicht runden...
		if (typeof (round) == 'undefined') {
			round = true;
		}

		var value = caluclateValueFromPixel(parseInt(divSliderButton.style.top));

		// logger.debug('getValue: ' + value);

		if (round) {
			return Math.round(value);
		} else {
			return value;
		}
	};

	/**
	 * Sets the position of the slider
	 * 
	 * @param {int}
	 *            value The value the slider shall represent
	 * @return {void}
	 */
	this.setValue = function(value) {
		// logger.info('Calling setValue with ' + value);

		if (typeof (value) == 'string') {
			value = parseInt(value);
		}

		//********************************************************************
		// * Set within min/max bounds
		// ********************************************************************

		var currentMapType = map.getCurrentMapType();
		var maxLevel = currentMapType.getMaxLevel();
		var minLevel = currentMapType.getMinLevel();
		var rangeValue;

		if (value < minLevel) {
			rangeValue = minLevel;
		} else if (value > maxLevel) {
			rangeValue = maxLevel;
		} else {
			rangeValue = value;
		}

		//********************************************************************
		// * Moves button to calculated position
		// ********************************************************************

		var value = rangeValue - minLevel;
		var scaleRange = maxLevel - minLevel;
		var rangePercent = maxSlide / scaleRange;

		divSliderButton.style.top = offsetY + (maxSlide - rangePercent * value) + 'px';

		// logger.debug('Slider button top is ' + divSliderButton.style.top);
	};

	/**
	 * @return {void}
	 */
	this.afterAppend = function() {
		buildGUI();
		this.setValue(map.getZoom());

		// ********************************************************************
		// * Loads the language pack for the control
		// ********************************************************************

		this.loadLanguagePack(map.getOptions().getLanguage());
	};

	/**
	 * Returns a string representation of this slider control.
	 * 
	 * @return {String}
	 */
	this.toString = function() {
		return '[IWSliderControl]';
	};

	// ********************************************************************
	// * Private methods
	// ********************************************************************

	/**
	 * Creates the GUI for the slider control.
	 * 
	 * @private
	 * @return void
	 */
	function buildGUI() {
		//********************************************************************
		// * Creates the image map for slider background.
		// * Workaround for an IE bug: IE does not recognize changes of the
		// * name property of dynamically created elements, so the slider has
		// * to be created with the special MS syntax of createElement().
		// ********************************************************************

		var mapSlider = null;
		try {
			mapSlider = iw.create('<map name="mapSlider">');
		} catch (e) {
			mapSlider = iw.create('map');
			mapSlider.name = 'mapSlider';
		}
		iw.append(container, mapSlider);

		areaPlus = iw.create('area');
		iw.append(mapSlider, areaPlus);

		self.addLabelFor(new IWLabel('ZOOM_IN', areaPlus, 'alt'));
		self.addLabelFor(new IWLabel('ZOOM_IN', areaPlus, 'title'));

		areaPlus.shape = 'rect';
		areaPlus.coords = '8,1,45,20';
		areaPlus.style.cursor = 'pointer';

		IWEventManager.addDomListener(areaPlus, 'onmousedown', function() {
			var maxLevel = map.getCurrentMapType().getMaxLevel();
			currentZoom = map.getZoom();

				if (currentZoom < maxLevel) {
					var event = new IWZoomEvent();
					event.newZoomLevel = currentZoom + 1;
					event.newCenter = map.getCenter();

					map.triggerOnZoomStart(event);

					if (map.zoomIn()) {
						self.setValue(currentZoom + 1);
					}
				}
			});

		areaMinus = iw.create('area');
		iw.append(mapSlider, areaMinus);

		self.addLabelFor(new IWLabel('ZOOM_OUT', areaMinus, 'alt'));
		self.addLabelFor(new IWLabel('ZOOM_OUT', areaMinus, 'title'));

		areaMinus.shape = 'rect';
		areaMinus.coords = '8,193,45,218';
		areaMinus.style.cursor = 'pointer';

		IWEventManager.addDomListener(areaMinus, 'onmousedown', function() {
			var minLevel = map.getCurrentMapType().getMinLevel();
			currentZoom = map.getZoom();
				if (currentZoom > minLevel) {
					var event = new IWZoomEvent();
					event.newZoomLevel = currentZoom - 1;
					event.newCenter = map.getCenter();

					map.triggerOnZoomStart(event);

					if (map.zoomOut()) {
						self.setValue(currentZoom - 1);
					}
				}
			});

		var areaPanel = iw.create('area');
		iw.append(mapSlider, areaPanel);

		areaPanel.shape = 'rect';
		areaPanel.coords = '20,21,35,218';
		areaPanel.style.cursor = 'pointer';

		IWEventManager.addDomListener(areaPanel, 'onmousedown', function(event) {
			if (!event) {
				event = window.event;
			}
			var mouseEvent = mouseAdapter.toMouseEvent(event, container);
			var y = mouseEvent.position.getY() - 20;

			if (y >= 0 && y <= 170) {
				var event = new IWZoomEvent();
				event.newZoomLevel = Math.min(Math.round(caluclateValueFromPixel(y), map.getCurrentMapType().getMaxLevel()));
				event.newCenter = map.getCenter();
				map.triggerOnZoomStart(event);

				map.zoom(map.getZoom(), event.newZoomLevel);
			}
		});

		var imgSlider = iw.create('img');
		iw.append(container, imgSlider);

		imgSlider.useMap = '#mapSlider';
		imgSlider.onload = function() {
			correctPNG(this);
		}.iwclosure(imgSlider);
		imgSlider.src = appUrl+'/'+appName+'img/slider_mar.png';
		imgSlider.width = '58';
		imgSlider.height = '218';
		imgSlider.border = '0';

		divSliderButton = iw.create('div');
		iw.append(container, divSliderButton);

		divSliderButton.style.position = 'absolute';
		divSliderButton.style.left = offsetX + 'px';
		divSliderButton.style.top = offsetY + 'px';
		divSliderButton.style.width = '13px';
		divSliderButton.style.height = '35px';
		divSliderButton.style.cursor = 'pointer';

		var imgButton = iw.create('img');
		iw.append(divSliderButton, imgButton);

		imgButton.src = iwconst.GLOBAL_APP_URL + 'img/controls/slider/slider_button.png';
		imgButton.style.width = '13px';
		imgButton.style.height = '35px';

		IWEventManager.addDomListener(divSliderButton, 'onmousedown', function(event) {
			if (!event) {
				event = window.event;
			}

			if (event.cancelable) {
				event.preventDefault();
			}
			event.cancelBubble = false;
			event.returnValue = false;

			var mouseEvent = mouseAdapter.toMouseEvent(event, container);

			if (mouseEvent.button != IWButton.LEFT) {
				return;
			}

			IWEventManager.trigger(map, 'onzoomstart', null);

			limitHigh = offsetY;
			limitLow = maxSlide + offsetY;

			var oldPosY = mouseEvent.position.getY();

			var onMouseMoveListener = IWEventManager.addListener(document.body, 'onmousemove', function(event) {
				if (!event) {
					event = window.event;
				}

				var mouseEvent = mouseAdapter.toMouseEvent(event, container);
				var mouseOffsetY = mouseEvent.offset.getY();

				if (event.cancelable) {
					event.preventDefault();
				}
				event.cancelBubble = false;
				event.returnValue = false;

				var y = Math.min(Math.max(parseInt(divSliderButton.style.top) + mouseOffsetY, limitHigh), limitLow);

					var oldValue = self.getValue();
					divSliderButton.style.top = y + 'px';

					var newValue = self.getValue();

					if (oldValue != newValue) {
					map.opticalZoom(oldValue, newValue);
				}
			});

			var onMouseUpListener = IWEventManager.addListener(document.body, 'onmouseup', function(event) {
					map.zoom(self.getValue(), self.getValue());
					IWEventManager.removeListener(onMouseMoveListener);
					IWEventManager.removeListener(onMouseUpListener);
				});
		});
	}

	container.id = 'IWSliderControl';
	container.style.width = '58px';
	container.style.height = '218px';

	IWEventManager.addListener(mouseWheelAdapter, 'onmousewheel', function(event) {
		if (map.getOptions().getMouseWheelAction() != IWMapOptions.CONTROL_ZOOM) {
			return;
		}

		if (timeoutWheel == null) {
			currentZoom = map.getZoom();
			var zoomEvent = new IWZoomEvent();
			map.triggerOnZoomStart(zoomEvent);
		} else {
			window.clearTimeout(timeoutWheel);
		}

		timeoutWheel = window.setTimeout( function() {
			
				map.zoom(currentZoom, currentZoom);
				timeoutWheel = null;

			}, 500);

		var zoomEvent = new IWZoomEvent();
		zoomEvent.oldZoomLevel = currentZoom;

		var currentMapType = map.getCurrentMapType();
		currentZoom = currentZoom + event.delta;

		if (currentZoom > currentMapType.getMaxLevel()) {
			currentZoom = currentMapType.getMaxLevel();
		}
		if (currentZoom < currentMapType.getMinLevel()) {
			currentZoom = currentMapType.getMinLevel();
		}

		zoomEvent.newZoomLevel = currentZoom;

		self.setValue(currentZoom);

		map.triggerOnZoom(zoomEvent);
		map.opticalZoom(zoomEvent.oldZoomLevel, zoomEvent.newZoomLevel);
	});

	IWEventManager.addListener(map, 'onzoom', function(event) {
		// Nur optimisches Verschieben des Buttons
			self.setValue(event.newZoomLevel);
		});

	IWEventManager.addListener(map, 'onzoomend', function(event) {
		// Nur optimisches Verschieben des Buttons
			self.setValue(event.newZoomLevel);
		});

	IWEventManager.addListener(map, 'oncenter', function(event) {
		self.setValue(map.getZoom());
	});

	IWEventManager.addListener(map, 'onmaptypechange', function(event) {
		lowValue = map.getCurrentMapType().getMinLevel();
		highValue = map.getCurrentMapType().getMaxLevel();
		self.setValue(map.getZoom());
	});
}
function MarMenuControl(map)
{
	
	IWControl.call(this, map, 'MarMenuControl');

	var self = this;
	var items = new Object();
	var panels = new Object();
	var roots = new Array();
	var container = this.getContainer();
	var leftPosition = 0;
	var hidetimer=null;
	var showtimer=null;

	this.addWrapper = function(item){
		var ul = document.createElement('ul');
		if(item ==null){
			ul.id="wr_root";
			iw.append(container, ul);
		}
		else{
			ul.id="wr_"+item.getNode().id;
			iw.append(item.getNode(), ul);
		}
		
	};
	
	this.addPanel = function(item){
		panels[item.getName()] = item;
		var event = new MarMenuEvent();
		event.item = item;

		this.triggerOnAppendStart(event);
		var node = event.item.getNode();
		node.id = "panel_"+item.getName();
		iw.append(container, node);
	};
	/**
	 * Adds a new item to the toolbar.
	 * 
	 * @param {IWToolbarItem}
	 *            item
	 * @return {void}
	 */
	this.addItem = function(parentItem,item)
	{
		items[item.getName()] = item;
		if(parentItem == null){
			roots[roots.length] = item;			
		}
		item.setParentItem(parentItem);
		if(parentItem !=null){
			parentItem.addChild(item);
		}
		
		var event = new MarMenuEvent();
		event.item = item;

		this.triggerOnAppendStart(event);

		var node = event.item.getNode();
		if (node == null){
			throw 'MarMenuControl.addItem failed. The item.getNode() returns null.';
		}
		
		if(parentItem ==null){	
			var ci = container.childNodes;
			for (var i = 0; i < ci.length; i++){
				if(ci[i].id=="wr_root"){
					iw.append(ci[i], node);
					break;
				}
			}
		}
		else{	
			var ci = parentItem.getNode().childNodes;
			for (var i = 0; i < ci.length; i++){
				if(ci[i].id=="wr_"+parentItem.getNode().id){
					iw.append(ci[i], node);
					break;
				}
			}
		}
		this.triggerOnAppendEnd(event);

		IWEventManager.addDomListener(node, 'onclick', function(e){
			if (!e) var e = window.event;
				e.cancelBubble = true;
			if (e.stopPropagation) e.stopPropagation();
			var event = new MarMenuEvent();
			event.item = item;
			self.triggerOnClick(event);
		}.iwclosure(item));

		IWEventManager.addDomListener(node, 'onmouseover', function(e){
			if (!e) var e = window.event;
				e.cancelBubble = true;
			if (e.stopPropagation) e.stopPropagation();

			var event = new MarMenuEvent();
			event.item = item;
			self.triggerOnMouseOver(event);
		}.iwclosure(item));

		IWEventManager.addDomListener(node, 'onmouseout', function(e){
	  		if (!e) var e = window.event;
				e.cancelBubble = true;
			if (e.stopPropagation) e.stopPropagation();
			var event = new MarMenuEvent();
			event.item = item;
			self.triggerOnMouseOut(event);
		}.iwclosure(item));
		
	};

	/**
	 * Removes the specific item from the toolbar.
	 * 
	 * @param {IWToolbarItem}
	 *            item
	 * @return {void}
	 */
	this.removeItem = function(item)
	{
		if (item != null && items[item.getName()])
		{
			// get the DOM node from the toolbar item...
			var node = item.getNode();

			// and decrement the width of the container and the left offset
			var width = parseInt(node.style.width);
			container.style.width = parseInt(container.style.width) - width + 'px';
			leftPosition = leftPosition - width;

			// replace all right neighbors...
			var neighbor = node.nextSibling;
			while (neighbor)
			{
				neighbor.style.left = parseInt(neighbor.style.left) - width + 'px';
				neighbor = neighbor.nextSibling;
			}

			// clear the item reference and ...
			items[item.getName()] = null;
			// remove the node from the DOM
			iw.remove(node);

			// create a toolbar event and trigger it
			var event = new IWToolbarEvent();
			event.item = item;
			this.triggerOnRemove(event);
		}
	};

	this.getItem = function(name){
		return items[name];
	};
	this.getPanel = function(name){
		return panels[name];
	};

	this.toString = function(){
		return '[MarMenuControl]';
	};

	/**
	 * The <tt>onMouseOver</tt> event is fired when the mouse pointer is over a toolbar item.
	 * 
	 * <p>
	 * Register an event listener with
	 * <tt>IWEventManager.addListener(toolbarObject, 'onmouseover', yourHandlerMethod(event));</tt> to receive the
	 * <tt>IWToolbarEvent</tt>.
	 * </p>
	 * 
	 * @event onMouseOver
	 * @param {IWToolbarEvent}
	 *            event the toolbar event
	 * @return {void}
	 */
	this.triggerOnMouseOver = function(event)
	{
		IWEventManager.trigger(this, 'onmouseover', event);
	};

	/**
	 * The <tt>onMouseOut</tt> event is fired when the mouse pointer leaves a toolbar item.
	 * 
	 * <p>
	 * Register an event listener with
	 * <tt>IWEventManager.addListener(toolbarObject, 'onmouseout', yourHandlerMethod(event));</tt> to receive the
	 * <tt>IWToolbarEvent</tt>.
	 * </p>
	 * 
	 * @event onMouseOut
	 * @param {IWToolbarEvent}
	 *            event the toolbar event
	 * @return {void}
	 */
	this.triggerOnMouseOut = function(event)
	{
		IWEventManager.trigger(this, 'onmouseout', event);
	};

	/**
	 * The <tt>onClick</tt> event is fired when a toolbar item is clicked.
	 * 
	 * <p>
	 * Register an event listener with
	 * <tt>IWEventManager.addListener(toolbarObject, 'onclick', yourHandlerMethod(event));</tt> to receive the
	 * <tt>IWToolbarEvent</tt>.
	 * </p>
	 * 
	 * @event onClick
	 * @param {IWToolbarEvent}
	 *            event the toolbar event
	 * @return {void}
	 */
	this.triggerOnClick = function(event)
	{
		IWEventManager.trigger(this, 'onclick', event);
	};

	/**
	 * The <tt>onAppendStart</tt> event is fired before a toolbar item is appended to the toolbar control.
	 * 
	 * <p>
	 * Register an event listener with
	 * <tt>IWEventManager.addListener(toolbarObject, 'onappendstart', yourHandlerMethod(event));</tt> to receive the
	 * <tt>IWToolbarEvent</tt>.
	 * </p>
	 * 
	 * @event onAppendStart
	 * @param {IWToolbarEvent}
	 *            event the toolbar event
	 * @return {void}
	 */
	this.triggerOnAppendStart = function(event)
	{
		IWEventManager.trigger(this, 'onappendstart', event);
	};

	/**
	 * The <tt>onAppendEnd</tt> event is fired after a toolbar item has been appended to the toolbar control.
	 * 
	 * <p>
	 * Register an event listener with
	 * <tt>IWEventManager.addListener(toolbarObject, 'onappendend', yourHandlerMethod(event));</tt> to receive the
	 * <tt>IWToolbarEvent</tt>.
	 * </p>
	 * 
	 * @event onAppendEnd
	 * @param {IWToolbarEvent}
	 *            event the toolbar event
	 * @return {void}
	 */
	this.triggerOnAppendEnd = function(event)
	{
		IWEventManager.trigger(this, 'onappendend', event);
	};

	/**
	 * The <tt>onRemove</tt> event is fired after the item has been removed from the toolbar.
	 * 
	 * <p>
	 * Register an event listener with
	 * <tt>IWEventManager.addListener(toolbarObject, 'onremove', yourHandlerMethod(event));</tt> to receive the
	 * <tt>IWToolbarEvent</tt>.
	 * </p>
	 * 
	 * @event onRemove
	 * @param {IWToolbarEvent}
	 *            event the toolbar event
	 * @return {void}
	 */
	this.triggerOnRemove = function(event)
	{
		IWEventManager.trigger(this, 'onremove', event);
	};
	this.menu_collapse =function(item) {
		hidetimer = setTimeout(function () {
			item.menu_collapse();
		},100);
		
	};
	this.menu_expand = function(item){	
		
		if(hidetimer!=undefined && hidetimer!=null){
			clearTimeout(hidetimer);
			hidetimer = null;			
		}
		if(showtimer!=undefined && showtimer!=null){
			clearTimeout(showtimer);
			showtimer = null;			
		}		
		showtimer = setTimeout(function () {
			if(item.getParentItem()==null){
				for(var i=0;i< roots.length;i++){
					var rootItem = roots[i];
					rootItem.menu_collapse();
				}
			}
			item.menu_expand();
		},100);
	};
	
	// ********************************************************************
	// * Private functions
	// ********************************************************************

	function buildGUI(){	
		container.id = 'MarMenuControl';
		//container.style.position = 'absolute';
		//container.style.height = '0px';
		//container.style.width = '0px';
	}
	buildGUI();
}


function MarMenuItem(name,text)
{
	var node = null;
	var clicked = false;
	var enabled = true;
	var parentItem =null;
	var children = new Array();
	var link = null;
	
	
	this.getName = function(){
		return name;
	};
	
	this.getText = function(){
		return text;
	};
	this.getNode = function(){
		return node;
	};

	this.setNode = function(newNode){
		node = newNode;
	};
	this.getLink = function(){
		return link;
	};

	this.setLink = function(newLink){
		link = newLink;
	};
	this.getParentItem = function(){
		return parentItem;
	};

	this.setParentItem = function(pItem){
		parentItem = pItem;
	};
	this.addChild= function(c){
		children[children.length]=c;
	};
	this.getChildren= function(){
		return children;
	};
	this.toString = function()
	{
		return '[MarMenuItem] name: ' + name;
	};
	this.menu_collapse =function() {		
		
		var root= null;
		if(parentItem !=null){
			root = parentItem;			
			while(root.getParentItem() != null){
				root = root.getParentItem();
			}			
			hideChilds(root);
		}
		else{
			for(var i=0;i< children.length;i++){
				hideChilds(children[i]);
				children[i].getNode().style.display="none";
			}
		}		
	};	
	this.menu_expand = function(){		
		if(parentItem != null){
			hideSiblingChilds(parentItem);
			parentItem.getNode().style.display="block";
		}
		for(var i=0;i< children.length;i++){
			children[i].getNode().style.display="block";
		}
	};
	function hideChilds(parentNode){
		
		var c = parentNode.getChildren();
		for(var i=0;i< c.length;i++){
			hideChilds(c[i]);
			c[i].getNode().style.display="none";
			
		}
	}
	function hideSiblingChilds(parentNode){
		var c = parentNode.getChildren();
		for(var i=0;i< c.length;i++){			
			hideChilds(c[i]);
		}
	}
}
function MarMenuEvent(){

	this.item = null;
	this.toString = function(){
		return '[MarMenuEvent]\u0020' + (this.item != null ? this.item.getName() : '');
	};
}
function createMenu(map) {
	this.tb = new MarMenuControl(map);
	var toolbar = this.tb;
	toolbar.setRedrawable(true);
	
	var pushpin = new MarMenuItem('pushpin',"");
	var views = new MarMenuItem('views',"Ansichten");
	var rootBing = new MarMenuItem('rootBing',"Karte");
	var bingBing = new MarMenuItem('bingBing',"Bing-Karte");
	var bingPrem = new MarMenuItem('bingPrem',"Premium-Karte");	
	var rootLuft = new MarMenuItem('rootLuft',"Luftbild");
	var hybrid = new MarMenuItem('hybrid',"Luftbild mit Labels");
	var luft = new MarMenuItem('luft',"Luftbild");	
	var birdsview = new MarMenuItem('birdsview',"Schr\u00E4gansicht");
	var osm = new MarMenuItem('osm',"OpenStreetMap");
	
	var karteninfo = new MarMenuItem('karteninfo',"Karteninfo");
	var search = new MarMenuItem('search',"POI");	
	var traffic = new MarMenuItem('traffic',"Verkehr");
	var route = new MarMenuItem('menuRoute',"Route");
	var move = new MarMenuItem('move',"Move");
	var zoom = new MarMenuItem('zoom',"Zoom");
	var tools = new MarMenuItem('tools',"Tools");
	var measure = new MarMenuItem('measure',"Entfernung");	
	var print = new MarMenuItem('print',"Drucken");	
	var coord = new MarMenuItem('coord',"Koordinate");

	IWEventManager.addListener(toolbar, 'onappendstart', function(e) {	
		if(e.item.getName()=='pushpin'){
			var d = document.createElement('div');			
			e.item.setNode(d);
		}
		else{
			var li = document.createElement('li');
			li.id=e.item.getName();				
			var a =  document.createElement('a');
			a.href ='#';
			a.innerHTML=e.item.getText();
			iw.append(li, a);
			e.item.setNode(li);
			e.item.setLink(a);
			preloadToolbarImages(e.item);
			if(e.item.getParentItem()!=null){
				e.item.getNode().style.display="none";
			}
		}
			
			e.item.getLink().className = e.item.classOutImage;
			e.item.enabled = true;
		
	});
	
	IWEventManager.addListener(toolbar, 'onmouseover', function(e) {
		formatOnMouseOver(e.item);
	});
	IWEventManager.addListener(toolbar, 'onmouseout', function(e) {
		formatOnMouseOut(e.item);
	});
	IWEventManager.addListener(toolbar, 'onclick', function(e) {
		handleToolbarEvent(e.item);
	});

	toolbar.addPanel(pushpin);
	toolbar.addWrapper(null);	
	toolbar.addItem(null,views);
	toolbar.addWrapper(views);
	toolbar.addItem(views,rootBing);
	toolbar.addWrapper(rootBing);
	toolbar.addItem(views,rootLuft);
	toolbar.addWrapper(rootLuft);
	toolbar.addItem(rootBing,bingBing);
	toolbar.addItem(rootBing,bingPrem);	
	toolbar.addItem(rootLuft,hybrid);
	toolbar.addItem(rootLuft,luft);
	toolbar.addItem(views,birdsview);
	toolbar.addItem(views,osm);		
	toolbar.addItem(null,karteninfo);
	toolbar.addWrapper(karteninfo);
	toolbar.addItem(karteninfo,traffic);
	toolbar.addItem(karteninfo,route);
	toolbar.addItem(karteninfo,search);	
	toolbar.addItem(null,tools);
	toolbar.addWrapper(tools);
	toolbar.addItem(tools,measure);
	toolbar.addItem(tools,print);
	toolbar.addItem(tools,coord);
	//toolbar.addItem(tools,move);
	//toolbar.addItem(tools,zoom);	
	
	return toolbar;
}

/**
 * Handles toolbar actions.
 *
 * @return {void}
 */
function handleToolbarEvent(item) {
	if (item.enabled == false)
		return;
	var copyright = map.getOptions().getApplicationCopyright();
	var zoom = map.getZoom();
	setImageClicked(item);
	
	if (map.getCurrentMapType().getName() == "birdsview") {
		zoom = typeSwitchZoom;
	}
	switch (item.getName()) {	
	case 'bingBing':		
		if(zoom > roadmap.getMaxLevel()) {
			zoom  =  parseInt(roadmap.getMaxLevel());
		}
		mapModus = 6;
		map.setCenter(map.getCenter(), zoom, roadmap);			
	break;
	case 'bingPrem':		
		if(zoom > roadmap.getMaxLevel()) {
			zoom  =  parseInt(roadmap.getMaxLevel());
		}			
		mapModus = 4;
		map.setCenter(map.getCenter(), zoom, roadmapPremium);
	break;
	case 'hybrid':		
		if(zoom > hybrid.getMaxLevel()) {
			zoom  =  parseInt(hybrid.getMaxLevel());
		}
		if(zoom < hybrid.getMinLevel()) {
			zoom  =  parseInt(hybrid.getMinLevel());
		}
		mapModus = 2;
		map.setCenter(map.getCenter(), zoom, hybrid);
	break;
	case 'luft':		
		if(zoom > air.getMaxLevel()) {
			zoom  =  parseInt(air.getMaxLevel());
		}
		if(zoom < air.getMinLevel()) {
			zoom  =  parseInt(air.getMinLevel());
		}
		mapModus = 1;				
		map.setCenter(map.getCenter(), zoom, air);
		break;

	case 'birdsview':
		if (map.getCurrentMapType().getName() != "birdsviewarea") {			
			mapModus = 3;
			typeSwitchZoom = map.getZoom();
			setBirdsView();
		}
	break;
	case 'osm':		
		if (map.getCurrentMapType() != mapTypeOsm) {
			mapModus = 5;
			map.setCenter(map.getCenter(), zoom, mapTypeOsm);
		}
	break;
	case 'search':	
		setTabsAktiv(tabs['tabPoi']);
		item.clicked =true;
		item.getNode().className = item.classClickedImage; 
        var item_route = menuControl.getItem("menuRoute");
        item_route.clicked =false;
        item_route.getNode().className = item_route.classOutImage;
	break;
	case 'traffic':
		tmcLayer.setVisible(!tmcLayer.isVisible());
		map.redraw();
		break;

	case 'menuRoute':
		setTabsAktiv(tabs['tabRoute']);
		item.clicked =true;
		item.getNode().className = item.classClickedImage; 
        var item_search = menuControl.getItem("search");
        item_search.clicked =false;
        item_search.getNode().className = item_search.classOutImage;
	break;
	case 'move':
		map.getOptions().setLeftMouseAction(IWMapOptions.CONTROL_MOVE);
		map.getOptions().setRightMouseAction(IWMapOptions.CONTROL_ZOOM);
		break;

	case 'zoom':
		map.getOptions().setLeftMouseAction(IWMapOptions.CONTROL_ZOOM);
		map.getOptions().setRightMouseAction(IWMapOptions.CONTROL_MOVE);
		break;

	case 'measure':
		if (measuringTool.getInfoWindow().isVisible()) {
			measuringTool.deactivate();
		} else {
			measuringTool.activate();
		}
		break;

	case 'print':		
		map.print('', '', {interactive:true});		
		break;
	case 'coord':
		if (item.enabled == true) { 
			item.clicked = !item.clicked;
			if(item.clicked){
				 item.getNode().className = item.classClickedImage;
			}
			else{
				item.getNode().className = item.classOutImage;
			}
        	setShowCoordEnabled(item.clicked );        
		}
		break;	
	}
}
function setImageClicked(item) {

        if (item.getName() == "bingBing" ||
        	item.getName() == "bingPrem" ||
            item.getName() == "luft" ||
            item.getName() == "hybrid" ||
            item.getName() == "birdsview"||
            item.getName() == "osm") {
            
            
            var item_roadmap = menuControl.getItem("bingPrem");
            if (item_roadmap)
            {
            	item_roadmap.getNode().className = item_roadmap.classOutImage;
            	item_roadmap.clicked = false;
            }
			var item_bing = menuControl.getItem("bingBing");
			if (item_bing)
			{
				item_bing.getNode().className = item_bing.classOutImage;
				item_bing.clicked = false;
			}
            var item_aerialview = menuControl.getItem("luft");
			if (item_aerialview)
			{
            	item_aerialview.getNode().className = item_aerialview.classOutImage;
            	item_aerialview.clicked = false;
			}
            var item_birdsview = menuControl.getItem("birdsview");
            if (item_birdsview)
            {
            	item_birdsview.getNode().className = item_birdsview.classOutImage;
            	item_birdsview.clicked = false;
            }
            var item_osm = menuControl.getItem("osm");
            if (item_osm)
            {
            	item_osm.getNode().className = item_osm.classOutImage;
            	item_osm.clicked = false;
            }
            item.getNode().className = item.classClickedImage;
            item.clicked = true;
        }
       
        if(item.getName()=="measure" && item.enabled == true){
        	
            if (!measuringTool.getInfoWindow().isVisible()) {
                item.getNode().className = item.classClickedImage;
                item.clicked = true;
               //  setImageEnabled("move",false);
               //  setImageEnabled("zoom",false) ;
            }
            else {
                item.getNode().className = item.classOutImage;
                item.clicked = false;
               //  setImageEnabled("move",true);
               //  setImageEnabled("zoom",true);
            }
        }
        if(item.getName() =="traffic" && item.enabled == true){
             if(tmcLayer.isVisible()  ){
                item.getNode().className = item.classClickedImage;
                item.clicked = true;
             }
            else{
                item.getNode().className = item.classOutImage;
                item.clicked = false; 
             }
        }
        
        if (item.getName() == "move" || item.getName() == "zoom") {

            if (item.enabled == true) {
                var item_move = menuControl.getItem("move");
                item_move.getNode().className = item_move.classOutImage;
                item_move.clicked = false;

                var item_zoom = menuControl.getItem("zoom");
                item_zoom.getNode().className = item_zoom.classOutImage;
                item_zoom.clicked = false;

                item.getNode().className= item.classClickedImage;
                item.clicked = true;
            }
        }
       
    }
/**
 * Eventhandler for onMouseOut events.
 *
 * This method is registered on 'onmouseout' events from the toolbox. If the event is catched we
 * change the url of the image.
 *
 * @return {void}
 */
function formatOnMouseOut(item) {	
	this.tb.menu_collapse(item);
	if(item.clicked == false)
	item.getNode().className = item.classOutImage;
}

function formatOnMouseOver(item) {	
	if (item.enabled == false)
		item.getNode().className = item.classDisabledImage;
	else if(item.clicked == false)
		item.getNode().className = item.classOutImage;
	this.tb.menu_expand(item);	
}

function preloadToolbarImages(item){
	item.classClickedImage = 'menuActiv';
	item.classDisabledImage ='menuDisabled';
	
	switch (item.getName()) {
		
	case 'views':
		item.classOutImage = 'view';
		break;
	case 'karteninfo':
		item.classOutImage = 'karteninfo';
		break;
	case 'tools':
		item.classOutImage = 'tools';
		break;
		
	case 'rootBing':
		item.classOutImage = 'rootBing';
		break;
	case 'bingBing':
		item.classOutImage = 'bingBing';
		break;
	case 'bingPrem':
		item.classOutImage = 'bingPrem';
		break;
	case 'rootLuft':
		item.classOutImage = 'rootLuft';
		break;
	case 'hybrid':
		item.classOutImage = 'hybrid';	
		break;
	case 'luft':
		item.classOutImage = 'luft';
		break;

	case 'birdsview':
		item.classOutImage = 'birdsview';
		break;
	case 'osm':
		item.classOutImage = 'osm';	
		break;
	case 'search':
		item.classOutImage = 'search';
		break;

	case 'traffic':
		item.classOutImage = 'traffic';
		break;
		
	case 'menuRoute':
		item.classOutImage = 'menuRoute';
		break;

	case 'move':
		item.classOutImage = 'move';
		break;

	case 'zoom':
		item.classOutImage = 'zoom';
		break;

	case 'measure':
		item.classOutImage = 'measure';	
		break;

	case 'print':
		item.classOutImage = 'print';	
		break;
	
	case 'pushpinTool':	
		var node = item.getNode();
		node.id = "pushpinToolNode";
		node.style.backgroundImage="url('"+appUrl+appName+"img/toolbar/blank_small.gif')";
		break;
		
	case 'coord':
		item.classOutImage = 'coord';
		break;
		
	}
}


	(function( $ ){
	var methods = {
	    init : function( options ){
	    	if(options){ 
	    		$.extend(settings, options);
	    	 }
	    	
	    	 function zeigeTooltip(evt,comp){
	    		 var title = comp.data('title');

	    		 $("<div>", {
		    		 id: "formtooltip",
		    		 css: {
		    			 position: "absolute",
		    			 left:comp.offset().left+comp.width(),
		    			 top: comp.offset().top,
		    			 background: settings.background,
		    			 display: "none",
		    			 zIndex : settings.zindex,
		    			 border: settings.border,
		    			 maxWidth: 200
		    		 },
		    		 html: "<p style='padding-left:5px;padding-right:5px '>"+toolTipContent[title]+"</p>"
	    		 })
	    		.appendTo("body")
	    		.fadeIn(200);
	    	}
	    	function adjustTop(){
	    		var h = $(window).height();
	    		if((parseInt($('#formtooltip').offset().top) +parseInt($('#formtooltip').height()))>h){
	    			var hn = h-$('#formtooltip').height();
	    			$('#formtooltip').css("top",hn);
	    		}
	    	}	  
	    	
	    	$(this).each(function(){
	    		var comp = $(this);
	    		
	    		comp.data('title',comp.attr('title'));
	    		comp.removeAttr('title');

				$(this).bind({
					 mouseover: function(evt){
						 if ($("#formtooltip").css("opacity") != 0) {
							  $("#formtooltip").stop().remove();
						  }
						   
						  zeigeTooltip(evt,comp);
						  adjustTop();
					 },					
					 mouseleave: function(evt){
						
						 $("#formtooltip").fadeOut(500,function(){
				    		 $(this).remove();
						 });		 
					 },
					 focus: function(evt){
						 $("#formtooltip").fadeOut(500,function(){
				    		 $(this).remove();
						 });		 
					 }
				});
	    	});
	    } 
		    
	};
	var settings = {	
			position: "relative",
			"zindex": 10000,
			"background":"#F0F4FF",			
    		"width": "220px",
    		"border": "1px solid #689acd"
	};
	$.fn.ugcFormTooltip = function(method ) {		
	    if ( methods[method] ) {
	    	return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
	    } else if ( typeof method === 'object' || ! method ) {
	    	return methods.init.apply( this, arguments );
	    } else {
	    	$.error( 'Method ' +  method + ' does not exist on jQuery.tooltip' );
	    }
	};
	var toolTipContent =[];
	toolTipContent["login_mail"]="Geben Sie Ihre vollst\u00E4ndige E-Mail Adresse ein, die Sie bei der Registierung ausgew\u00E4hlt haben.";
	toolTipContent["login_pass"]="Geben Sie Ihr Passwort ein. Falls Sie Ihr Passwort vergessen haben, k\u00F6nnen Sie es sich erneut zusenden lassen: unter \"Jetzt Passwort anfordern\".";
	toolTipContent["createLogin_email"]="Geben Sie Ihre vollst\u00E4ndige E-Mail Adresse ein.";
	toolTipContent["createLogin_pass"]="Frei w\u00E4hlbares Passwort. Passwort muss mindestends 6 und max. 100 Zeichen lang sein.";
	toolTipContent["createLogin_passRep"]="Wiederholen Sie Ihre Passworteingabe.";
	toolTipContent["poiPublish"]="Machen Sie Ihre Favoriten auch f\u00FCr andere Nutzer sichtbar. Selektieren Sie Favoriten, die Sie ver\u00F6ffentlich m\u00F6chten und dr\u00FCcken Sie die Taste \"Favoriten ver\u00F6ffentlichen\". Nach der \u00DCberpr\u00FCfung werden Ihre Favoriten in der POI-Liste unter der Gruppe \"UGC\" erscheinen.";
	toolTipContent["deleteAccount_mail"]= "Geben Sie Ihre vollst\u00E4ndige E-Mail Adresse ein, die Sie bei der Registierung ausgew\u00E4hlt haben.";
	toolTipContent["deleteAccount_pass"]= "Geben Sie Ihr Passwort ein.";
	
})( jQuery );(function( $ ){
	var methods = {
		    init : function( options ){
		    	return this.each(function() {
		    		var tooltip = $(this).css({position: "relative","z-index": 10000,"background":"#ffffff",
		    			"width": "200px","border": "1px solid #C3D9FF"});
		    		
					tooltip.append('<div style="margin:7px;"><INPUT TYPE="radio" id="ugc_tt_coord" name ="ugc_tt" value = "1">'+
					'<label for="ugc_tt_coord" >Position ohne Adress\u00E4nderung \u00FCbernehmen.</label></div>');
					
					tooltip.append('<div style="margin:7px;"><INPUT TYPE="radio" id="ugc_tt_addr" name ="ugc_tt" value = "2">'+
					'<label for="ugc_tt_addr" >Favorit auf n\u00E4chstgelegene Adresse positionieren.</label></div>');
					
					if(options) { $.extend(settings, options); }
					
					$(this).find("input:radio[name='ugc_tt']").click(function() {
						
						if ($("input:radio:checked[name='ugc_tt']").val() == "1") {
							$(this).trigger("ugcChange",[1]);	
							$(this).attr('checked', false);
						}
						else if($("input:radio:checked[name='ugc_tt']").val() == "2"){					
							$(this).trigger("ugcChange",[2]);
							$(this).attr('checked', false);
						}						
						tooltip.hide();
					});
					tooltip.hide();
				});

		    } ,
		    show : function(){			    	
		    	$(this).show();
		    } ,
		    hide : function( ) {
		    	$(this).hide();
		    }
		    
		  };
	var settings = {		
	};
	$.fn.ugcTooltip = function(method ) {		
		 // Method calling logic
	    if ( methods[method] ) {
	      return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
	    } else if ( typeof method === 'object' || ! method ) {
	      return methods.init.apply( this, arguments );
	    } else {
	      $.error( 'Method ' +  method + ' does not exist on jQuery.tooltip' );
	    }
	};
	
	
})( jQuery );	function getZVOInfo(coord,map){	
		var maptype = map.getCurrentMapType();
		var projection = maptype.getProjection();
		var coordinate = projection.pixelToMeter(coord);
		
		var params = {};
		params["x"]=coordinate.getX();
		params["y"]=coordinate.getY();
		params["appId"]=appId;
		jQuery_1_5_1.ajax({	
			type: 'GET',		
			crossDomain:true,			
			scriptCharset: "ISO-8859-1",
			dataType: "jsonp",
			url: appUrl+"/"+appName+"zvo.html",
			data:params,			
			success: function  (data, textStatus, jqXHR) {				
				var json = eval(data);				
				if (infoBalloon != null) {
		            map.removeWindowOverlay(infoBalloon);
		            infoBalloon.destroy();
		            infoBalloon = null;
		        }
				var content =null;
				if(json.error ==null || json.error.length > 0){
					content = formatErrorContent(json.error);
				}
				else if(json.hits ==null || json.hits.length ==0){
					content = formatHitsContent(json.hits);
				}
				else{
					content = formatZVOContent(json.address);
				}	
				var coord = new IWCoordinate(parseInt(json.address.x),parseInt(json.address.y));
		        infoBalloon = new InfoBalloon(map, coord, content,false);
		        map.addWindowOverlay(infoBalloon);  
			},		
			jsonpCallback: "ugcCallback",				
			error:errorCallback			
		});			
	}
	function formatErrorContent(error){
		
		var content = document.createElement('div');    		
		content.style.position = 'relative'; 
		content.style.display='inline';    
		
        var div = document.createElement('div');
        content.appendChild(div);
        div.style.position = 'relative';
        var boldOrt =createTextParagraph("System Fehler: "+error);
    	boldOrt.style.fontWeight = 'bold';
    	boldOrt.style.color ='black';
    	boldOrt.style.whiteSpace='nowrap';
	    div.appendChild(boldOrt);
	    return div;
		
	}
	function formatHitsContent(){
		
		var content = document.createElement('div');    		
		content.style.position = 'relative'; 
		content.style.display='inline';    
		
        var div = document.createElement('div');
        content.appendChild(div);
        div.style.position = 'relative';
        var boldOrt =createTextParagraph("Im Umfeld des gewählten Position wurde keine Adressen gefunden.");
    	boldOrt.style.fontWeight = 'bold';
    	boldOrt.style.color ='black';
    	boldOrt.style.whiteSpace='nowrap';
	    div.appendChild(boldOrt);
	    return div;
		
	}
	function parseVerlagInfo(div, verlagInfo){
		for(var z=0;z<verlagInfo.length;z++){
			var tbKgs = prepareString(verlagInfo[z].kgs);			
        	var tbVerlagNr =prepareString(verlagInfo[z].verlag_nr);
        	var tbVerlagName =prepareString(verlagInfo[z].verlag_name);
        	
        	var table = iw.create('table');
		    table.style.cellspacing = '0';
		    table.style.position ='relative';			   
		    var r =0;
		    div.appendChild(createEmptyParagraph('5px'));	
		    
		    if(tbKgs.length>0){			
				div.appendChild(createTextParagraph("KGS: "+tbKgs ));
			}
		    var verl = createTextParagraph("Verlag: "+tbVerlagName +" ("+tbVerlagNr+")");
		    verl.style.whiteSpace='nowrap';
		    div.appendChild(verl);
				
        	var books = verlagInfo[z].books;
        	for(b=0;b<books.length;b++){
        		var tbBuchNr = prepareString(books[b].buch_nr);
            	var tbBuchName = prepareString(books[b].buch_name);
            	div.appendChild(createEmptyParagraph('5px'));
            	var buch = createTextParagraph("Buch: "+tbBuchName +" ("+tbBuchNr+")");
            	buch.style.whiteSpace='nowrap';
            	div.appendChild(buch);
            	
            	
        		var buab = books[b].buabs;
        		for(ba=0;ba<buab.length;ba++){
        			var tbBuabNr = prepareString(buab[ba].buab_nr);
                	var tbBuabName = prepareString(buab[ba].buab_name);
                	var onkz ="";
                	if(prepareString(buab[ba].onkz).length >0){
                		onkz = ", Ortsnetzkennzahl: "+prepareString(buab[ba].onkz);
                	}
                	var bua = createTextParagraph("Abschnitt: "+tbBuabName +" ("+tbBuabNr+onkz+")");
                	bua.style.whiteSpace='nowrap';
                	div.appendChild(bua);  
        		}
        	}
		}
	}
	
	function formatZVOContent(address)
    {
		var content = document.createElement('div'); 
		content.id="zvocontent";
		content.style.position = 'relative'; 
		content.style.display='inline';    
		
        var div = document.createElement('div');
        content.appendChild(div);
        div.style.position = 'relative';        	
    	
    	var plz = address.zipcode == null?"":address.zipcode;
    	var ort = address.city== null?"":address.city;
    	var ortsTeil = address.part== null?"":address.part;
    	var str =  address.street== null?"":address.street;
    	var hnr = address.housenumber== null || address.housenumber.length==0?"":address.housenumber;
    	var kgz = address.gkz== null?"":address.gkz;
    	var kgs = address.kgs == null?"":address.kgs;
    	var onkz = address.onkz == null?"":address.onkz;
    	var datasource = address.dataSource == null?"":address.dataSource;
    	
    	var ortsTile = ortsTeil.replace(/\u0020/g, '&nbsp;');
    	if(ortsTile.length >0){
    		ortsTile = ' (' +ortsTile+')';
    	}
    	
    	var p = plz.replace(/\u0020/g, '&nbsp;') + '&nbsp;' + ort.replace(/\u0020/g, '&nbsp;')+ '&nbsp;'+ortsTile;
    	if(datasource =='address_master'){
    		p ="* "+p;
    	}
    	var boldOrt =createTextParagraph(p);
    	boldOrt.style.fontWeight = 'bold';
    	boldOrt.style.color ='black';
    	boldOrt.style.whiteSpace='nowrap';
	    div.appendChild(boldOrt);
    	
	    var boldStr =createTextParagraph(str.replace(/\u0020/g, '&nbsp;') + '&nbsp;' + hnr.replace(/\u0020/g, '&nbsp;'));
	    boldStr.style.fontWeight = 'bold';
	    boldStr.style.color ='black';
	    boldStr.style.whiteSpace='nowrap';
	    div.appendChild(boldStr);        	
    	
    	div.appendChild(createEmptyParagraph('7px'));
    	
    	if(kgs.length>0){
    		div.appendChild(createTextParagraph("Kreisgemeindeschlussel: "+kgs));
    	}
    	if(onkz.length>0){
    		div.appendChild(createTextParagraph("Ortsnetzkennzahl: "+onkz));
    	}
    	div.appendChild(createEmptyParagraph('10px'));
    	
    	var zvoTB = address.zvo.tb;
    	var boldTB =createTextParagraph("Das Telefonbuch");
    	boldTB.style.fontWeight = 'bold';
    	boldTB.style.fontStyle = 'italic';
	    div.appendChild(boldTB);
	    div.appendChild(createEmptyParagraph('5px'));   
	    var verlagsTb = zvoTB.verlags;
	    parseVerlagInfo(div, verlagsTb);    	
    	
    	div.appendChild(createEmptyParagraph('10px'));    	
    	
    	var zvoOe = address.zvo.oetb;
    	var boldOe =createTextParagraph("Das Örtliche");
    	boldOe.style.fontWeight = 'bold';
    	boldOe.style.fontStyle = 'italic';
	    div.appendChild(boldOe);
	    div.appendChild(createEmptyParagraph('5px'));
	    var verlagsOe = zvoOe.verlags;
	    parseVerlagInfo(div, verlagsOe);  
	    
	    div.appendChild(createEmptyParagraph('10px'));    	
    	
    	var zvoGs = address.zvo.gs;
    	var boldGs =createTextParagraph("Gelbe Seiten");
    	boldGs.style.fontWeight = 'bold';
    	boldGs.style.fontStyle = 'italic';
	    div.appendChild(boldGs);
	    div.appendChild(createEmptyParagraph('5px'));
	    var verlagsGs = zvoGs.verlags;
	    parseVerlagInfo(div, verlagsGs);    	
    	
        return content;
    }
	function prepareString(str){
		return str == null || str.length ==0?"": str;
	}
	/*
 * jQuery.splitter.js - two-pane splitter window plugin
 *
 * version 1.51 (2009/01/09) 
 * 
 * Dual licensed under the MIT and GPL licenses: 
 *   http://www.opensource.org/licenses/mit-license.php 
 *   http://www.gnu.org/licenses/gpl.html 
 */

/**
 * The splitter() plugin implements a two-pane resizable splitter window.
 * The selected elements in the jQuery object are converted to a splitter;
 * each selected element should have two child elements, used for the panes
 * of the splitter. The plugin adds a third child element for the splitbar.
 * 
 * For more details see: http://methvin.com/splitter/
 *
 *
 * @example $('#MySplitter').splitter();
 * @desc Create a vertical splitter with default settings 
 *
 * @example $('#MySplitter').splitter({type: 'h', accessKey: 'M'});
 * @desc Create a horizontal splitter resizable via Alt+Shift+M
 *
 * @name splitter
 * @type jQuery
 * @param Object options Options for the splitter (not required)
 * @cat Plugins/Splitter
 * @return jQuery
 * @author Dave Methvin (dave.methvin@gmail.com)
 */
 ;(function($){
 
 $.fn.splitter = function(args){
	args = args || {};
	
	return this.each(function() {
		var zombie;		// left-behind splitbar for outline resizes
		var moveAction = false;
		var lastSplitterSize=0;
		function startSplitMouse(evt) {
			 
		//	console.log("mouse Down A[0][opts.pxSplit] "+A[0][opts.pxSplit]+" evt[opts.eventPos] "+evt[opts.eventPos]);
			if ( opts.outline )
				zombie = zombie || bar.clone(false).insertAfter(A);
			panes.css("-webkit-user-select", "none");	// Safari selects A/B text on a move
			bar.addClass(opts.activeClass);
			A._posSplit = A[0][opts.pxSplit] - evt[opts.eventPos];
			$(document)
				.bind("mousemove", doSplitMouse)
				.bind("mouseup", endSplitMouse);
			return false;
		}
		function doSplit(evt) {
			
			var oppen = (A[0][opts.pxSplit] > 0);	
			var newPos = opts.stopSize;
			
			if(oppen == true) {	
				lastSplitterSize = A[0][opts.pxSplit];
				newPos = 0;			
			}
			else if(lastSplitterSize >0){
				newPos = lastSplitterSize;
			}
			
			bar.removeClass(opts.activeClass);
			
			if ( opts.outline && zombie!=null) {
				zombie.remove(); zombie = null;
				
			}
			resplit(newPos);
			
			panes.css("-webkit-user-select", "text");	// let Safari select text again
			$(document)
				.unbind("mousemove", doSplitMouse)
				.unbind("mouseup", endSplitMouse);
			return false;
		}
		
		function doSplitMouse(evt) {
			A.trigger("resplitStart"); 
			moveAction = true;
			
			var newPos = A._posSplit+evt[opts.eventPos];
			if(opts.stopSize && newPos < parseInt(opts.stopSize)) {
				newPos=opts.stopSize;
			}
			if ( opts.outline ) {
				newPos = Math.max(0, Math.min(newPos, splitter._DA - bar._DA));
				//console.log("mouse Move newPos "+newPos);
				bar.css(opts.origin, newPos);
			} else {
				
				resplit(newPos);
				
			}
			return false;
				
		}
		function endSplitMouse(evt) {
			
			bar.removeClass(opts.activeClass);
			var newPos = A._posSplit+evt[opts.eventPos];
			if(opts.stopSize && newPos < parseInt(opts.stopSize)) {
				newPos=opts.stopSize;
			}
		//	console.log("mouse Up newPos "+newPos);
			if ( opts.outline ) {
				zombie.remove(); zombie = null;				
				resplit(newPos);
			}
		
			panes.css("-webkit-user-select", "text");	// let Safari select text again
			$(document)
				.unbind("mousemove", doSplitMouse)
				.unbind("mouseup", endSplitMouse);
			A.trigger("resplitStop"); 
			return false;
		}
		function resplit(newPos) {
			
			// Constrain new splitbar position to fit pane size limits
			newPos = Math.max(A._min, splitter._DA - B._max, 
					Math.min(newPos, A._max, splitter._DA - bar._DA - B._min));
			// Resize/position the two panes
			bar._DA = bar[0][opts.pxSplit];		// bar size may change during dock
			bar.css(opts.origin, newPos).css(opts.fixed, splitter._DF);
			A.css(opts.origin, 0).css(opts.split, newPos).css(opts.fixed,  splitter._DF);
			B.css(opts.origin, newPos+bar._DA)
				.css(opts.split, splitter._DA-bar._DA-newPos).css(opts.fixed,  splitter._DF);
			// IE fires resize for us; all others pay cash
			if ( !$.browser.msie )
				panes.trigger("resize");
			if(opts.contentReload && opts.contentReload == true) {
				
				A.trigger("leftPaneResize",[true]); 
			}
			else {
				A.trigger("leftPaneResize",[false]); 
				
			}
			var oppen = (A[0][opts.pxSplit] > 0);
			
			if(oppen == true) {	
				barTop.removeClass(opts.splitbarTopOpenClass);
				barTop.removeClass(opts.splitbarTopOpenHoverClass);
				barTop.addClass(opts.splitbarTopCloseClass);	
				
			}
			else {
				barTop.removeClass(opts.splitbarTopCloseClass);
				barTop.removeClass(opts.splitbarTopCloseHoverClass);
				barTop.addClass(opts.splitbarTopOpenClass);			
			}
			
		}
		function doMouseOver(){
			var oppen = (A[0][opts.pxSplit] > 0);
			if(oppen == true) {	
				barTop.removeClass(opts.splitbarTopCloseClass);
				barTop.addClass(opts.splitbarTopCloseHoverClass);	
			}
			else {
				barTop.removeClass(opts.splitbarTopOpenClass);
				barTop.addClass(opts.splitbarTopOpenHoverClass);			
			}
		}
		function doMouseOut(){
			var oppen = (A[0][opts.pxSplit] > 0);
			if(oppen == true) {	
				barTop.removeClass(opts.splitbarTopCloseHoverClass);
				barTop.addClass(opts.splitbarTopCloseClass);	
			}
			else {
				barTop.removeClass(opts.splitbarTopOpenHoverClass);
				barTop.addClass(opts.splitbarTopOpenClass);			
			}
		}
		function dimSum(jq, dims) {
			// Opera returns -1 for missing min/max width, turn into 0
			var sum = 0;
			for ( var i=1; i < arguments.length; i++ )
				sum += Math.max(parseInt(jq.css(arguments[i])) || 0, 0);
			return sum;
		}
		
		// Determine settings based on incoming opts, element classes, and defaults
		var vh = (args.splitHorizontal? 'h' : args.splitVertical? 'v' : args.type) || 'v';
		var opts = $.extend({
			activeClass: 'active',	// class name for active splitter
			pxPerKey: 8,			// splitter px moved per keypress
			tabIndex: 0,			// tab order indicator
			accessKey: ''			// accessKey for splitbar
		},{
			v: {					// Vertical splitters:
				keyLeft: 39, keyRight: 37, cursor: "e-resize",
				splitbarClass: "vsplitbar", outlineClass: "voutline",
				splitbarTopClass: "vTopSplitbar",splitbarTopOpenClass: "vTopSplitbarOpen",
				splitbarTopCloseClass: "vTopSplitbarClose",splitbarBottomClass: "vBottomSplitbar",
				splitbarTopCloseHoverClass: "vTopSplitbarHoverClose",splitbarTopOpenHoverClass: "vTopSplitbarHoverOpen",
				type: 'v', eventPos: "pageX", origin: "left",
				split: "width",  pxSplit: "offsetWidth",  side1: "Left", side2: "Right",
				fixed: "height", pxFixed: "offsetHeight", side3: "Top",  side4: "Bottom"
			},
			h: {					// Horizontal splitters:
				keyTop: 40, keyBottom: 38,  cursor: "n-resize",
				splitbarClass: "hsplitbar", outlineClass: "houtline",
				splitbarTopClass: "hTopSplitbar",splitbarTopOpenClass: "hCentreSplitbarOpen",
				splitbarTopCloseClass: "hCentreSplitbarClose",splitbarBottomClass: "hBottomSplitbar",
				type: 'h', eventPos: "pageY", origin: "top",
				split: "height", pxSplit: "offsetHeight", side1: "Top",  side2: "Bottom",
				fixed: "width",  pxFixed: "offsetWidth",  side3: "Left", side4: "Right"
			}
		}[vh], args);

		// Create jQuery object closures for splitter and both panes
		var splitter = $(this).css({position: "relative"});
		var panes = $(">*", splitter[0]).css({
			position: "absolute", 			// positioned inside splitter container
			"z-index": "1",					// splitbar is positioned above
			"-moz-outline-style": "none"
		});
		var A = $(panes[0]).css({			
				"box-shadow": "4px 26px 12px #999999",
               "-moz-box-shadow": "4px 26px 12px #999999",
               "-o-box-shadow": "4px 26px 12px #999999",
               "-webkit-box-shadow": "4px 26px 12px #999999"

		});;		// left  or top
		var B = $(panes[1]);		// right or bottom

		// Focuser element, provides keyboard support; title is shown by Opera accessKeys
		var focuser = $('<a href="javascript:void(0)"></a>')
			.attr({accessKey: opts.accessKey, tabIndex: opts.tabIndex, title: opts.splitbarClass})
			.bind($.browser.opera?"click":"focus", function(){ this.focus(); bar.addClass(opts.activeClass) })
			.bind("keydown", function(e){
				var key = e.which || e.keyCode;
				var dir = key==opts["key"+opts.side1]? 1 : key==opts["key"+opts.side2]? -1 : 0;
				if ( dir ) {
					logger("resplit dir "+dir);
					resplit(A[0][opts.pxSplit]+dir*opts.pxPerKey, false);
				}
			})
			.bind("blur", function(){ bar.removeClass(opts.activeClass) });
			
		// Splitbar element, can be already in the doc or we create one
		var bar = $(panes[2] || '<div></div>')
		.insertAfter(A).css("z-index", "100").append(focuser)
		.attr({"class": opts.splitbarClass, unselectable: "on"});
		
		var barTop = $('<div></div>')
		.appendTo(bar).css("z-index", "100").append(focuser)
		.attr({"class": opts.splitbarTopOpenClass,unselectable: "on"})				
		.bind("click", doSplit).bind("mouseover", doMouseOver).bind("mouseout", doMouseOut);
		
		var barBot = $('<div></div>')
		.appendTo(bar)
		.insertAfter(barTop).css("z-index", "100").append(focuser)
		.attr({ "class": opts.splitbarBottomClass,unselectable: "on"})					
		.bind("mousedown", startSplitMouse);
		
		// Cache several dimensions for speed, rather than re-querying constantly
		bar._DA = bar[0][opts.pxSplit];
		splitter._PBF = $.boxModel? dimSum(splitter, "border"+opts.side3+"Width", "border"+opts.side4+"Width") : 0;
		splitter._PBA = $.boxModel? dimSum(splitter, "border"+opts.side1+"Width", "border"+opts.side2+"Width") : 0;
		A._pane = opts.side1;
		B._pane = opts.side2;
		$.each([A,B], function(){
			this._min = opts["min"+this._pane] || dimSum(this, "min-"+opts.split);
			this._max = opts["max"+this._pane] || dimSum(this, "max-"+opts.split) || 9999;
			this._init = opts["size"+this._pane]===true ?
				parseInt($.curCSS(this[0],opts.split)) : opts["size"+this._pane];
		});
		
		// Determine initial position, get from cookie if specified
		var initPos = A._init;
		if ( !isNaN(B._init) )	// recalc initial B size as an offset from the top or left side
			initPos = splitter[0][opts.pxSplit] - splitter._PBA - B._init - bar._DA;
		if ( opts.cookie ) {
			if ( !$.cookie )
				alert('jQuery.splitter(): jQuery cookie plugin required');
			var ckpos = parseInt($.cookie(opts.cookie));
			if ( !isNaN(ckpos) )
				initPos = ckpos;
			$(window).bind("unload", function(){
				var state = String(bar.css(opts.origin));	// current location of splitbar
				$.cookie(opts.cookie, state, {expires: opts.cookieExpires || 365, 
					path: opts.cookiePath || document.location.pathname});
			});
		}
		if ( isNaN(initPos) )	// King Solomon's algorithm
			initPos = Math.round((splitter[0][opts.pxSplit] - splitter._PBA - bar._DA)/2);
		
		/*if ( !opts.initSize ) {			
			opts.initSize = 270;
		}*/
		if(initPos >0) {
			barTop.removeClass(opts.splitbarTopOpenClass);
			barTop.addClass(opts.splitbarTopCloseClass);
		}
		// Resize event propagation and splitter sizing
		if ( opts.anchorToWindow ) {
			// Account for margin or border on the splitter container and enforce min height
			splitter._hadjust = dimSum(splitter, "borderTopWidth", "borderBottomWidth", "marginBottom");
			splitter._hmin = Math.max(dimSum(splitter, "minHeight"), 20);
			
			$(window).bind("resize", function(){
			
				var top = splitter.offset().top;
				//var wh = $(window).height();
				//var ww = $(window).width();
				var wh = iw.windowSize().getHeight();
				var ww = iw.windowSize().getWidth();
				
				splitter.css("height", Math.max(wh-top-splitter._hadjust, splitter._hmin)+"px");
				splitter.css("width",ww);
				
				if ( !$.browser.msie ) splitter.trigger("resize");				
				splitter.trigger("splitterResize"); 
			}).trigger("resize");
		}
		else if ( opts.resizeToWidth && !$.browser.msie )
			$(window).bind("resize", function(){
				splitter.trigger("resize"); 
				splitter.trigger("splitterResize"); 
			});

		// Resize event handler; triggered immediately to set initial position
		splitter.bind("resize", function(e, size){
			// Custom events bubble in jQuery 1.3; don't Yo Dawg
			if ( e.target != this ) return;
			// Determine new width/height of splitter container
			splitter._DF = splitter[0][opts.pxFixed] - splitter._PBF;
			splitter._DA = splitter[0][opts.pxSplit] - splitter._PBA;
			// Bail if splitter isn't visible or content isn't there yet
			if ( splitter._DF <= 0 || splitter._DA <= 0 ) return;
			// Re-divvy the adjustable dimension; maintain size of the preferred pane
			
			resplit(!isNaN(size)? size : (!(opts.sizeRight||opts.sizeBottom)? A[0][opts.pxSplit] :
				splitter._DA-B[0][opts.pxSplit]-bar._DA));
			
		}).trigger("resize" , [initPos]);
	});
};

})(jQuery);/**
 * Creates a new window object.
 * 
 * @class <code>IWInfoBalloon</code> is an example implementation of the <code>IWWindowOverlay</code> interface.
 *        <code>IWInfoBalloon</code> can be used to display informations in front of the map.
 * @extends IWWindowOverlay
 * 
 * @constructor
 * 
 * @param {IWMap}
 *            map
 * @param {IWCoordinate}
 *            coordinate
 * @param {Object}
 *            [content] DOMElement or String
 * 
 * @author JAN, KUN
 * @since 0.66
 */
function OffersInfoBalloon(map, coordinate, content,moreTargets)		
{
	// ********************************************************************
	// First we call the superclass constructor
	// ********************************************************************
	
	IWWindowOverlay.call(this, map, coordinate);

	// ********************************************************************
	// * Private attributes
	// ********************************************************************

	var self = this;
	var size = new IWSize(240, 180);
	

	var panMap = true;
	var borderWidth = 19;
	var borderHeight = 19;
	var arrowHeigth = 50;
	var arrowWidth=60;

	// ********************************************************************
	// * GUI Elements
	// ********************************************************************
	var container = this.getContainer();	
	var divMain = iw.create('div');	
	var divContent = iw.create('div');
	var divTitle = iw.create('div');
	var divImageArrow = iw.create('div');
	var imgClose = iw.create('div');
	var logger = log4javascript.getLogger('IWInfoBalloon');	

	// ********************************************************************
	// * Setup for multi language support
	// ********************************************************************

	var pack = new IWLanguagePack();
	pack.addLanguage(new IWLanguage('de', iwconst.LOCAL_APP_URL + 'lang/IWInfoBalloon.lang.de'));
	pack.addLanguage(new IWLanguage('en', iwconst.LOCAL_APP_URL + 'lang/IWInfoBalloon.lang.en'));
	pack.addLanguage(new IWLanguage('es', iwconst.LOCAL_APP_URL + 'lang/IWInfoBalloon.lang.es'));
	pack.addLanguage(new IWLanguage('fr', iwconst.LOCAL_APP_URL + 'lang/IWInfoBalloon.lang.fr'));
	pack.addLanguage(new IWLanguage('tr', iwconst.LOCAL_APP_URL + 'lang/IWInfoBalloon.lang.tr'));
	pack.addLanguage(new IWLanguage('it', iwconst.LOCAL_APP_URL + 'lang/IWInfoBalloon.lang.it'));

	IWMultiLanguageSupport.call(this, map, pack);

	// ********************************************************************
	// * Public methods
	// ********************************************************************

	/**
	 * If the whole popup should be visible in the map-viewport after appending, set "true". If not, set "false". Then
	 * its possible that the popup intersects the map-viewport-bounds. Default is "true".
	 * 
	 * @param {Bool}
	 *            panMapBool
	 * @return {void}
	 */
	this.setAutoPan = function(panMapBool)
	{
		panMap = panMapBool;
	};
	this.setDivMainStyle = function(styleClasse){
		divMain.className=styleClasse;
	}
	/**
	 * Returns the content of the infoballoon.
	 * 
	 * @return {Object}
	 */
	this.getContent = function()
	{
		return content;
	};

	/**
	 * Sets the content of the infoballoon.
	 * 
	 * @param {Object}
	 *            newContent the new content of the infoballoon
	 * @return {void}
	 */
	this.setContent = function(newContent)
	{
		content = newContent;
	};

	/**
	 * We use the callback method for positioning the map and displaying the info balloon.
	 * 
	 * @return {void}
	 */
	this.afterAppend = function()
	{
		logger.info('Calling afterAppend.');
		try{
			if(PIE.attach){
				PIE.attach(divMain);
				PIE.attach(divImageArrow);
				PIE.attach(divTitle);				
			}
		}
		catch(Exception){			
		}
		var maxHeight = 250;
        var maxWidth = 400;
		var minHeight=25;
		var minWidth=110;
		var scrollBalkeX = false;
		var scrollBalkeY = false;
		var contentSize = new IWSize(content.offsetWidth,content.offsetHeight);
		if (contentSize.getHeight() < minHeight)
        {
            contentSize.setHeight(minHeight);
        }
        else if (contentSize.getHeight() > maxHeight)
        {
            contentSize.setHeight(maxHeight);
            scrollBalkeX = true;
        }
        if (contentSize.getWidth() < minWidth)
        {
            contentSize.setWidth(minWidth);
            
        }
        else if (contentSize.getWidth() > maxWidth)
        {
            contentSize.setWidth(maxWidth);
            scrollBalkeY=true;
        }  
        if(scrollBalkeX == true) { 
        	contentSize.setWidth(contentSize.getWidth()+25);
        }
        if(scrollBalkeY == true) { 
        	contentSize.setHeight(contentSize.getHeight()+25);
        }
		this.setSize (new IWSize(contentSize.getWidth(),contentSize.getHeight()));
		
		container.style.visibility = 'visible';
		
		if (panMap)
		{
			var position = iw.absolute(container, map.getContainer());

			// ********************************************************************
			// * If the coordinate is inside the visible map area we use the panBy
			// * method to adjust the infoballoon at the screen. Otherwise we use
			// * the setCenter method to center the infoballoon.
			// ********************************************************************

			if (map.getBounds().containsCoordinate(coordinate))
			{
				var offsetRight = position.getX() + size.getWidth() + borderWidth + borderWidth 
						- map.getOptions().getSize().getWidth();
				var offsetLeft = position.getX();
				var offsetTop = position.getY() ;
				var offsetBottom = position.getY() + size.getHeight() + borderHeight + borderHeight 
						- map.getOptions().getSize().getHeight();

				if (offsetRight > 0 || offsetLeft < 0 || offsetTop < 0 || offsetBottom > 0)
				{
					var x = 0;
					var y = 0;

					if (offsetRight > 0)
					{
						x = -offsetRight;
					}
					else
						if (offsetLeft < 0)
						{
							x = -offsetLeft;
						}

					if (offsetTop < 0)
					{
						y = -offsetTop;
					}
					else
						if (offsetBottom > 0)
						{
							y = -offsetBottom;
						}

					map.panBy(new IWPoint(x, y), true);
				}
			}
			else
			{
				// ********************************************************************
				// * We adjust the infoballoon at the screen by calculating a new
				// * center coordinate.
				// ********************************************************************

				var projection = map.getCurrentMapType().getProjection();
				var pixelCoordinate = projection.meterToPixel(coordinate);
				// We calculate the y offset in pixel
				var pixelOffsetY = this.getSize().getHeight() / 2;
				var centerX = pixelCoordinate.getX();
				var centerY = pixelCoordinate.getY() - pixelOffsetY;
				var pixelCenter = new IWPoint(centerX, centerY);
				map.setCenter(projection.pixelToMeter(pixelCenter));
			}
		}
	};

	/**
	 * Resizes the balloon to the specified size.
	 * 
	 * @param {IWSize}
	 *            size the new size of the infoballoon
	 * @return {void}
	 */
	this.setSize = function(newSize)
	{
		logger.info('Calling setSize with ' + size);

		iw.strict( [ IWSize ], [ size ]);
		size = newSize;

		resize();

		this.setAnchor(new IWPoint(-(size.getWidth() / 2 ),
				-(size.getHeight() + borderHeight + borderHeight + arrowHeigth)));
	};

	/**
	 * Returns the size of the infoballoon.
	 * 
	 * @return {IWSize}
	 */
	this.getSize = function()
	{
		return size;
	};

	/**
	 * Destroys the infoballoon. Releases all DOM references and event listeners.
	 * 
	 * Call this method after the infoballoon has been removed from the map by calling the
	 * <code>removeWindowOverlay</code> method.
	 * 
	 * @return {void}
	 */
	this.destroy = function()
	{
		logger.info('Calling destroy');
		try{
			if(PIE.detach){
				PIE.detach(divMain);				
				PIE.detach(divImageArrow);
				PIE.detach(divTitle);
			}
		}
		catch(Exception){			
		}
		IWEventManager.clearInstanceListeners(this);

		this.destroyMultiLanguageSupport();
		this.destroyWindowOverlay();

		content = null;
		divMain = null;
		divContent = null;		
		divImageArrow = null;
		imgClose = null;
		container = null;
	};

	/**
	 * Returns a string representation of this infoballoon.
	 * 
	 * @return {String}
	 */
	this.toString = function()
	{
		return '[DPInfoBalloon]';
	};

	// ********************************************************************
	// * Private methods
	// ********************************************************************

	/**
	 * Creates the GUI.
	 * 
	 * @private
	 * @return {void}
	 */
	function buildGUI()
	{
		logger.debug('Calling buildGUI');
		if(moreTargets == true) {	
			borderHeight=20;			
		}
		container.style.height = size.getHeight() + borderHeight + borderHeight + 'px';
		container.style.width = size.getWidth() + borderWidth + borderWidth + 'px';
		container.style.visibility = 'hidden';

		// ********************************************************************
		// * Append the main DIV to our container
		// ********************************************************************
			
		iw.append(container, divMain);		
		divMain.style.position = 'absolute';
		divMain.style.top = '0px';
		divMain.style.left = '0px';
		divMain.style.width = size.getWidth() + 'px';
		divMain.style.height = size.getHeight() + 'px';
		divMain.className='infolayerOffers-content';
		

		// ********************************************************************
		// * Append the content DIV
		// ********************************************************************

		divContent.id = 'divContent';
		iw.append(divMain, divContent);
		divContent.style.position = 'absolute';
		divContent.style.top = borderHeight + 'px';
		divContent.style.left = borderWidth + 'px';	
		divContent.style.overflow = 'auto';

		if(moreTargets == true) {	
			borderHeight=20;
			divTitle.className='title-content';			
			var title = document.createTextNode('Mehrere Treffer');
			divTitle.appendChild(title);
			iw.append(divMain, divTitle);
		}
		
		// ********************************************************************
		// * Append the user content DIV
		// ********************************************************************
		var div = iw.create('div');
		div.style.overflow = 'hidden';
		iw.append(divContent, div);
		iw.append(div, content);

		// ********************************************************************
		// * Append the close image
		// ********************************************************************

		iw.append(divMain, imgClose);
		self.addLabelFor(new IWLabel('CLOSE', imgClose, 'title'));
		self.addLabelFor(new IWLabel('CLOSE', imgClose, 'alt'));		
		imgClose.className='imgcloseOff imgclosegrund';

		// ********************************************************************
		// * Append the arrow image		
		// ********************************************************************

		iw.append(container, divImageArrow);
		divImageArrow.className='infolayerOffers-pointer';
		divImageArrow.style.position = 'absolute';		
		divImageArrow.style.height = arrowHeigth + 'px';
		divImageArrow.style.width = '60px';
		divImageArrow.style.left = Math.round(size.getWidth() / 2) + 'px';

		imgClose.onclick = function()
		{
			map.removeWindowOverlay(self);
		};
		imgClose.onmousedown = function()
		{
			imgClose.className='imgcloseOff imgclosedown';
		};
		imgClose.onmouseup = function()
		{
			imgClose.className='imgcloseOff imgclosegrund';
		};
	}

	/**
	 * Resizes the GUI.
	 * 
	 * @private
	 * @return {void}
	 */
	function resize()
	{
		logger.debug('Calling resize.');

		var w = size.getWidth();
		var h = size.getHeight();

		container.style.height = h + borderHeight + borderHeight + 'px';
		container.style.width = w + borderWidth + borderWidth + 'px';

		divMain.style.width = w + borderWidth + borderWidth + 'px';
		divMain.style.height = h + borderHeight + borderHeight + 'px';

		divContent.style.width = w + 'px';
		divContent.style.height = h + 'px';	

		// substract one pixel to overlay the border
		divImageArrow.style.top = h + borderHeight + borderHeight + 'px';
		divImageArrow.style.left = Math.round(w / 2) + 'px';

	}

	// ********************************************************************
	// * Constructor implementation
	// ********************************************************************
	
	buildGUI();
	
	// ********************************************************************
	// * Sets the default anchor for this overlay
	// ********************************************************************

	this.setAnchor(new IWPoint(-(size.getWidth() / 2), -(size.getHeight())));	

	// ********************************************************************
	// * Loads the language pack for the control
	// ********************************************************************

	this.loadLanguagePack(map.getOptions().getLanguage());
}/**
 * Creates a new treeview under the specified parentNode.
 * 
 * @class This class provides a simple treeview control.
 * 
 * @constructor
 * 
 * @param {HTMLDivElement}
 *            parent the container under which the treeview appears
 * 
 * @since 0.70
 * 
 * @author JAN
 */
function IWTreeView(parent)
{
	var self = this;

	// ********************************************************************
	// * Private attributes
	// ********************************************************************

	var nodes = new Array();
	var treenodes = new Array();
	var container = iw.create('div');
	var logger = log4javascript.getLogger('IWTreeView');

	// ********************************************************************
	// * Public methods
	// ********************************************************************

	/**
	 * Adds an array of nodes to the treeview control.
	 * 
	 * @param {IWNodeElement[]}
	 *            nodes an array of nodes
	 * @return {void}
	 */
	this.addNodes = function(nodes)
	{
		// logger.info('Calling addNodes with ' + nodes);

		for ( var i = 0; i < nodes.length; i++)
		{
			this.addNode(nodes[i]);
		}
	};

	/**
	 * Adds a new node to the treeview control.
	 * 
	 * @param {IWNodeElement}
	 *            node
	 * @return {void}
	 */
	this.addNode = function(node)
	{
		// logger.info('Calling addNode with ' + node);

		nodes.push(node);
	};

	/**
	 * Returns the array of {IWNodeElement}
	 * 
	 * @return {IWNodeElement} the nodes
	 */
	this.getNodes = function()
	{
		return nodes;
	};

	/**
	 * Returns the container of the treeview.
	 * 
	 * @return {HTMLDivElement} the container
	 */
	this.getContainer = function()
	{
		return container;
	};

	/**
	 * Returns the parent container of the treeview.
	 * 
	 * @return {HTMLElement} the parent container
	 */
	this.getParent = function()
	{
		return parent;
	};

	/**
	 * Returns the array of {IWTreeNode}
	 * 
	 * @return {IWTreeNode} the tree nodes
	 */
	this.getTreenodes = function()
	{
		return treenodes;
	};

	/**
	 * Builds the tree.
	 * 
	 * Call this method after you have registered the event handlers.
	 * 
	 * @return {void}
	 */
	this.build = function()
	{
		// logger.info('Calling build');

		iw.empty(parent);

		container.style.visibility = 'hidden';

		iw.append(parent, container);

		for ( var i = 0; i < nodes.length; i++)
		{
			var node = nodes[i];

			if (i == (nodes.length - 1))
			{
				createChildDiv(null, node, 2, '1', false);
			}
			else
			{
				createChildDiv(null, node, 2, '0', false);
			}
		}
		container.style.visibility = 'visible';
	};

	/**
	 * Creates the the container for the treeview element.
	 * 
	 * @private
	 * @return {void}
	 */
	function buildGUI(container)
	{
		// logger.debug('Calling buildGUI with ' + container);

		container.id = 'treeview';
		container.style.position = 'relative';
		container.style.top = '0px';
		container.style.left = '0px';
		container.style.width = parent.style.width;
		container.style.height = parent.style.height;
		container.style.overflow = 'auto';
	}

	function handleClick(treeNode)
	{
		if (treeNode.isCollapsed())
		{
			expand(treeNode);
		}
		else
			if (treeNode.isExpanded())
			{
				collapse(treeNode);
			}
	}

	/**
	 * A recursive function for creating and appending the nodes to the treeview.
	 * 
	 * @private
	 * @param {IWTreeNode}
	 *            parentNode the parent treenode
	 * @param {IWNodeElement}
	 *            node the node model
	 * @param {int}
	 *            depth the depth of this node to the root
	 * @param {String}
	 *            islastchild
	 * 
	 * @return {void}
	 */
	function createChildDiv(parentNode, node, depth, islastchild, isHidden)
	{
		var nodeContainer = iw.create('div');
		iw.append(container, nodeContainer);

		nodeContainer.style.display = 'block';

		// Creates a new treenode for this node
		var treeNode = new IWTreeNode(node);
		if (node.isCollapsed())
		{
			treeNode.setState('collapsed');
		}
		else
		{
			treeNode.setState('expanded');
		}

		treeNode.setContainer(nodeContainer);
		treeNode.setLastChild(islastchild.charAt(islastchild.length - 1) == '1');

		IWEventManager.addListener(node, 'onstatechange', function()
		{
			this.getCheckbox().checked = this.getNode().isMarked();
		}.iwclosure(treeNode));

		IWEventManager.addListener(node, 'onviewchange', function()
		{
			logger.debug('Receiving viewchanged event for ' + node);
			if (this.getNode().isCollapsed())
			{
				collapse(this);
			}
			else
			{
				expand(this);
			}
		}.iwclosure(treeNode));

		if (parentNode != null)
		{
			parentNode.addChild(treeNode);
			treeNode.setParent(parentNode);
		}
		else
		{
			treenodes.push(treeNode);
		}

		var table = iw.create('table');

		iw.append(nodeContainer, table);

		table.border = '0px';
		table.cellPadding = '0px';
		table.cellSpacing = '0px';

		var tr = table.insertRow(0);

		for (var i = 0; i < depth; i++)
		{
			var td = iw.create('td');
			iw.append(tr, td);

			td.style.verticalAlign = 'top';
			td.style.margin = '0px';

			if (i == (depth - 1))
			{
				var checkbox = null;

				// ********************************************************************
				// * Workaround for IE Bug: Creating DOM input elements by javascript.
				// * Checkbox can not be set to 'checked' with node.checked.
				// ********************************************************************

				/*var input;
				try
				{
					input = document.createElement('<input name="queryPoint" type="checkbox">');
				}
				catch (exception)
				{
					input = document.createElement('input');
					input.name = 'queryPoint';
					input.type = 'checkbox';
				}*/
				
				try
				{
					if (node.isMarked())
					{
						checkbox = iw.create('<input type="checkbox" checked>');
					}
					else
					{
						checkbox = iw.create('<input type="checkbox">');
					}
				}
				catch (exception)
				{
					checkbox = iw.create('input');
					checkbox.type = 'checkbox';
					checkbox.checked = node.isMarked();
				}
				
				
				
				
				/*if (IWBrowser.isInternetExplorer())
				{
					if (node.isMarked())
					{
						checkbox = iw.create('<input type="checkbox" checked>');
					}
					else
					{
						checkbox = iw.create('<input type="checkbox">');
					}
				}
				else
				{
					checkbox = iw.create('input');
					checkbox.type = 'checkbox';
					checkbox.checked = node.isMarked();
				}*/
				
				checkbox.id = 'cb_' + node.getName();
				checkbox.style.border = '0px';

				treeNode.setCheckbox(checkbox);
				td.className = 'treeviewNode';
				iw.append(td, checkbox);

				var event = new IWFormatNodeEvent();
				event.obj = null;
				event.node = node;

				self.triggerOnFormatNode(event);

				if (event.obj != null)
				{
					// ********************************************************************
					// * Use a user-defined format
					// ********************************************************************
					iw.append(td, event.obj);
				}
				else
				{
					// ********************************************************************
					// * Use the default format
					// ********************************************************************
					var label = iw.create('label');
					label.innerHTML = node.getName();
					label.htmlFor = 'cb_' + node.getName();
					iw.append(td, label);
				}

				IWEventManager.addDomListener(checkbox, 'onclick', function()
				{
					// logger.debug('Receiving onClick event for checkbox.');

						this.getNode().setVisible(this.getCheckbox().checked);

						var event = new IWTreeNodeClickedEvent();
						event.treeNode = this;

						self.triggerOnNodeClick(event);

					}.iwclosure(treeNode));
			}
			else
			{
				td.style.width = '16px';
				td.style.height = '22px';

				var divSpacer = iw.create('div');
				divSpacer.style.height = '22px';
				divSpacer.style.width = '16px';

				iw.append(td, divSpacer);

				treeNode.setDomNode(td);
				td.style.background = 'url(' + iwconst.GLOBAL_APP_URL + 'img/controls/treeview/sprite-treeview.gif) no-repeat top left';

				if (i == (depth - 2))
				{
					if (node.hasChildren())
					{
						if (treeNode.isExpanded())
						{
							td.title = 'collapse';

							if (islastchild.charAt(i) == '1')
							{
								// ********************************************************************
								// * lastParentExpandedImageURL
								// ********************************************************************
								td.style.backgroundPosition = '0 -388px';
							}
							else
							{
								// ********************************************************************
								// * parentExpandedImageURL
								// ********************************************************************
								td.style.backgroundPosition = '0 -532px';
							}
						}
						else
						{
							td.title = 'expand';

							if (islastchild.charAt(i) == '1')
							{
								// ********************************************************************
								// * lastParentCollapsedImageURL
								// ********************************************************************
								td.style.backgroundPosition = '0 -316px';
							}
							else
							{
								// ********************************************************************
								// * parentCollapsedImageURL
								// ********************************************************************
								td.style.backgroundPosition = '0 -460px';
							}
						}

						td.style.cursor = 'pointer';
						td.onclick = function()
						{
							handleClick(this);
						}.iwclosure(treeNode);
					}
					else
					{
						if (islastchild.charAt(i) == '1')
						{
							// ********************************************************************
							// * lastChildImageURL
							// ********************************************************************
							td.style.backgroundPosition = '0 -244px';
						}
						else
						{
							// ********************************************************************
							// * childImageURL
							// ********************************************************************
							td.style.backgroundPosition = '0 -172px';
						}
					}
				}
				else
				{
					if (islastchild.charAt(i) == '0')
					{
						// ********************************************************************
						// * backgroundLineImageURL
						// ********************************************************************
						// td.style.backgroundImage = 'url(' + backgroundLineImageURL + ')';
						// divSpacer.style.backgroundPosition = '0 0';

						td.style.backgroundPosition = '0 0';
						td.style.backgroundRepeat = 'repeat-y';
					}
					else
					{
						// ********************************************************************
						// * blankImageURL
						// ********************************************************************
						td.style.backgroundPosition = '0 -100px';
					}
				}
				// ********************************************************************
				// * The display attribute of the image has to be set to 'block' after
				// * the src attribute has been set. Otherwise the image cell grows up
				// * when the doctype of the page is set to strict. This happens
				// * because the image is normally an inline-element.
				// ********************************************************************
				// image.style.display = 'block';
			}
		}

		if (isHidden)
		{
			treeNode.getContainer().style.display = 'none';
			treeNode.getContainer().style.visibility = 'hidden';
		}

		if (node.hasChildren())
		{
			depth++;
			var children = node.getChildren();

			for ( var i = 0; i < children.length; i++)
			{
				var child = children[i];
				var s = islastchild;
				if (i == (children.length - 1))
				{
					s += '1';
				}
				else
				{
					s += '0';
				}
				createChildDiv(treeNode, child, depth, s, (isHidden || treeNode.isCollapsed()));
			}
		}
	}

	// ********************************************************************
	// * Event functions
	// ********************************************************************

	/**
	 * The <code>onNodeClick</code> event is fired after a node has been clicked.
	 * 
	 * <p>
	 * Register an event listener with
	 * <code>IWEventManager.addListener(yourTreeview, 'onnodeclick', yourHandlerMethod(event));</code> to receive the
	 * <code>IWTreeNodeClickedEvent</code>.
	 * </p>
	 * 
	 * @event onNodeClick
	 * @param {IWTreeNodeClickedEvent}
	 *            event the node click event
	 * @return {void}
	 */
	this.triggerOnNodeClick = function(event)
	{
		IWEventManager.trigger(this, 'onnodeclick', event);
	};

	/**
	 * The <code>onFormatNode</code> event is fired before a node is appended to the tree.
	 * 
	 * <p>
	 * Register an event listener with
	 * <code>IWEventManager.addListener(yourTreeview, 'onformatnode', yourHandlerMethod(event));</code> to receive the
	 * <code>IWFormatNodeEvent</code>.
	 * </p>
	 * 
	 * @event onFormatNode
	 * @param {IWFormatNodeEvent}
	 *            event the format node event
	 * @return {void}
	 */
	this.triggerOnFormatNode = function(event)
	{
		IWEventManager.trigger(this, 'onformatnode', event);
	};

	// ********************************************************************
	// * Private functions
	// ********************************************************************

	/**
	 * Collapse the node and all children nodes will become invisible.
	 * 
	 * @private
	 * @param {IWTreeNode}
	 *            treeNode
	 * @return {void}
	 */
	function collapse(treeNode)
	{
		// logger.debug('Calling collapse with ' + treeNode);

		collapseChildren(treeNode);

		treeNode.setState('collapsed');
		// treeNode.getTreeImage().alt = 'collapse';

		var domNode = treeNode.getDomNode();
		domNode.title = 'expand';

		if (treeNode.isLastChild() == true)
		{
			// treeNode.getTreeImage().src = lastParentCollapsedImageURL;
			domNode.style.backgroundPosition = '0 -316px';
		}
		else
		{
			// treeNode.getTreeImage().src = parentCollapsedImageURL;
			domNode.style.backgroundPosition = '0 -460px';
		}
	}

	/**
	 * Recursive method to collapse all child nodes.
	 * 
	 * @private
	 * @param {IWTreeNode}
	 *            treeNode
	 * @return {void}
	 */
	function collapseChildren(treeNode)
	{
		// logger.debug('Calling collapseChildren with ' + treeNode);

		var children = treeNode.getChildren();

		for ( var i = 0; i < children.length; i++)
		{
			var treeNode = children[i];

			treeNode.getContainer().style.display = 'none';
			treeNode.getContainer().style.visibility = 'hidden';

			if (treeNode.hasChildren())
			{
				collapseChildren(treeNode);
			}
		}
	}

	/**
	 * Expands the treenode and all children will become visible.
	 * 
	 * @private
	 * @param {IWTreeNode}
	 *            treeNode
	 * 
	 * @return {void}
	 */
	function expand(treeNode)
	{
		// logger.debug('Calling expand with ' + treeNode);

		expandChildren(treeNode);

		treeNode.setState('expanded');

		var domNode = treeNode.getDomNode();
		domNode.title = 'collapse';

		if (treeNode.isLastChild() == true)
		{
			// treeNode.getTreeImage().src = lastParentExpandedImageURL;
			domNode.style.backgroundPosition = '0 -388px';
		}
		else
		{
			// treeNode.getTreeImage().src = parentExpandedImageURL;
			domNode.style.backgroundPosition = '0 -532px';
		}
	}

	/**
	 * Recursive function to expand all children.
	 * 
	 * @private
	 * @param {IWTreeNode}
	 *            treeNode
	 * @return {void}
	 */
	function expandChildren(treeNode)
	{
		// logger.debug('Calling expandChildren with ' + treeNode);

		var children = treeNode.getChildren();

		for ( var i = 0; i < children.length; i++)
		{
			var treeNode = children[i];

			treeNode.getContainer().style.display = 'block';
			treeNode.getContainer().style.visibility = 'visible';

			if (treeNode.hasChildren() && treeNode.isExpanded())
			{
				expandChildren(treeNode);
			}
		}
	}

	// ********************************************************************
	// * Constructor implementation
	// ********************************************************************

	buildGUI(container);
}
