var MediaMapMain = {
	
	version: "2.0",
	lastUpdate: "26.05.2008",
	
	mapContainer: null,
	mapBounds: null,
	mapClusterer: null,
	loader: null,
	paths: {},
	searchForms: {},
	entriesNum: 0,
	loadetEntries: {},
	loadetCats: {},
	listEntries: {},
	
	/*
	@desc:		Installiert die Google Karte, l�d Framework Module und JS Pfade nach.
	@return:	Karte, alle Module und JS Pfade.
	*/
	load: function(){
		//Module nachladen
		var path = $("mediaMapMain").src.replace(/main\.js(\?.*)?$/,"");
		var includes = $("mediaMapMain").src.match(/\?.*load=([a-z,]*)/);
			(includes ? includes[1] : "cluster,tools,search,epoly,route,tpl,tooltip,overlay").split(",").each( //
				function(include) {Scriptaculous.require(path+include+".js")} );//
			//JS Pfade
			//this.paths.ajax 	 = url+"ajax";
			this.paths.root 	 = path.replace(/\/_portal\/js\//,"");
			this.paths.gfx 		 = this.paths.root+"/gfx";
			this.paths.globalgfx = this.paths.root.replace(/\/module\/gmap2/,"")+"/gfx";
			
		this.initSearchForms();
		this.initContainer();
	},
	
	globalPath: function(url){
		this.paths.ajax = url+"/ajax";
	},
	
	initSearchForms: function(){
		
		this.searchForms.btns  = $$("#headerSearch div.btnSearch");
		this.searchForms.forms = $$("#panelSearch div.formSearch");
		
		this.keyboardEvent = this.keyboardDown.bindAsEventListener(this);
		Event.observe("panelSearch","keydown",this.keyboardEvent);

		for(i=0;i<this.searchForms.btns.length;i++){	
			this.searchForms.btns[i].key = i;	
			this.searchForms.btns[i].onclick = function(){
				for(var i=0;i<3;i++){
					if(this.key == i){
						this.addClassName("defaultBtn");
						MediaMapMain.searchForms.forms[this.key].show();
					} else {
						MediaMapMain.searchForms.btns[i].removeClassName("defaultBtn");
						MediaMapMain.searchForms.forms[i].hide();
					}
				}
			}
			if(this.searchForms.btns[i].hasClassName("defaultBtn"))
				this.searchForms.forms[i].show();
			else 
				this.searchForms.forms[i].hide();
		}
	},
	
	keyboardDown: function(event){
		var key=event.keyCode;
		
		if(key==13){
			for(i=0;i<this.searchForms.forms.length;i++){
				if(MediaMapMain.searchForms.forms[i].visible()){
					switch(i){
						case 0: MediaMapSearch.doMap(); break;
						case 1: MediaMapSearch.doWord(); break;
						case 2: MediaMapSearch.doCircle(); break;
					}
				}
			}
		}
	},
	
	initContainer: function(){
		this.opinions  = $$("div.opinion");
	},
	
	setSearchStart: function(obj){
		this.startSearch = {};
		this.startSearch.num = 0;
		// Kategorie
		if(!Object.isUndefined(obj.cat)){
			this.startSearch.cat = obj.cat;
		}
		// Suchwort
		if(!Object.isUndefined(obj.string) && obj.string == "all"){
			this.startSearch.searchAll = true;
		} else if(!Object.isUndefined(obj.string)){
			this.startSearch.string = obj.string;
		}
		// Geosuchwort
		if(!Object.isUndefined(obj.geostring)){
			this.startSearch = new GClientGeocoder();
			this.startSearch.geostring = obj.geostring;
			this.startSearch.getLocations(this.startSearch.geostring, function(result){
				var data = MediaMapSearch.createGeodata(result,0);
					MediaMapMain.startSearch.area = new GLatLngBounds();
				var radius = 10;
				var segments = 20;
				var point = new GLatLng(data.lat,data.lng);
			    var latConv = point.distanceFrom(new GLatLng(point.lat()+0.1,point.lng()))/100;
			    var lngConv = point.distanceFrom(new GLatLng(point.lat(),point.lng()+0.1))/100;
			    var points = [];
			    var step = parseInt(360/segments);
	    
			    for(var i=0; i<=360; i+=step){
			    	var contourPoint = new GLatLng(point.lat() + (radius/latConv *Math.cos(i * Math.PI/180)),
			                                   		point.lng() + (radius/lngConv *Math.sin(i * Math.PI/180)));
			    	points.push(contourPoint);
			    	MediaMapMain.startSearch.area.extend(contourPoint);
			    }
				// MediaMapSearch.drawRadius(points);
				// zum ergebniss switchen
				var zoom  = MediaMapMain.mapContainer.getBoundsZoomLevel(MediaMapMain.startSearch.area);
					MediaMapSearch.setCenter({lat:data.lat,lng:data.lng,zoom:zoom});
			});
		}
	},
	
	checkStartSearch: function(id,point){
		if(this.startSearch){	
			var ele = MediaMapMain.loadetEntries[id];
		
			if(this.startSearch.area && this.startSearch.area.containsLatLng(point)){					
					MediaMapSearch.addResultEntrie(id,{onclick:"MediaMapTools.showEntrie('"+id+"')"},ele.title);
					this.startSearch.num++;
			} else {
			
				if(this.startSearch.string)
					var a = new RegExp(this.startSearch.string,'ig');
				if(this.startSearch.searchAll && this.startSearch.cat == ele.icon || this.startSearch.cat == ele.icon && a.test(ele.title)){
					MediaMapSearch.addResultEntrie(id,{onclick:"MediaMapTools.showEntrie('"+id+"')"},ele.title);
					this.startSearch.num++;
				}
			}
		}
	},
	
	displayStartSearch: function(){
		if(this.startSearch && this.startSearch.num>0){
			MediaMapSearch.displayResults("Es wurden "+this.startSearch.num+" Ergebnisse gefunden.");
		} else if(this.startSearch){
			MediaMapSearch.addResultEntrie("",{className:"header headerText"},"Es konnte kein Ergebniss gefunden werden.<br>Aber es sind "+MediaMapMain.entriesNum+" andere Einträge vorhanden.");
			MediaMapSearch.updatePanel(this.entriesNum+" Einträge verfügbar.");
			MediaMapTools.toggleTabs("search");
		} else {
			MediaMapSearch.updatePanel(this.entriesNum+" Einträge verfügbar.");
		}
	},
	
	/*
	@desc:		Erstellt die Karte und setzt bestimmte Einstellungen.
	@return:	Fertige Karte mit geladenen Inhalt.
	*/
	
	createMediaMap: function(lat,lng,zoom){
		//Karte den Platzhalter zuweisen
		this.mapContainer = new GMap2($("mapContainer"));
		//Default Europa Mittelpunkt
		//this.mapContainer.setCenter(new GLatLng(49.837982, 2.109375), 3);
		this.mapContainer.setCenter(new GLatLng(parseFloat(lat),parseFloat(lng)), parseInt(zoom));	
		this.mapSettings();
		//Karten Navigation
		this.mapContainer.addControl(new GLargeMapControl());
		this.mapContainer.addControl(new GHierarchicalMapTypeControl());
		this.mapContainer.addMapType(G_PHYSICAL_MAP);
		this.mapContainer.addControl(new MapContent());
		this.mapContainer.addControl(new MapLoader());
	
		//Special Module
		this.mapClusterer	= new Clusterer(this.mapContainer);
		this.mapBounds 		= new GLatLngBounds();
		MediaMapRouter.init();
		
		//Karten Inhalt erstellen
		this.createCluster();
		this.loadEntries.delay(2);
	},
	
	//Karteresetten
	resetMap: function(){
		this.mapContainer.checkResize();
		this.mapContainer.returnToSavedPosition();
	},
	
	zoomIn: function(){
		this.mapContainer.setZoom(this.mapContainer.getZoom()+2);
	},
		
	mapSettings: function(){
		//Karten Einstellungen
		this.mapContainer.enableDoubleClickZoom();
		//this.mapContainer.enableContinuousZoom();
		new GKeyboardHandler(this.mapContainer);
		//Mouse Scroll Zoomer
		
		if(!Prototype.Browser.IE){
			this.mapContainer.enableScrollWheelZoom();
			GEvent.addDomListener(this.mapContainer.getContainer(), "DOMMouseScroll", MediaMapTools.wheelEvent);
		}
		//this.mapContainer.getContainer().onmousewheel = MediaMapTools.wheelEvent; 	
		//Karten koordinaten anzeige
		GEvent.addListener(this.mapContainer, "moveend", this.updateStatusBar );
		GEvent.addListener(this.mapContainer, "zoomend", this.updateStatusBar );

	},
		
	/*
	@desc:		Aktualisiert aktuelle Karteninfos wie L�ngen-& Breitengrad und Zoomstufe.
	@return:	Koordinaten in einem Div Platzhalter unterhalb der Karte.
	*/
	updateStatusBar: function() {
		var center 	= MediaMapMain.mapContainer.getCenter();
		var zoom 	= MediaMapMain.mapContainer.getZoom();
			if(center.y != "NaN"){
				$("mediaMapInfos").update("MediaMapInfos: ("+center.y.toFixed(6)+","+((!center.x.length)?center.x.toFixed(6):center.x)+") Zoomstufe: "+ zoom);
			}
	},
		
	/*
	@desc:		Parst alle Eintr�ge via DOM zugriff, erstellt f�r jeden Eintrag ein Array mit L�ngen-& Breitengrad, Titel und Kategorie.
	@return:	Inhalt f�r die Karte.
	*/
	loadEntries: function(){
		document.observe("entries:loaded",function(){
			//MediaMapMain.setBounds();
			
			MediaMapMain.displayStartSearch();
		
			MediaMapTools.hideMapInfo();
			MediaMapMain.initListEntries();
		});
		
		MediaMapMain.initEntries();

		MediaMapMain.createMapMarker();
	},
	
	createMapMarker: function(){
		var i=0;
		var j=0;
		for (var id in MediaMapMain.loadetEntries){
			if (MediaMapMain.loadetEntries.hasOwnProperty(id) && (typeof MediaMapMain.loadetEntries[id] == "object") && !MediaMapMain.loadetEntries[id].marker){
				var ele = MediaMapMain.loadetEntries[id];

				if(ele.lat != 0){
					
					var point 	= new GLatLng(ele.lat,ele.lng);
					
					MediaMapMain.checkStartSearch(id,point);
						
					MediaMapMain.createMapHTMLEntrie(id);
					MediaMapMain.createListHTMLEntrie(id);
					MediaMapMain.entriesNum++

					//Marker Icon
					var icon	= MediaMapMain.createIcon(ele.icon,(ele.vid_url.length > 1?"video":"none"));	
		
					//Marker mit Eigenschaften erstellen
					var marker 	= MediaMapMain.createMarker(point,icon,id);
						MediaMapMain.mapBounds.extend(point);
						//Marker über den Cluster auf die Karte setzen
						MediaMapMain.mapClusterer.AddMarker(marker,MediaMapMain.getClusterTitle(id));
						//MediaMapMain.mapContainer.addOverlay(marker);
				};
			i=i+1;
			}
			if(i>150){
				window.clearTimeout(MediaMapMain.loader);
				i=0;
				MediaMapMain.loader = window.setTimeout(function(){
					MediaMapMain.createMapMarker();
				},200);
				break;
			} else {
				window.clearTimeout(MediaMapMain.loader);
				j=j+1;
				nums = Object.keys(MediaMapMain.loadetEntries).size();
				if(nums == j){
					$("mediaMap").fire("entries:loaded");
				}
			}
		};
	},
		
	getClusterTitle: function(id){
		var ele = this.loadetEntries[id];
	
		var html = "<div class=\"entrie\" onclick=\"MediaMapTools.showEntrie('"+id+"')\">";
			html+= "<img src=\""+this.paths.globalgfx+"/gmapcats/"+ele.icon+".png\" title=\""+ele.catname+"\" class=\"icon\">"+ele.title.truncate()+"</div>";
	return html;
	},
	
	createMapHTMLEntrie: function(id){
		// element
		var ele = this.loadetEntries[id];
		// kategorie
		var cat = this.loadetCats[ele.icon];
		
		// Map Ansicht -> Kategorie Container
		if(!$("mapDivCat_"+cat.id)){
			$("mapAllEntries").insert(
				new Element("div",{id:"mapDivCat_"+cat.id}).insert(
					new Element("div",{id:"mapDivListHeader_"+cat.id,className:"header"}).insert(
						new Element("div",{className:"headerCheckbox",title:"Einträge auf der Karte ein & ausblenden!"}).insert(
							new Element("input",{id:"mapDivListCheckbox_"+cat.id,type:"checkbox",className:"checkbox",checked:true,onclick:"MediaMapTools.toggleMapCat(this.checked,'"+cat.icon+"','"+cat.id+"');"})
						)
					).insert(
						new Element("div",{className:"headerText",onclick:"MediaMapTools.toggleListCat('"+cat.id+"');",onmouseover:"MediaMapTools.showTooltip(this,'"+cat.nums+"','"+ele.icon+"');"}).insert(
							new Element("img",{id:"mapDivListImg_"+cat.id,border:"0",className:"img",src:this.paths.gfx+"/btns/list_plus.gif"})
						).insert(cat.name+" ("+cat.nums+")")
					)
				).insert(
					new Element("div",{id:"mapDivListContainer_"+cat.id,className:"container",style:"display:none;"})
				)
			);
			//id:"mapDivListHeaderText_"+cat.id,
			//$("mapDivListHeaderText_"+cat.id).onclick = function(){MediaMapTools.toggleListCat(cat.id);}
			//$("mapDivListHeaderText_"+cat.id).onmouseover = function(){MediaMapTools.showTooltip(this,cat.nums,ele.icon);}
			// IE input check
			$("mapDivListCheckbox_"+cat.id).checked = true;
			//$("mapDivListCheckbox_"+cat.id).onclick = function(){MediaMapTools.toggleMapCat($("mapDivListCheckbox_"+cat.id).checked,cat.icon,cat.id);}
		}
		// Map Ansicht -> Eintrag
		var className = !ele.vid_url.empty()?" video":"";
		$("mapDivListContainer_"+cat.id).insert(
			new Element("div",{className:"entrie"+className,onclick:"MediaMapTools.showEntrie('"+id+"');"}).insert(ele.title)
		);
		//id:"mapDivEntrie_"+id
		/*$("mapDivEntrie_"+id).onclick = function(){
			var id = this.id.gsub("mapDivEntrie_","");
			MediaMapTools.showEntrie(id);
		};*/
	},
	
	/*
	@desc:		Erstellt einen Marker.
	@param:		GLatLng(),GIcon(),string Titel,string Template
	@return:	Ein Marker mit seinen Eigenschaften.
	*/
	createMarker: function(point,icon,id){
		//Marker erstellen Eigenschaften & Event Listener
		this.loadetEntries[id].marker = new GMarker(point,{icon:icon,title:this.loadetEntries[id].title+" | "+this.loadetEntries[id].catname});
			//markers[id] = marker;
		
			GEvent.addListener(this.loadetEntries[id].marker, "click", function() {		
				MediaMapTooltip.open(id);
			});
			/*GEvent.addListener(marker,"infowindowclose", function() {
				//GmapMain.enlargeMap();
			});
			GEvent.addListener(marker,"mouseover", function() {
				tt.showNameTooltip(marker);
			});*/
		return this.loadetEntries[id].marker;
	},
	
	/*
	@desc:		Setzt neuen Mittelpunkt. Errechnet durch die vorher erstellt Area der geladenen Marker. Zudem wird der neue Mittelpunkt temporär gespeichert.
	@return:	Neuer Mittelpunkt mit passender Zoomstufe, somit sind alle aktuellen Marker auf der Karte vorhanden.
	*/
	setBounds: function(){
		//Bounds Mittelpunkt und Zoomstufe anzeigen
		this.mapContainer.setCenter(this.mapBounds.getCenter(),this.mapContainer.getBoundsZoomLevel(this.mapBounds));		
		//Position speichern
		this.mapContainer.savePosition();		
	},
	
	/*
	@desc:		Einstellungen f�r den Marker Cluster.
	@return:	Cluster Eigenschaften mit folgenden Einstellungen.
	*/
	createCluster: function(){
		this.mapClusterer.icon = this.createIcon("cluster","none");
		this.mapClusterer.title = "Einträge aufklappen";
		this.mapClusterer.maxVisibleMarkers = 5;//
		this.mapClusterer.gridSize = 5;
		this.mapClusterer.minMarkersPerClusterer = 2;//minimale Zahl damit ein Cluster erstellt wird
		this.mapClusterer.maxLinesPerInfoBox = 6;//maximale Listeneintr�ge
	},
	
	/*
	@desc:		Erstellt jeweils ein Icon f�r den jeweiligen Markeraufruf.
	@param:		Kategorie, bool
	@return:	Icon Array Object 
	*/
	createIcon: function(iconName, video){
		//Icon Handler Default, Cluster & Hotels + Video
		var baseIcon = new GIcon();
			baseIcon.image = this.paths.globalgfx+"/gmapmarker/red.png";
			baseIcon.shadow = this.paths.globalgfx+"/gmapmarker/shadow.png";
			baseIcon.iconSize = new GSize(25, 25);
			baseIcon.shadowSize = new GSize(25, 25);
			//mittel punkt des icons
			baseIcon.iconAnchor = new GPoint(7, 25);
			//(left,top) des tooltips in pixel
			baseIcon.infoWindowAnchor = new GPoint(15, 1);
	
		if(iconName == "cluster"){
			var icon = new GIcon(baseIcon);
				icon.image = this.paths.globalgfx+"/gmapmarker/cluster.png";
				icon.shadow = this.paths.globalgfx+"/gmapmarker/shadow_cluster.png";
				icon.iconSize = new GSize(35, 35);
				icon.shadowSize = new GSize(35, 35);
				icon.infoWindowAnchor = new GPoint(22, 8);
		} else {
			if(video == "none") {
				var icon = new GIcon(baseIcon);
					icon.image = this.paths.globalgfx+"/gmapmarker/"+ iconName +".png";
					icon.shadow = this.paths.globalgfx+"/gmapmarker/shadow.png";
			} else {
				var icon = new GIcon(baseIcon);
					icon.image = this.paths.globalgfx+"/gmapmarker/"+ iconName +"_video.png";
					icon.shadow = this.paths.globalgfx+"/gmapmarker/shadow_video.png";
					icon.iconSize = new GSize(35, 35);
					icon.shadowSize = new GSize(35, 35);
					icon.infoWindowAnchor = new GPoint(22, 8);
			}
		}
	return icon[iconName] = icon;
	},
	
	showLegend: function(art){
		if($("legend").style.display == "block" && art != "on" || art == "off"){
			$("legend").style.display = "none";
			$("legendBtn").innerHTML = "Legende &ouml;ffnen";
		} else {
			toggleMap("show");
			$("legend").style.display = "block";
			$("legendBtn").innerHTML = "Legende schlie&szlig;en";
		}
	},

	setMarkerVisits: function(id){
		var str_post = "id=" + id;
		new Ajax.Request(gmap_path+"js/ajax/setvisits.php",
			{
				method:"post",
				postBody: str_post,
				onSuccess: function(t){
					if(t.responseText != "1 Klick mehr!") {
						alert(t.responseText);
					}
				},
				onFailure: function(t){
					alert(t.responseText);
				}
		});
	},

	initListEntries: function(){
		var entries = $$("#listEntries .entrie");
		for(i=0;i<entries.length;i++){
			this.listEntries[i] = {id:entries[i].id.gsub("list_","")};
		}
		this.listEntries.nums = i;
	},
	
	createListHTMLEntrie: function(id){
		var ele = this.loadetEntries[id];
		var cat = this.loadetCats[ele.icon];
		
		if(!$("listCat_"+cat.id)){
			$("listEntries").insert(
				new Element("div",{id:"listCat_"+cat.id}).insert(
					new Element("div",{className:"catHeader"}).insert(
						new Element("img",{src:this.paths.globalgfx+"/gmapcats/"+cat.icon+".png",style:"vertical-align:top;"})
					).insert("&nbsp<b>"+cat.name+"</b> ("+cat.nums+" Einträge)")
				).insert(
					new Element("div",{id:"listCatEntries_"+cat.id})
				)
			)
		
		}
		
		// Listen Ansicht -> Eintrag
		var vidIcon = !ele.vid_url.empty()?" vid":"";
		$("listCatEntries_"+cat.id).insert(
			new Element("div",{id:"list_"+id,className:"entrie"}).insert(
				new Element("div",{id:"listTitle_"+id,className:"entrieTitle"+vidIcon}).insert(
					new Element("img",{border:"0",className:"img",src:this.paths.gfx+"/btns/list_plus.gif"})
				).insert("&nbsp;<b>"+ele.title+"</b>")// / "+ele.catname
			).insert(
				new Element("div",{id:"listContent_"+id,className:"entrieContent",style:"display:none;"})
			)
		);
		$("listTitle_"+id).onclick = function(){
			var id = this.id.gsub("listTitle_","");
			MediaMapMain.showListEntrie(id);
		};
	},
	
	showListEntrie: function(id,bool){
	
		MediaMapTools.setEntrieVisit(id);
		
		if(MediaMapMain.loadetEntries[id].vid_url.length > 1){
			MediaMapTpls.get("list","video","MediaMapMain.showListVideo('"+id+"')");
		} else {
			MediaMapTpls.get("list","normal","MediaMapMain.showListNormal('"+id+"')");
		}
		
		if(bool){
			this.listBool = true;
		}
	},
	
	handleListEntries: function(id){
		for(i=0;i<this.listEntries.nums;i++){
			if(id == this.listEntries[i].id){
				$("listTitle_"+id).hide();
				$("listContent_"+id).show();
				
				if(this.listBool){
					this.listBool = false;
					var top = $("list_"+id).offsetTop;
					var offset = $("listEntries").offsetTop;
						top = top-offset;
					$("listEntries").scrollTop = top;
				}
			} else {
				this.hideListEntrie(this.listEntries[i].id);
			}
		}		
	},
	
	hideListEntrie: function(id){
		$("listContent_"+id).hide();
		$("listTitle_"+id).show();	
	},
	
	showListNormal: function(id){
		var	ele = this.loadetEntries[id];
		
		if(ele.listentrie.empty()){
	
			var html = new Template(MediaMapTpls.loadet["list/normal"]);
	
			var show = 
				{
					title:ele.title,
					stars:MediaMapTooltip.getStars(ele.stars,id),
					icon:ele.icon,
					pic:MediaMapTooltip.getPic(id),
					btn_webcall:MediaMapTooltip.getWebcall(id),
					btn_email:MediaMapTooltip.getEmail(id),
					btn_hp:MediaMapTooltip.getHp(id),
					btn_route:MediaMapTooltip.getRoute(id),
					btn_db:MediaMapTooltip.getDB(id),
					btn_booking:MediaMapTooltip.getBooking(id),
					cat_name:ele.catname,
					text:MediaMapTooltip.getDescription(id),
					street:ele.street,
					zip:ele.zip,
					city:ele.city,
					tel:MediaMapTooltip.getTel(id),
					//fax:ele.fax,
					chars:MediaMapTooltip.getChars(id),
					charsOn:MediaMapTooltip.getCharsClass(id),
					copyright:MediaMapTooltip.getCopyright(id),
					array_id:id,
					spacer:""
				};
				if(!show.text.empty())
					show.spacer = "<div class=\"spacer\"></div>";
				
				$("listContent_"+id).insert(html.evaluate(show));
				ele.listentrie = "created";
		}
		this.handleListEntries(id);
	},
	
	showListVideo: function(id){
		var	ele = this.loadetEntries[id];
		
		if(ele.listentrie.empty()){
	
			var html = new Template(MediaMapTpls.loadet["list/video"]);
	
			var vid_wid = 128;
			var vid_hei = 96;
			var player_path = this.paths.root+"/flash/player.swf";
			var vars = "video_url="+ele.vid_url;
		
			var show = 
				{
					title:ele.title,
					stars:MediaMapTooltip.getStars(ele.stars,id),
					icon:ele.icon,
					
					vid_hei:vid_hei,
					vid_wid:vid_wid,
					player_path:player_path,
					vars:vars,
					
					btn_webcall:MediaMapTooltip.getWebcall(id),
					btn_email:MediaMapTooltip.getEmail(id),
					btn_hp:MediaMapTooltip.getHp(id),
					btn_route:MediaMapTooltip.getRoute(id),
					btn_db:MediaMapTooltip.getDB(id),
					btn_booking:MediaMapTooltip.getBooking(id),
					cat_name:ele.catname,
					text:MediaMapTooltip.getDescription(id),
					street:ele.street,
					zip:ele.zip,
					city:ele.city,
					tel:ele.tel,
					//fax:ele.fax,
					chars:MediaMapTooltip.getChars(id),
					charsOn:MediaMapTooltip.getCharsClass(id),
					copyright:MediaMapTooltip.getCopyright(id),
					array_id:id,
					spacer:""
				};	

				if(!show.text.empty())
					show.spacer = "<div class=\"spacer\"></div>";
				
				$("listContent_"+id).insert(html.evaluate(show));
				ele.listentrie = "created";
		}
		this.handleListEntries(id);
	}
};

MediaMapMain.load();