[Mapbender-commits] r2764 - in branches/2.5: core http/classes http/html http/javascripts http/php http/print

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Aug 11 04:21:14 EDT 2008


Author: christoph
Date: 2008-08-11 04:21:14 -0400 (Mon, 11 Aug 2008)
New Revision: 2764

Modified:
   branches/2.5/core/globalSettings.php
   branches/2.5/core/i18n.php
   branches/2.5/core/system.php
   branches/2.5/http/classes/class_kml.php
   branches/2.5/http/classes/class_locale.php
   branches/2.5/http/classes/class_wfs_conf.php
   branches/2.5/http/html/mod_treefolder2.php
   branches/2.5/http/javascripts/geometry.js
   branches/2.5/http/javascripts/map.js
   branches/2.5/http/javascripts/map.php
   branches/2.5/http/javascripts/mod_adminNavigation.js
   branches/2.5/http/javascripts/mod_usemap.php
   branches/2.5/http/php/mod_wfs_server.php
   branches/2.5/http/print/mod_printPDF_pdf.php
   branches/2.5/http/print/printPDF.conf
   branches/2.5/http/print/printPDF_b.conf
Log:
merged w/ trunk

Modified: branches/2.5/core/globalSettings.php
===================================================================
--- branches/2.5/core/globalSettings.php	2008-08-11 08:19:21 UTC (rev 2763)
+++ branches/2.5/core/globalSettings.php	2008-08-11 08:21:14 UTC (rev 2764)
@@ -1,4 +1,21 @@
 <?php
+# $Id: globalSettings.php 2739 2008-08-05 11:54:58Z christoph $
+# Copyright (C) 2002 CCGIS 
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
 //
 // start the session
 //
@@ -46,5 +63,4 @@
 //
 $con = db_connect($DBSERVER, $OWNER, $PW);
 db_select_db(DB, $con);
-
 ?>

Modified: branches/2.5/core/i18n.php
===================================================================
--- branches/2.5/core/i18n.php	2008-08-11 08:19:21 UTC (rev 2763)
+++ branches/2.5/core/i18n.php	2008-08-11 08:21:14 UTC (rev 2764)
@@ -1,8 +1,26 @@
 <?php
+# $Id: i18n.php 2739 2008-08-05 11:54:58Z christoph $
+# Copyright (C) 2002 CCGIS 
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
 	function _mb ($someString) {
 		if (USE_I18N) {
+//			$e = new mb_notice("Translating '" . $someString . "' to language " . $_SESSION["mb_locale"] . ": '" . _($someString) . "'");
 			return _($someString);
 		}
 		return $someString;
 	}
-?>
\ No newline at end of file
+?>

Modified: branches/2.5/core/system.php
===================================================================
--- branches/2.5/core/system.php	2008-08-11 08:19:21 UTC (rev 2763)
+++ branches/2.5/core/system.php	2008-08-11 08:21:14 UTC (rev 2764)
@@ -1,5 +1,5 @@
 <?php
-# $Id:$
+# $Id: system.php 2694 2008-07-22 08:09:46Z christoph $
 # Copyright (C) 2002 CCGIS 
 #
 # This program is free software; you can redistribute it and/or modify

Modified: branches/2.5/http/classes/class_kml.php
===================================================================
--- branches/2.5/http/classes/class_kml.php	2008-08-11 08:19:21 UTC (rev 2763)
+++ branches/2.5/http/classes/class_kml.php	2008-08-11 08:21:14 UTC (rev 2764)
@@ -16,6 +16,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
 require_once(dirname(__FILE__)."/../../core/globalSettings.php");
 
 class kml {
@@ -172,4 +173,4 @@
 
 } 
 // end class
-?>
\ No newline at end of file
+?>

Modified: branches/2.5/http/classes/class_locale.php
===================================================================
--- branches/2.5/http/classes/class_locale.php	2008-08-11 08:19:21 UTC (rev 2763)
+++ branches/2.5/http/classes/class_locale.php	2008-08-11 08:21:14 UTC (rev 2764)
@@ -100,15 +100,16 @@
 				}
 				
 				$locale = $this->systemLocales[$this->knownLanguages[$languageId]][$this->os];				
-				if (setlocale(LC_ALL, $locale)) {
-					$this->name = $locale;
+				$selectedLocale = setlocale(LC_MESSAGES, $locale);
+				if ($selectedLocale) {
+					$this->name = $selectedLocale;
 					$_SESSION["mb_lang"] = $languageId;
 					$_SESSION["mb_locale"] = $this->name;
 					$e = new Mb_notice("locale " . $this->name . " ok on " . $this->os);
 					// from http://de3.php.net/manual/de/function.gettext.php
-					bindtextdomain("Mapbender", dirname(__FILE__)."/../../resources/locale/");
-					textdomain("Mapbender");
-					
+					$path = bindtextdomain("Mapbender", dirname(__FILE__)."/../../resources/locale/");
+					$enc = bind_textdomain_codeset("Mapbender", "UTF-8");
+					$dom = textdomain("Mapbender");
 					return true;
 				}
 			}
@@ -212,4 +213,4 @@
 	    }		
 	}
 }
-?>
\ No newline at end of file
+?>

Modified: branches/2.5/http/classes/class_wfs_conf.php
===================================================================
--- branches/2.5/http/classes/class_wfs_conf.php	2008-08-11 08:19:21 UTC (rev 2763)
+++ branches/2.5/http/classes/class_wfs_conf.php	2008-08-11 08:21:14 UTC (rev 2764)
@@ -144,9 +144,13 @@
 									"f_label_id" => $row["f_label_id"],
 									"f_geom" => $row["f_geom"],
 									"f_show" => $row["f_show"],
+									"f_mandatory" => $row["f_mandatory"],
 									"f_respos" => $row["f_respos"],
+									"f_min_input" => $row["f_min_input"],
 									"f_form_element_html" => $row["f_form_element_html"],
 									"f_auth_varname" => $row["f_auth_varname"],
+									"f_detailpos" => $row["f_detailpos"],
+									"f_operator" => $row["f_operator"],
 									"f_show_detail" => $row["f_show_detail"]
 									);
 			array_push($elementArray, $currentElement);
@@ -373,4 +377,4 @@
 		}
 	}
 }
-?>
\ No newline at end of file
+?>

Modified: branches/2.5/http/html/mod_treefolder2.php
===================================================================
--- branches/2.5/http/html/mod_treefolder2.php	2008-08-11 08:19:21 UTC (rev 2763)
+++ branches/2.5/http/html/mod_treefolder2.php	2008-08-11 08:21:14 UTC (rev 2764)
@@ -1,610 +1,609 @@
-<?php
-# $Id$
-# http://www.mapbender.org/index.php/Mod_treefolder2.php
-# Copyright (C) 2007 Melchior Moos
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-$gui_id = $_SESSION["mb_user_gui"];
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
-<?php
-echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';
-?>
-<TITLE>Treefolder</TITLE>
-<?php
- include '../include/dyn_css.php';
-?>
-<script language='JavaScript'>
-
-function openwindow(Adresse) {
-Fenster1 = window.open(Adresse, "Informationen", "width=500,height=500,left=100,top=100,scrollbars=yes,resizable=no");
-Fenster1.focus();
-}
-</script>
-<script src="../javascripts/jsTree.js" type="text/javascript" language="JavaScript"></script>
-<?php
-echo "<script language='JavaScript'>";
-   $sql = "SELECT e_target FROM gui_element WHERE e_id = $1 AND fkey_gui_id = $2";
-   $v = array($_REQUEST['e_id_css'],$_SESSION["mb_user_gui"]);
-   $t = array('s','s');
-   $res = db_prep_query($sql,$v,$t);
-   $e_target = db_result($res,0,"e_target");
-   echo "mod_treeGDE_map = '".$e_target."';";
-echo "</script>";
-?>
-<SCRIPT language="JavaScript" type="text/javascript">
-
-var jst_container = "document.getElementById('treeContainer')";
-var jst_image_folder = imagedir;
-var jst_display_root = false;
-var defaultTarget = 'examplemain';
-var lock=false;
-var lock_update=false;
-var lock_check=false;
-var selectedMap=-1;
-var selectedWMS=-1;
-var selectedLayer=-1;
-var init=false;
-var errors = 0;
-var state=Array();
-var treeState = "";
-var arrNodes =
-[
-	['root_id', ['Layer','javascript:_foo()']
-
-	]
-];
-function _foo(){}
-
-// some defaults
-try{if (reverse){}}catch(e){reverse = 'false';}
-try{if (switchwms){}}catch(e){switchwms = 'true';}
-try{if (ficheckbox){}}catch(e){ficheckbox = 'false';}
-try{if (metadatalink){}}catch(e){metadatalink = 'false';}
-try{if (wmsbuttons){}}catch(e){wmsbuttons = 'false';}
-try{if (showstatus){}}catch(e){showstatus = 'false';}
-try{if (alerterror){}}catch(e){alerterror = 'false';}
-try{if (openfolder){}}catch(e){openfolder = 'false';}
-try{if (handlesublayer){}}catch(e){handlesublayer = 'false';}
-try{if (menu){}}catch(e){menu = '';}
-try {
-	if (redirectToMetadataUrl) {
-		if (redirectToMetadataUrl == "false") {
-			redirectToMetadataUrl = false;
-		}
-		else {
-			redirectToMetadataUrl = true;
-		}
-	}
-}
-catch (e) {
-	var redirectToMetadataUrl = true;
-}
-var defaultMetadataUrl = '../php/mod_layerMetadata.php?';
-if (redirectToMetadataUrl) {
-	defaultMetadataUrl += 'redirectToMetadataUrl=1';
-}
-else {
-	defaultMetadataUrl += 'redirectToMetadataUrl=0';
-}
-
-//menu elements
-var menu_move_up = ['menu_move_up', ['Move up&nbsp;','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];move_up(ids[0],ids[1],ids[2]);',,'move_up.png']];
-var menu_move_down = ['menu_move_down', ['Move down&nbsp;', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];move_down(ids[0],ids[1],ids[2]);',,'move_down.png']];
-var menu_delete = ['menu_delete', ['Remove&nbsp;', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];remove_wms(ids[0],ids[1],ids[2]);',,'delete_wms.png']];
-var menu_opacity_up = ['menu_opacity_up', ['Opacity up&nbsp;','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];opacity_up(ids[0],ids[1],ids[2]);',,'move_up.png']];
-var menu_opacity_down = ['menu_opacity_down', ['Opacity down&nbsp;','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];opacity_down(ids[0],ids[1],ids[2]);',,'move_down.png']];
-var menu_metalink = ['menu_metalink', ['Information&nbsp;', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];openwindow(defaultMetadataUrl + "&id="+parent.mb_mapObj[ids[0]].wms[ids[1]].objLayer[ids[2]].layer_uid);',,'info.png']];
-var menu_zoom = ['menu_zoom', ['Zoom&nbsp;', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];zoomToLayer(ids[0],ids[1],ids[2]);',,'zoom.png']];
-var menu_hide = ['menu_hide', ['Hide menu&nbsp;', 'javascript:hideMenu()',,'hide.png']];
-//var menu_wms_switch = ['menu_zoom', ['Zoom&nbsp;', 'javascript:var sd = "{@strData}";eval(eval(sd.substr(0, sd.length-6))[1][1]);openwindow(defaultMetadataUrl + "&id="+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_uid);',,'info.png']];
-//var menu_layer_switch = ['menu_zoom', ['Zjjj&nbsp;', 'javascript:var sd = "{@strData}";eval(eval(sd.substr(0, sd.length-6))[1][1]);openwindow(defaultMetadataUrl + "&id="+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_uid);',,'info.png']];
-//var menu_info_switch = ['menu_zoom', ['Zmn&nbsp;', 'javascript:var sd = "{@strData}";eval(eval(sd.substr(0, sd.length-6))[1][1]);openwindow(defaultMetadataUrl + "&id="+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_uid);',,'info.png']];
-
-parent.eventAfterLoadWMS.register(reloadTree);
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/Mod_treefolder2.php
+# Copyright (C) 2007 Melchior Moos
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+$gui_id = $_SESSION["mb_user_gui"];
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<HTML>
+<HEAD>
+<?php
+echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';
+?>
+<TITLE>Treefolder</TITLE>
+<?php
+ include '../include/dyn_css.php';
+?>
+<script language='JavaScript'>
+
+function openwindow(Adresse) {
+Fenster1 = window.open(Adresse, "Informationen", "width=500,height=500,left=100,top=100,scrollbars=yes,resizable=no");
+Fenster1.focus();
+}
+</script>
+<script src="../javascripts/jsTree.js" type="text/javascript" language="JavaScript"></script>
+<?php
+echo "<script language='JavaScript'>";
+   $sql = "SELECT e_target FROM gui_element WHERE e_id = $1 AND fkey_gui_id = $2";
+   $v = array($_REQUEST['e_id_css'],$_SESSION["mb_user_gui"]);
+   $t = array('s','s');
+   $res = db_prep_query($sql,$v,$t);
+   $e_target = db_result($res,0,"e_target");
+   echo "mod_treeGDE_map = '".$e_target."';";
+echo "</script>";
+?>
+<SCRIPT language="JavaScript" type="text/javascript">
+
+var jst_container = "document.getElementById('treeContainer')";
+var jst_image_folder = imagedir;
+var jst_display_root = false;
+var defaultTarget = 'examplemain';
+var lock=false;
+var lock_update=false;
+var lock_check=false;
+var selectedMap=-1;
+var selectedWMS=-1;
+var selectedLayer=-1;
+var init=false;
+var errors = 0;
+var state=Array();
+var treeState = "";
+var arrNodes =
+[
+	['root_id', ['Layer','javascript:_foo()']
+
+	]
+];
+function _foo(){}
+
+// some defaults
+try{if (reverse){}}catch(e){reverse = 'false';}
+try{if (switchwms){}}catch(e){switchwms = 'true';}
+try{if (ficheckbox){}}catch(e){ficheckbox = 'false';}
+try{if (metadatalink){}}catch(e){metadatalink = 'false';}
+try{if (wmsbuttons){}}catch(e){wmsbuttons = 'false';}
+try{if (showstatus){}}catch(e){showstatus = 'false';}
+try{if (alerterror){}}catch(e){alerterror = 'false';}
+try{if (openfolder){}}catch(e){openfolder = 'false';}
+try{if (handlesublayer){}}catch(e){handlesublayer = 'false';}
+try{if (menu){}}catch(e){menu = '';}
+try {
+	if (redirectToMetadataUrl) {
+		if (redirectToMetadataUrl == "false") {
+			redirectToMetadataUrl = false;
+		}
+		else {
+			redirectToMetadataUrl = true;
+		}
+	}
+}
+catch (e) {
+	var redirectToMetadataUrl = true;
+}
+var defaultMetadataUrl = '../php/mod_layerMetadata.php?';
+if (redirectToMetadataUrl) {
+	defaultMetadataUrl += 'redirectToMetadataUrl=1';
+}
+else {
+	defaultMetadataUrl += 'redirectToMetadataUrl=0';
+}
+
+//menu elements
+var menu_move_up = ['menu_move_up', ['Move up&nbsp;','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];move_up(ids[0],ids[1],ids[2]);',,'move_up.png']];
+var menu_move_down = ['menu_move_down', ['Move down&nbsp;', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];move_down(ids[0],ids[1],ids[2]);',,'move_down.png']];
+var menu_delete = ['menu_delete', ['Remove&nbsp;', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];remove_wms(ids[0],ids[1],ids[2]);',,'delete_wms.png']];
+var menu_opacity_up = ['menu_opacity_up', ['Opacity up&nbsp;','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];opacity_up(ids[0],ids[1],ids[2]);',,'move_up.png']];
+var menu_opacity_down = ['menu_opacity_down', ['Opacity down&nbsp;','javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];opacity_down(ids[0],ids[1],ids[2]);',,'move_down.png']];
+var menu_metalink = ['menu_metalink', ['Information&nbsp;', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];openwindow(defaultMetadataUrl + "&id="+parent.mb_mapObj[ids[0]].wms[ids[1]].objLayer[ids[2]].layer_uid);',,'info.png']];
+var menu_zoom = ['menu_zoom', ['Zoom&nbsp;', 'javascript:var sd = "{@strData}";var ids=eval(sd.substr(0, sd.length-6))[1][7];zoomToLayer(ids[0],ids[1],ids[2]);',,'zoom.png']];
+var menu_hide = ['menu_hide', ['Hide menu&nbsp;', 'javascript:hideMenu()',,'hide.png']];
+//var menu_wms_switch = ['menu_zoom', ['Zoom&nbsp;', 'javascript:var sd = "{@strData}";eval(eval(sd.substr(0, sd.length-6))[1][1]);openwindow(defaultMetadataUrl + "&id="+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_uid);',,'info.png']];
+//var menu_layer_switch = ['menu_zoom', ['Zjjj&nbsp;', 'javascript:var sd = "{@strData}";eval(eval(sd.substr(0, sd.length-6))[1][1]);openwindow(defaultMetadataUrl + "&id="+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_uid);',,'info.png']];
+//var menu_info_switch = ['menu_zoom', ['Zmn&nbsp;', 'javascript:var sd = "{@strData}";eval(eval(sd.substr(0, sd.length-6))[1][1]);openwindow(defaultMetadataUrl + "&id="+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_uid);',,'info.png']];
+
+parent.eventAfterLoadWMS.register(reloadTree);
 parent.eventInit.register(loadTree);
 if(showstatus=='true'||alerterror=='true'){
 	parent.eventAfterMapRequest.register(init_mapcheck);
-	init_mapcheck();
-}
+	init_mapcheck();
+}
 parent.eventAfterMapRequest.register(updateScale);
-if(wmsbuttons != "true")
-	jst_highlight = false;
-
-function select(i,ii,iii){
-	//ignore if selected
-	if(selectedMap==i && selectedWMS==ii && selectedLayer==iii)return;
-	if(selectedMap==-1 && selectedWMS==-1 && selectedLayer==-1){
-		selectedMap=i;
-		selectedWMS=ii;
-		selectedLayer=iii;
-		return;
-	}
-	//scalehints
-	var scale = parseInt(parent.mb_getScale(mod_treeGDE_map));
-	if(scale < parseInt(parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_minscale) && parseInt(parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_minscale) != 0){
-		if(selectedLayer==0)
-		   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '#999999');
-		else
-		   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_id, '#999999');
-	}
-	else if(scale > parseInt(parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_maxscale) && parseInt(parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_maxscale) != 0){
-		if(selectedLayer==0)
-		   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '#999999');
-		else
-		   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_id, '#999999');
-	}
-	else{
-		if(selectedLayer==0)
-		   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '');
-		else
-		   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_id, '');
-	}
-
-	selectedMap=i;
-	selectedWMS=ii;
-	selectedLayer=iii;
-}
-
-function updateScale(){
-	if(!init)return;
-	for(var i=0; i<parent.mb_mapObj.length; i++){
-		var scale = parseInt(parent.mb_getScale(mod_treeGDE_map));
-		if(parent.mb_mapObj[i].frameName == mod_treeGDE_map){
-			for(var ii=0; ii<parent.mb_mapObj[i].wms.length; ii++){
-				for(var iii=1; iii<parent.mb_mapObj[i].wms[ii].objLayer.length; iii++){
-					if(scale < parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_minscale) && parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_minscale) != 0){
-						if(iii==0)
-						   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id, '#999999');
-						else
-						   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id+"|"+parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_id, '#999999');
-					}
-					else if(scale > parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_maxscale) && parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_maxscale) != 0){
-						if(iii==0)
-						   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id, '#999999');
-						else
-						   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id+"|"+parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_id, '#999999');
-					}
-					else{
-						if(iii==0)
-						   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id, '');
-						else
-						   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id+"|"+parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_id, '');
-					}
-				}
-			}
-		}
-	}
-}
-
-function operaLoad(){
-	initArray();
-	renderTree();
-	setTimeout('initWmsCheckboxen();updateScale();',100);
-}
-
-function loadTree(){
-	if(window.opera){
-		setTimeout('operaLoad()',200);
-		return;
-	}
-	initArray();
-	renderTree();
-	initWmsCheckboxen();
-	updateScale();
-}
-
-function reloadTree(){
-	if(!init) return;
-	selectedMap=-1;
-	selectedWMS=-1;
-	selectedLayer=-1;
-	init=false;
-	arrNodes = [['root_id', ['Layer','javascript:_foo()']]];
-	initArray();
-	if(showstatus=='true'||alerterror=='true')
-		init_mapcheck();
-	renderTree();
-	if(window.opera)
-		setTimeout('initWmsCheckboxen();updateScale();',100);
-	else{
-		initWmsCheckboxen();
-		updateScale();
-	}
-}
-
-function imgerror(){
-	var map=parent.getMapObjIndexByName(mod_treeGDE_map);
-	var wms=Number(this.id.substr(4));
-	this.onerror=null;
-	this.onabort=null;
-	if(state[wms]!=-1 && alerterror=='true'){
-		state[wms]=-1;
-		if(confirm('Failed to Load WMS "'+parent.mb_mapObj[map].wms[wms].objLayer[0].layer_title+'" from Server "'+parent.mb_mapObj[map].wms[wms].wms_getmap.substr(0,parent.mb_mapObj[map].wms[wms].wms_getmap.length-1)+'"\nDo you want to try to load it in a new window?')){
-			window.open(this.src,"");
-		}
-	}
-	state[wms]=-1;
-	errors++;
-	if(showstatus=='true')
-		setNodeImage(arrNodes[0][0]+"|"+parent.mb_mapObj[map].wms[wms].wms_id, "error_folder.png");
-}
-
-function checkComplete(wms, map, img, first){
-	var ind=parent.getMapObjIndexByName(mod_treeGDE_map);
-	if(parent.mb_mapObj[ind].wms[wms].mapURL == false || parent.frames[mod_treeGDE_map].document.getElementById(map).complete){
-		if(state[wms]!=-1){
-			for(var i=1;i<parent.mb_mapObj[ind].wms[wms].objLayer.length;i++){
-				if(parent.mb_mapObj[ind].wms[wms].objLayer[i].gui_layer_visible==1){
-					state[wms]=1;
-					if(showstatus=='true')
-						setNodeImage(img);
-					break;
-				}
-			}
-		}
-	}
-	else{
-		if(first){
-			state[wms]=0;
-			parent.frames[mod_treeGDE_map].document.getElementById(map).onerror=imgerror;
-			parent.frames[mod_treeGDE_map].document.getElementById(map).onabort=imgerror;
-
-			if(showstatus=='true')
-				setNodeImage(img, "loading_folder.gif");
-		}
-
-		if(state[wms]!=-1)
-			setTimeout('checkComplete('+wms+', "'+map+'", "'+img+'");',100);
-	}
-}
-
-//parent.mb_registerWmsLoadErrorFunctions("window.frames['treeGDE'].imgerror();");
-
-function init_mapcheck(){
-	if(!init)return;
-	errors = 0;
-	var ind = parent.getMapObjIndexByName(mod_treeGDE_map);
-	if(!parent.mb_mapObj[ind]||!init){
-		setTimeout("init_mapcheck();",100);
-		return;
-	}
-	for(var wms=0;wms<parent.mb_mapObj[ind].wms.length;wms++){
-		var wmsimgid="map_"+wms;
-		if(parent.frames[mod_treeGDE_map].document.getElementById(wmsimgid)){
-			checkComplete(wms, wmsimgid, arrNodes[0][0]+'|'+parent.mb_mapObj[ind].wms[wms].wms_id, true);
-		}
-	}
-}
-
-function handleSelectedLayer(mapObj,wms_id,layername,type,status){
-	if(lock_update||lock_check)return;
-	var ind = parent.getMapObjIndexByName(mapObj);
-	for(var i=0; i<parent.mb_mapObj[ind].wms.length; i++){
-		if(parent.mb_mapObj[ind].wms[i].wms_id == wms_id){
-			parent.mb_mapObj[ind].wms[i].handleLayer(layername, type, status);
-			break;
-		}
-	}
-}
-
-function zoomToLayer(j,k,l){
-	if(!j&&!k&&!l){
-		j=selectedMap;
-		k=selectedWMS;
-		l=selectedLayer;
-	}
-	var my=parent.mb_mapObj[j].wms[k].objLayer[l].layer_epsg;
-	for (var i=0;i<my.length;i++){
-		if(my[i]["epsg"]==parent.mb_mapObj[j].epsg){
-			parent.mb_calculateExtent(mod_treeGDE_map,my[i]["minx"],my[i]["miny"],my[i]["maxx"],my[i]["maxy"]);
-			var arrayExt = parent.mb_mapObj[j].extent.split(",");
-			parent.mb_repaint(mod_treeGDE_map,arrayExt[0],arrayExt[1],arrayExt[2],arrayExt[3]);
-			break;
-		}
-	}
-}
-
-
-//---begin------------- opacity --------------------
-
-var opacityIncrement = 20;
-
-function opacity_up(j, k, l) {
-	handleOpacity(j, k, opacityIncrement);
-}
-
-function opacity_down(j, k, l) {
-	handleOpacity(j, k, -opacityIncrement);
-}
-
-function handleOpacity(mapObj_id, wms_id, increment) {
-	var opacity = parent.mb_mapObj[mapObj_id].wms[wms_id].gui_wms_mapopacity*100 + increment;
-	parent.mb_mapObj[mapObj_id].wms[wms_id].setOpacity(opacity);
-	reloadTree();
-}
-
-//---end------------- opacity --------------------
-
-function move_up(j,k,l){
-	if(isNaN(j)&&isNaN(k)&&isNaN(l)){
-		j=selectedMap;
-		k=selectedWMS;
-		l=selectedLayer;
-	}
-	if(j==-1||k==-1||l==-1){
-		alert("You have to select the WMS you want to move up!")
-		return;
-	}
-	var lid=parent.mb_mapObj[j].wms[k].objLayer[l].layer_id;
-	if(!parent.mb_mapObj[j].move(parent.mb_mapObj[j].wms[k].wms_id,lid,(reverse=="true")?false:true)){
-		alert("Illegal move operation");
-		return;
-	}
-	treeState = getState();
-	parent.zoom(parent.mb_mapObj[j].frameName, true, 1.0);
-	parent.mb_execloadWmsSubFunctions();
-	//find layer and select
-	for(k=0;k<parent.mb_mapObj[j].wms.length;k++){
-		for(l=0;l<parent.mb_mapObj[j].wms[k].objLayer.length;l++){
-			if(parent.mb_mapObj[j].wms[k].objLayer[l].layer_id==lid){
-				select(j,k,l);
-				if(l!=0)
-					selectNode(String(lid));
-				else
-					selectNode(String(parent.mb_mapObj[j].wms[k].wms_id));
-			}
-		}
-	}
-}
-
-function move_down(j,k,l){
-	if(isNaN(j)&&isNaN(k)&&isNaN(l)){
-		j=selectedMap;
-		k=selectedWMS;
-		l=selectedLayer;
-	}
-	if(j==-1||k==-1||l==-1){
-		alert("You have to select the WMS you want to move down!")
-		return;
-	}
-	var lid=parent.mb_mapObj[j].wms[k].objLayer[l].layer_id;
-	if(!parent.mb_mapObj[j].move(parent.mb_mapObj[j].wms[k].wms_id,lid,(reverse=="true")?true:false)){
-		alert("Illegal move operation");
-		return;
-	}
-	treeState = getState();
-	parent.zoom(parent.mb_mapObj[j].frameName, true, 1.0);
-	parent.mb_execloadWmsSubFunctions();
-	//find layer and select
-	for(k=0;k<parent.mb_mapObj[j].wms.length;k++){
-		for(l=0;l<parent.mb_mapObj[j].wms[k].objLayer.length;l++){
-			if(parent.mb_mapObj[j].wms[k].objLayer[l].layer_id==lid){
-				select(j,k,l);
-				if(l!=0)
-					selectNode(String(lid));
-				else
-					selectNode(String(parent.mb_mapObj[j].wms[k].wms_id));
-			}
-		}
-	}
-}
-
-function remove_wms(j,k,l){
-	if(isNaN(j)&&isNaN(k)&&isNaN(l)){
-		j=selectedMap;
-		k=selectedWMS;
-		l=selectedLayer;
-	}
-	if(j==-1||k==-1||l==-1){
-		alert("You have to select the WMS you want to delete!")
-		return;
-	}
-	if(l!=0){
-		alert("It is not possible to delete a single layer, please select a WMS!")
-		return;
-	}
-	var visibleWMS=0;
-	for(var i=0;i<parent.mb_mapObj[j].wms.length;i++)
-		if(parent.mb_mapObj[j].wms[i].gui_wms_visible=='1'||parent.mb_mapObj[j].wms[i].gui_wms_visible==1)
-			visibleWMS++;
-	if(visibleWMS<=1){
-		alert ("Last WMS can't be removed.\n(Der letzte WMS kann nicht entfernt werden.)");
-		return;
-	}
-	if(confirm('Are you sure you want to remove "'+parent.mb_mapObj[j].wms[k].objLayer[l].layer_title+'"?')){
-  		parent.mb_mapObjremoveWMS(j,k);
-		parent.zoom(parent.mb_mapObj[j].frameName, true, 1.0);
-		parent.mb_execloadWmsSubFunctions();
-	}
-}
-
-function updateParent(path){
-	if(lock_check)return;
-	var reset_lock=!lock_update;
-	lock_update=true;
-	var state=getChildrenCheckState(path, 0);
-	//enableCheckbox(path, (state!=-1)); //3rd state
-	checkNode(path, 0, (state==1));
-	if(state==0 && showstatus=='true' && path.split(jst_delimiter[0]).length == 2){
-		setTimeout('setNodeImage("'+path+'", "error_folder.png");', 100);
-	}
-	if(reset_lock)
-		lock_update=false;
-}
-
-function handleSelectedWMS(path){
-	if(lock_update)return;
-	var t = path.split("|");
-	var reset_lock=!lock_check;
-	var ind = parent.getMapObjIndexByName(mod_treeGDE_map);
-	var layername = parent.mb_mapObj[ind].wms[parent.getWMSIndexById(mod_treeGDE_map,t[t.length-1])].objLayer[0].layer_name;
-	var bChk = IsChecked(path, 0);
-	handleSelectedLayer(mod_treeGDE_map,t[t.length-1],layername,"visible",bChk?"1":"0");
-	lock_check=true;
-	checkChildren(path, 0, bChk);
-	if(ficheckbox)checkChildren(path, 1, bChk);
-	if(bChk==false && showstatus=='true')
-		setTimeout('setNodeImage("'+path+'", "error_folder.png");', 100);
-	if(reset_lock)
-	{
-		lock_check=false;
-		parent.mb_restateLayers(mod_treeGDE_map,t[t.length-1]);
-		parent.setSingleMapRequest(mod_treeGDE_map,t[t.length-1]);
-	}
-}
-
+if(wmsbuttons != "true")
+	jst_highlight = false;
+
+function select(i,ii,iii){
+	//ignore if selected
+	if(selectedMap==i && selectedWMS==ii && selectedLayer==iii)return;
+	if(selectedMap==-1 && selectedWMS==-1 && selectedLayer==-1){
+		selectedMap=i;
+		selectedWMS=ii;
+		selectedLayer=iii;
+		return;
+	}
+	//scalehints
+	var scale = parseInt(parent.mb_getScale(mod_treeGDE_map));
+	if(scale < parseInt(parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_minscale) && parseInt(parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_minscale) != 0){
+		if(selectedLayer==0)
+		   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '#999999');
+		else
+		   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_id, '#999999');
+	}
+	else if(scale > parseInt(parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_maxscale) && parseInt(parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].gui_layer_maxscale) != 0){
+		if(selectedLayer==0)
+		   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '#999999');
+		else
+		   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_id, '#999999');
+	}
+	else{
+		if(selectedLayer==0)
+		   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id, '');
+		else
+		   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].wms_id+"|"+parent.mb_mapObj[selectedMap].wms[selectedWMS].objLayer[selectedLayer].layer_id, '');
+	}
+
+	selectedMap=i;
+	selectedWMS=ii;
+	selectedLayer=iii;
+}
+
+function updateScale(){
+	if(!init)return;
+	for(var i=0; i<parent.mb_mapObj.length; i++){
+		var scale = parseInt(parent.mb_getScale(mod_treeGDE_map));
+		if(parent.mb_mapObj[i].frameName == mod_treeGDE_map){
+			for(var ii=0; ii<parent.mb_mapObj[i].wms.length; ii++){
+				for(var iii=1; iii<parent.mb_mapObj[i].wms[ii].objLayer.length; iii++){
+					if(scale < parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_minscale) && parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_minscale) != 0){
+						if(iii==0)
+						   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id, '#999999');
+						else
+						   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id+"|"+parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_id, '#999999');
+					}
+					else if(scale > parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_maxscale) && parseInt(parent.mb_mapObj[i].wms[ii].objLayer[iii].gui_layer_maxscale) != 0){
+						if(iii==0)
+						   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id, '#999999');
+						else
+						   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id+"|"+parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_id, '#999999');
+					}
+					else{
+						if(iii==0)
+						   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id, '');
+						else
+						   	setNodeColor(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id+"|"+parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_id, '');
+					}
+				}
+			}
+		}
+	}
+}
+
+function operaLoad(){
+	initArray();
+	renderTree();
+	setTimeout('initWmsCheckboxen();updateScale();',100);
+}
+
+function loadTree(){
+	if(window.opera){
+		setTimeout('operaLoad()',200);
+		return;
+	}
+	initArray();
+	renderTree();
+	initWmsCheckboxen();
+	updateScale();
+}
+
+function reloadTree(){
+	if(!init) return;
+	selectedMap=-1;
+	selectedWMS=-1;
+	selectedLayer=-1;
+	init=false;
+	arrNodes = [['root_id', ['Layer','javascript:_foo()']]];
+	initArray();
+	if(showstatus=='true'||alerterror=='true')
+		init_mapcheck();
+	renderTree();
+	if(window.opera)
+		setTimeout('initWmsCheckboxen();updateScale();',100);
+	else{
+		initWmsCheckboxen();
+		updateScale();
+	}
+}
+
+function imgerror(){
+	var map=parent.getMapObjIndexByName(mod_treeGDE_map);
+	var wms=Number(this.id.substr(4));
+	this.onerror=null;
+	this.onabort=null;
+	if(state[wms]!=-1 && alerterror=='true'){
+		state[wms]=-1;
+		if(confirm('Failed to Load WMS "'+parent.mb_mapObj[map].wms[wms].objLayer[0].layer_title+'" from Server "'+parent.mb_mapObj[map].wms[wms].wms_getmap.substr(0,parent.mb_mapObj[map].wms[wms].wms_getmap.length-1)+'"\nDo you want to try to load it in a new window?')){
+			window.open(this.src,"");
+		}
+	}
+	state[wms]=-1;
+	errors++;
+	if(showstatus=='true')
+		setNodeImage(arrNodes[0][0]+"|"+parent.mb_mapObj[map].wms[wms].wms_id, "error_folder.png");
+}
+
+function checkComplete(wms, map, img, first){
+	var ind=parent.getMapObjIndexByName(mod_treeGDE_map);
+	if(parent.mb_mapObj[ind].wms[wms].mapURL == false || parent.frames[mod_treeGDE_map].document.getElementById(map).complete){
+		if(state[wms]!=-1){
+			for(var i=1;i<parent.mb_mapObj[ind].wms[wms].objLayer.length;i++){
+				if(parent.mb_mapObj[ind].wms[wms].objLayer[i].gui_layer_visible==1){
+					state[wms]=1;
+					if(showstatus=='true')
+						setNodeImage(img);
+					break;
+				}
+			}
+		}
+	}
+	else{
+		if(first){
+			state[wms]=0;
+			parent.frames[mod_treeGDE_map].document.getElementById(map).onerror=imgerror;
+			parent.frames[mod_treeGDE_map].document.getElementById(map).onabort=imgerror;
+			if(showstatus=='true')
+				setNodeImage(img, "loading_folder.gif");
+		}
+
+		if(state[wms]!=-1)
+			setTimeout('checkComplete('+wms+', "'+map+'", "'+img+'");',100);
+	}
+}
+
+//parent.mb_registerWmsLoadErrorFunctions("window.frames['treeGDE'].imgerror();");
+
+function init_mapcheck(){
+	if(!init)return;
+	errors = 0;
+	var ind = parent.getMapObjIndexByName(mod_treeGDE_map);
+	if(!parent.mb_mapObj[ind]||!init){
+		setTimeout("init_mapcheck();",100);
+		return;
+	}
+	for(var wms=0;wms<parent.mb_mapObj[ind].wms.length;wms++){
+		var wmsimgid="map_"+wms;
+		if(parent.frames[mod_treeGDE_map].document.getElementById(wmsimgid)){
+			checkComplete(wms, wmsimgid, arrNodes[0][0]+'|'+parent.mb_mapObj[ind].wms[wms].wms_id, true);
+		}
+	}
+}
+
+function handleSelectedLayer(mapObj,wms_id,layername,type,status){
+	if(lock_update||lock_check)return;
+	var ind = parent.getMapObjIndexByName(mapObj);
+	for(var i=0; i<parent.mb_mapObj[ind].wms.length; i++){
+		if(parent.mb_mapObj[ind].wms[i].wms_id == wms_id){
+			parent.mb_mapObj[ind].wms[i].handleLayer(layername, type, status);
+			break;
+		}
+	}
+}
+
+function zoomToLayer(j,k,l){
+	if(!j&&!k&&!l){
+		j=selectedMap;
+		k=selectedWMS;
+		l=selectedLayer;
+	}
+	var my=parent.mb_mapObj[j].wms[k].objLayer[l].layer_epsg;
+	for (var i=0;i<my.length;i++){
+		if(my[i]["epsg"]==parent.mb_mapObj[j].epsg){
+			parent.mb_calculateExtent(mod_treeGDE_map,my[i]["minx"],my[i]["miny"],my[i]["maxx"],my[i]["maxy"]);
+			var arrayExt = parent.mb_mapObj[j].extent.split(",");
+			parent.mb_repaint(mod_treeGDE_map,arrayExt[0],arrayExt[1],arrayExt[2],arrayExt[3]);
+			break;
+		}
+	}
+}
+
+
+//---begin------------- opacity --------------------
+
+var opacityIncrement = 20;
+
+function opacity_up(j, k, l) {
+	handleOpacity(j, k, opacityIncrement);
+}
+
+function opacity_down(j, k, l) {
+	handleOpacity(j, k, -opacityIncrement);
+}
+
+function handleOpacity(mapObj_id, wms_id, increment) {
+	var opacity = parent.mb_mapObj[mapObj_id].wms[wms_id].gui_wms_mapopacity*100 + increment;
+	parent.mb_mapObj[mapObj_id].wms[wms_id].setOpacity(opacity);
+	reloadTree();
+}
+
+//---end------------- opacity --------------------
+
+function move_up(j,k,l){
+	if(isNaN(j)&&isNaN(k)&&isNaN(l)){
+		j=selectedMap;
+		k=selectedWMS;
+		l=selectedLayer;
+	}
+	if(j==-1||k==-1||l==-1){
+		alert("You have to select the WMS you want to move up!")
+		return;
+	}
+	var lid=parent.mb_mapObj[j].wms[k].objLayer[l].layer_id;
+	if(!parent.mb_mapObj[j].move(parent.mb_mapObj[j].wms[k].wms_id,lid,(reverse=="true")?false:true)){
+		alert("Illegal move operation");
+		return;
+	}
+	treeState = getState();
+	parent.zoom(parent.mb_mapObj[j].frameName, true, 1.0);
+	parent.mb_execloadWmsSubFunctions();
+	//find layer and select
+	for(k=0;k<parent.mb_mapObj[j].wms.length;k++){
+		for(l=0;l<parent.mb_mapObj[j].wms[k].objLayer.length;l++){
+			if(parent.mb_mapObj[j].wms[k].objLayer[l].layer_id==lid){
+				select(j,k,l);
+				if(l!=0)
+					selectNode(String(lid));
+				else
+					selectNode(String(parent.mb_mapObj[j].wms[k].wms_id));
+			}
+		}
+	}
+}
+
+function move_down(j,k,l){
+	if(isNaN(j)&&isNaN(k)&&isNaN(l)){
+		j=selectedMap;
+		k=selectedWMS;
+		l=selectedLayer;
+	}
+	if(j==-1||k==-1||l==-1){
+		alert("You have to select the WMS you want to move down!")
+		return;
+	}
+	var lid=parent.mb_mapObj[j].wms[k].objLayer[l].layer_id;
+	if(!parent.mb_mapObj[j].move(parent.mb_mapObj[j].wms[k].wms_id,lid,(reverse=="true")?true:false)){
+		alert("Illegal move operation");
+		return;
+	}
+	treeState = getState();
+	parent.zoom(parent.mb_mapObj[j].frameName, true, 1.0);
+	parent.mb_execloadWmsSubFunctions();
+	//find layer and select
+	for(k=0;k<parent.mb_mapObj[j].wms.length;k++){
+		for(l=0;l<parent.mb_mapObj[j].wms[k].objLayer.length;l++){
+			if(parent.mb_mapObj[j].wms[k].objLayer[l].layer_id==lid){
+				select(j,k,l);
+				if(l!=0)
+					selectNode(String(lid));
+				else
+					selectNode(String(parent.mb_mapObj[j].wms[k].wms_id));
+			}
+		}
+	}
+}
+
+function remove_wms(j,k,l){
+	if(isNaN(j)&&isNaN(k)&&isNaN(l)){
+		j=selectedMap;
+		k=selectedWMS;
+		l=selectedLayer;
+	}
+	if(j==-1||k==-1||l==-1){
+		alert("You have to select the WMS you want to delete!")
+		return;
+	}
+	if(l!=0){
+		alert("It is not possible to delete a single layer, please select a WMS!")
+		return;
+	}
+	var visibleWMS=0;
+	for(var i=0;i<parent.mb_mapObj[j].wms.length;i++)
+		if(parent.mb_mapObj[j].wms[i].gui_wms_visible=='1'||parent.mb_mapObj[j].wms[i].gui_wms_visible==1)
+			visibleWMS++;
+	if(visibleWMS<=1){
+		alert ("Last WMS can't be removed.\n(Der letzte WMS kann nicht entfernt werden.)");
+		return;
+	}
+	if(confirm('Are you sure you want to remove "'+parent.mb_mapObj[j].wms[k].objLayer[l].layer_title+'"?')){
+  		parent.mb_mapObjremoveWMS(j,k);
+		parent.zoom(parent.mb_mapObj[j].frameName, true, 1.0);
+		parent.mb_execloadWmsSubFunctions();
+	}
+}
+
+function updateParent(path){
+	if(lock_check)return;
+	var reset_lock=!lock_update;
+	lock_update=true;
+	var state=getChildrenCheckState(path, 0);
+	//enableCheckbox(path, (state!=-1)); //3rd state
+	checkNode(path, 0, (state==1));
+	if(state==0 && showstatus=='true' && path.split(jst_delimiter[0]).length == 2){
+		setTimeout('setNodeImage("'+path+'", "error_folder.png");', 100);
+	}
+	if(reset_lock)
+		lock_update=false;
+}
+
+function handleSelectedWMS(path){
+	if(lock_update)return;
+	var t = path.split("|");
+	var reset_lock=!lock_check;
+	var ind = parent.getMapObjIndexByName(mod_treeGDE_map);
+	var layername = parent.mb_mapObj[ind].wms[parent.getWMSIndexById(mod_treeGDE_map,t[t.length-1])].objLayer[0].layer_name;
+	var bChk = IsChecked(path, 0);
+	handleSelectedLayer(mod_treeGDE_map,t[t.length-1],layername,"visible",bChk?"1":"0");
+	lock_check=true;
+	checkChildren(path, 0, bChk);
+	if(ficheckbox)checkChildren(path, 1, bChk);
+	if(bChk==false && showstatus=='true')
+		setTimeout('setNodeImage("'+path+'", "error_folder.png");', 100);
+	if(reset_lock)
+	{
+		lock_check=false;
+		parent.mb_restateLayers(mod_treeGDE_map,t[t.length-1]);
+		parent.setSingleMapRequest(mod_treeGDE_map,t[t.length-1]);
+	}
+}
+
 function handleSelection(path, box){
-	if(lock_update)return;
-	var reset_lock=!lock_check;
-	lock_check=true;
+	if(lock_update)return;
+	var reset_lock=!lock_check;
+	lock_check=true;
 	var bChk = IsChecked(path, box);	
-//	enableCheckbox(path, 0, true);
+//	enableCheckbox(path, 0, true);
 	checkChildren(path, box, bChk);
-	if(reset_lock){
-		var t = path.split("|");
-		lock_check=false;
-		parent.mb_restateLayers(mod_treeGDE_map,t[1]);
+	if(reset_lock){
+		var t = path.split("|");
+		lock_check=false;
+		parent.mb_restateLayers(mod_treeGDE_map,t[1]);
 		if(box==0)
-		parent.setSingleMapRequest(mod_treeGDE_map,t[1]);
-	}
-}
-
-function initArray(){
-	var parentObj = "";
-	var controls="";
-	if(parent.mb_mapObj.length > 0){
-		for(var i=0; i<parent.mb_mapObj.length; i++){
-			if(parent.mb_mapObj[i].frameName == mod_treeGDE_map){
-				for(var ii=0; ii<parent.mb_mapObj[i].wms.length; ii++){
-					if(parent.mb_mapObj[i].wms[ii].gui_wms_visible == '1' || parent.mb_mapObj[i].wms[ii].gui_wms_visible == 1){
-						for(var iii=0; iii<parent.mb_mapObj[i].wms[ii].objLayer.length; iii++){
-							var temp = parent.mb_mapObj[i].wms[ii].objLayer[iii];
-							if(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_parent == ""){
-								if(!temp.gui_layer_selectable == '1' && !temp.gui_layer_queryable == '1')
-									continue;
-								var c_menu="[";
-								if(reverse=="true"){
-									if(menu.indexOf("wms_down")!=-1 && ii!=parent.mb_mapObj[i].wms.length-1)c_menu+="menu_move_up,";
-									if(menu.indexOf("wms_up")!=-1 && parentObj!="")c_menu+="menu_move_down,";
-								}
-								else{
-									if(menu.indexOf("wms_up")!=-1 && parentObj!="")c_menu+="menu_move_up,";
-									if(menu.indexOf("wms_down")!=-1 && ii!=parent.mb_mapObj[i].wms.length-1)c_menu+="menu_move_down,";
-								}
-								if(menu.indexOf("remove")!=-1)c_menu+="menu_delete,";
-//								if(menu.indexOf("wms_switch")!=-1)c_menu+="menu_wms_switch,";
-								if(menu.indexOf("opacity_up")!=-1 && parseFloat(parent.mb_mapObj[i].wms[ii].gui_wms_mapopacity) < 1)c_menu+="menu_opacity_up,";
-								if(menu.indexOf("opacity_down")!=-1 && parseFloat(parent.mb_mapObj[i].wms[ii].gui_wms_mapopacity) > 0)c_menu+="menu_opacity_down,";
-								if(menu.indexOf("hide")!=-1)c_menu+="menu_hide";
-								c_menu+="]";
-								controls=null;
-								if(switchwms=='true')controls='<INPUT type="checkbox" checked onclick="handleSelectedWMS(\''+arrNodes[0][0]+'|'+parent.mb_mapObj[i].wms[ii].wms_id+'\');" />';
-								if(wmsbuttons == 'true'&&metadatalink == 'true')controls+='<a href="'+'javascript:openwindow(\''+ defaultMetadataUrl + '&id='+temp.layer_uid+'\');'+'"><img src="'+imagedir+'/info.png" /></a>';
-								addNode(arrNodes[0][0],[parent.mb_mapObj[i].wms[ii].wms_id,[temp.layer_title,((metadatalink=='true'&&wmsbuttons != 'true')?('javascript:openwindow(\"'+ defaultMetadataUrl + '&id='+temp.layer_uid+'\");'):"javascript:select("+i+","+ii+","+iii+");"),,,temp.layer_title,eval(c_menu),controls,[i,ii,iii]]],false,false,reverse=="true");
-								parentObj = arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id;
-							}
-							if(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_parent && (handlesublayer=="true"||parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_parent=="0")){
-								var parentLayer = "";
-								var j = iii;
-								while(parent.mb_mapObj[i].wms[ii].objLayer[j].layer_parent!="0"){
-									//find parent
-									for(var jj=0; jj < parent.mb_mapObj[i].wms[ii].objLayer.length; jj++){
-										if(parent.mb_mapObj[i].wms[ii].objLayer[jj].layer_pos==parseInt(parent.mb_mapObj[i].wms[ii].objLayer[j].layer_parent)){
-											j=jj;
-											break;
-										}
-									}
-									parentLayer = "|" + parent.mb_mapObj[i].wms[ii].objLayer[j].layer_id + parentLayer;
-								}
-								if(temp.gui_layer_selectable == '1' || temp.gui_layer_queryable == '1'){
-									var c_menu="[";
-									if(reverse=="true"){
-										if(menu.indexOf("layer_down")!=-1 && iii!=parent.mb_mapObj[i].wms[ii].objLayer.length-1)c_menu+="menu_move_up,";
-										if(menu.indexOf("layer_up")!=-1 && iii!=1)c_menu+="menu_move_down,";
-									}
-									else{
-										if(menu.indexOf("layer_up")!=-1 && iii!=1)c_menu+="menu_move_up,";
-										if(menu.indexOf("layer_down")!=-1 && iii!=parent.mb_mapObj[i].wms[ii].objLayer.length-1)c_menu+="menu_move_down,";
-									}
-									if(menu.indexOf("metainfo")!=-1)c_menu+="menu_metalink,";
-									if(menu.indexOf("zoom")!=-1 && temp.layer_epsg.length>0)c_menu+="menu_zoom,";
-//									if(menu.indexOf("layer_switch")!=-1)c_menu+="menu_layer_switch,";
-//									if(menu.indexOf("info_switch")!=-1)c_menu+="menu_info_switch,";
-									if(menu.indexOf("hide")!=-1)c_menu+="menu_hide";
-									c_menu+="]";
-
-									controls='<input type="checkbox" '+(temp.layer_name==""?'style="display:none;" ':"")+((temp.gui_layer_visible=='1')?'checked ':'')+(temp.gui_layer_selectable!='1'?'disabled ':'')+"onclick=\"handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','visible',this.checked?1:0);handleSelection('"+parentObj+parentLayer+"|"+temp.layer_id+"', 0);updateParent('"+parentObj+parentLayer+"');"+((ficheckbox == 'false')?"handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','querylayer',this.checked?1:0)":"")+"\" />";
-									if(ficheckbox == 'true')controls+='<input type="checkbox" '+(temp.gui_layer_querylayer=='1'?'checked ':'')+(temp.gui_layer_queryable!='1'?'disabled ':'')+"onclick=\"handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','querylayer',this.checked?1:0);handleSelection('"+parentObj+parentLayer+"|"+temp.layer_id+"', 1)\" />";
-									if(wmsbuttons == 'true'&&metadatalink == 'true')controls+='<a href="'+'javascript:openwindow(\''+ defaultMetadataUrl + '&id='+temp.layer_uid+'\');'+'"><img src="'+imagedir+'/info.png" /></a>';
-									addNode(parentObj + parentLayer, [temp.layer_id,[temp.layer_title,((metadatalink=='true'&&wmsbuttons != 'true')?('javascript:openwindow(\"'+ defaultMetadataUrl + '&id='+temp.layer_uid+'\");'):"javascript:select("+i+","+ii+","+iii+");"),,((c_menu!='[]'&&temp.layer_name!="")?'menu.png':null),temp.layer_title,eval(c_menu),controls,[i,ii,iii]]],false,false,reverse=="true");
-								}
-							}
-						}
-					}
-				}
-			}
-		}
-	}
-	init=true;
-}
-
-function initWmsCheckboxen(){
-	var hidden=0;
-	if(parent.mb_mapObj.length > 0){
-		for(var i=0; i<parent.mb_mapObj.length; i++){
-			if(parent.mb_mapObj[i].frameName == mod_treeGDE_map){
-				for(var ii=0; ii<parent.mb_mapObj[i].wms.length; ii++){
-					if(parent.mb_mapObj[i].wms[ii].gui_wms_visible == '1' || parent.mb_mapObj[i].wms[ii].gui_wms_visible == 1){
-						for(var iii=0; iii<parent.mb_mapObj[i].wms[ii].objLayer.length; iii++){
-							var temp = parent.mb_mapObj[i].wms[ii].objLayer[iii];
-							if(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_parent == ""){
-								updateParent(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id);
-							}
-						}
-					}
-					else if(ii<=parent.parseInt(openfolder)+hidden)
-						hidden++;
-				}
-				closeAll()
-				if(treeState!='')
-					setState(treeState);
-				else if(openfolder!='false')
-					setState(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[parent.parseInt(openfolder)+hidden].wms_id);
-			}
-		}
-	}
-}
-//-->
-  </SCRIPT>
-</HEAD>
-<BODY VLINK="#000000" ALINK="#000000" LINK="#000000" BGCOLOR="#ffffff" TEXT="#000000"
- MARGINHEIGHT="0" MARGINWIDTH="0" LEFTMARGIN="0" TOPMARGIN="0">
-<SCRIPT language="JavaScript" type="text/javascript">
-if(wmsbuttons=='true'){
-	document.writeln("<div>");
-	document.writeln('<a href="javascript:move_up()"><img src="'+imagedir+'/move_up.png" alt="move up" style="position:relative;top:0px;left:0px;"/></a>');
-	document.writeln('<a href="javascript:move_down()"><img src="'+imagedir+'/move_down.png" alt="move down" style="position:relative;top:0px;left:-3px"/></a>');
-	document.writeln('<a href="javascript:remove_wms()"><img src="'+imagedir+'/delete_wms.png" alt="remove wms" style="position:relative;top:0px;left:-6px"/></a>');
-	document.writeln("</div>");
-}
-</SCRIPT>
-<DIV id="treeContainer"></DIV>
-</BODY>
-</HTML>
\ No newline at end of file
+		parent.setSingleMapRequest(mod_treeGDE_map,t[1]);
+	}
+}
+
+function initArray(){
+	var parentObj = "";
+	var controls="";
+	if(parent.mb_mapObj.length > 0){
+		for(var i=0; i<parent.mb_mapObj.length; i++){
+			if(parent.mb_mapObj[i].frameName == mod_treeGDE_map){
+				for(var ii=0; ii<parent.mb_mapObj[i].wms.length; ii++){
+					if(parent.mb_mapObj[i].wms[ii].gui_wms_visible == '1' || parent.mb_mapObj[i].wms[ii].gui_wms_visible == 1){
+						for(var iii=0; iii<parent.mb_mapObj[i].wms[ii].objLayer.length; iii++){
+							var temp = parent.mb_mapObj[i].wms[ii].objLayer[iii];
+							if(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_parent == ""){
+								if(!temp.gui_layer_selectable == '1' && !temp.gui_layer_queryable == '1')
+									continue;
+								var c_menu="[";
+								if(reverse=="true"){
+									if(menu.indexOf("wms_down")!=-1 && ii!=parent.mb_mapObj[i].wms.length-1)c_menu+="menu_move_up,";
+									if(menu.indexOf("wms_up")!=-1 && parentObj!="")c_menu+="menu_move_down,";
+								}
+								else{
+									if(menu.indexOf("wms_up")!=-1 && parentObj!="")c_menu+="menu_move_up,";
+									if(menu.indexOf("wms_down")!=-1 && ii!=parent.mb_mapObj[i].wms.length-1)c_menu+="menu_move_down,";
+								}
+								if(menu.indexOf("remove")!=-1)c_menu+="menu_delete,";
+//								if(menu.indexOf("wms_switch")!=-1)c_menu+="menu_wms_switch,";
+								if(menu.indexOf("opacity_up")!=-1 && parseFloat(parent.mb_mapObj[i].wms[ii].gui_wms_mapopacity) < 1)c_menu+="menu_opacity_up,";
+								if(menu.indexOf("opacity_down")!=-1 && parseFloat(parent.mb_mapObj[i].wms[ii].gui_wms_mapopacity) > 0)c_menu+="menu_opacity_down,";
+								if(menu.indexOf("hide")!=-1)c_menu+="menu_hide";
+								c_menu+="]";
+								controls=null;
+								if(switchwms=='true')controls='<INPUT type="checkbox" checked onclick="handleSelectedWMS(\''+arrNodes[0][0]+'|'+parent.mb_mapObj[i].wms[ii].wms_id+'\');" />';
+								if(wmsbuttons == 'true'&&metadatalink == 'true')controls+='<a href="'+'javascript:openwindow(\''+ defaultMetadataUrl + '&id='+temp.layer_uid+'\');'+'"><img src="'+imagedir+'/info.png" /></a>';
+								addNode(arrNodes[0][0],[parent.mb_mapObj[i].wms[ii].wms_id,[temp.layer_title,((metadatalink=='true'&&wmsbuttons != 'true')?('javascript:openwindow(\"'+ defaultMetadataUrl + '&id='+temp.layer_uid+'\");'):"javascript:select("+i+","+ii+","+iii+");"),,,temp.layer_title,eval(c_menu),controls,[i,ii,iii]]],false,false,reverse=="true");
+								parentObj = arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id;
+							}
+							if(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_parent && (handlesublayer=="true"||parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_parent=="0")){
+								var parentLayer = "";
+								var j = iii;
+								while(parent.mb_mapObj[i].wms[ii].objLayer[j].layer_parent!="0"){
+									//find parent
+									for(var jj=0; jj < parent.mb_mapObj[i].wms[ii].objLayer.length; jj++){
+										if(parent.mb_mapObj[i].wms[ii].objLayer[jj].layer_pos==parseInt(parent.mb_mapObj[i].wms[ii].objLayer[j].layer_parent)){
+											j=jj;
+											break;
+										}
+									}
+									parentLayer = "|" + parent.mb_mapObj[i].wms[ii].objLayer[j].layer_id + parentLayer;
+								}
+								if(temp.gui_layer_selectable == '1' || temp.gui_layer_queryable == '1'){
+									var c_menu="[";
+									if(reverse=="true"){
+										if(menu.indexOf("layer_down")!=-1 && iii!=parent.mb_mapObj[i].wms[ii].objLayer.length-1)c_menu+="menu_move_up,";
+										if(menu.indexOf("layer_up")!=-1 && iii!=1)c_menu+="menu_move_down,";
+									}
+									else{
+										if(menu.indexOf("layer_up")!=-1 && iii!=1)c_menu+="menu_move_up,";
+										if(menu.indexOf("layer_down")!=-1 && iii!=parent.mb_mapObj[i].wms[ii].objLayer.length-1)c_menu+="menu_move_down,";
+									}
+									if(menu.indexOf("metainfo")!=-1)c_menu+="menu_metalink,";
+									if(menu.indexOf("zoom")!=-1 && temp.layer_epsg.length>0)c_menu+="menu_zoom,";
+//									if(menu.indexOf("layer_switch")!=-1)c_menu+="menu_layer_switch,";
+//									if(menu.indexOf("info_switch")!=-1)c_menu+="menu_info_switch,";
+									if(menu.indexOf("hide")!=-1)c_menu+="menu_hide";
+									c_menu+="]";
+
+									controls='<input type="checkbox" '+(temp.layer_name==""?'style="display:none;" ':"")+((temp.gui_layer_visible=='1')?'checked ':'')+(temp.gui_layer_selectable!='1'?'disabled ':'')+"onclick=\"handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','visible',this.checked?1:0);handleSelection('"+parentObj+parentLayer+"|"+temp.layer_id+"', 0);updateParent('"+parentObj+parentLayer+"');"+((ficheckbox == 'false')?"handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','querylayer',this.checked?1:0)":"")+"\" />";
+									if(ficheckbox == 'true')controls+='<input type="checkbox" '+(temp.gui_layer_querylayer=='1'?'checked ':'')+(temp.gui_layer_queryable!='1'?'disabled ':'')+"onclick=\"handleSelectedLayer('"+mod_treeGDE_map+"','"+parent.mb_mapObj[i].wms[ii].wms_id+"','"+temp.layer_name+"','querylayer',this.checked?1:0);handleSelection('"+parentObj+parentLayer+"|"+temp.layer_id+"', 1)\" />";
+									if(wmsbuttons == 'true'&&metadatalink == 'true')controls+='<a href="'+'javascript:openwindow(\''+ defaultMetadataUrl + '&id='+temp.layer_uid+'\');'+'"><img src="'+imagedir+'/info.png" /></a>';
+									addNode(parentObj + parentLayer, [temp.layer_id,[temp.layer_title,((metadatalink=='true'&&wmsbuttons != 'true')?('javascript:openwindow(\"'+ defaultMetadataUrl + '&id='+temp.layer_uid+'\");'):"javascript:select("+i+","+ii+","+iii+");"),,((c_menu!='[]'&&temp.layer_name!="")?'menu.png':null),temp.layer_title,eval(c_menu),controls,[i,ii,iii]]],false,false,reverse=="true");
+								}
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+	init=true;
+}
+
+function initWmsCheckboxen(){
+	var hidden=0;
+	if(parent.mb_mapObj.length > 0){
+		for(var i=0; i<parent.mb_mapObj.length; i++){
+			if(parent.mb_mapObj[i].frameName == mod_treeGDE_map){
+				for(var ii=0; ii<parent.mb_mapObj[i].wms.length; ii++){
+					if(parent.mb_mapObj[i].wms[ii].gui_wms_visible == '1' || parent.mb_mapObj[i].wms[ii].gui_wms_visible == 1){
+						for(var iii=0; iii<parent.mb_mapObj[i].wms[ii].objLayer.length; iii++){
+							var temp = parent.mb_mapObj[i].wms[ii].objLayer[iii];
+							if(parent.mb_mapObj[i].wms[ii].objLayer[iii].layer_parent == ""){
+								updateParent(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[ii].wms_id);
+							}
+						}
+					}
+					else if(ii<=parent.parseInt(openfolder)+hidden)
+						hidden++;
+				}
+				closeAll()
+				if(treeState!='')
+					setState(treeState);
+				else if(openfolder!='false')
+					setState(arrNodes[0][0]+"|"+parent.mb_mapObj[i].wms[parent.parseInt(openfolder)+hidden].wms_id);
+			}
+		}
+	}
+}
+//-->
+  </SCRIPT>
+</HEAD>
+<BODY VLINK="#000000" ALINK="#000000" LINK="#000000" BGCOLOR="#ffffff" TEXT="#000000"
+ MARGINHEIGHT="0" MARGINWIDTH="0" LEFTMARGIN="0" TOPMARGIN="0">
+<SCRIPT language="JavaScript" type="text/javascript">
+if(wmsbuttons=='true'){
+	document.writeln("<div>");
+	document.writeln('<a href="javascript:move_up()"><img src="'+imagedir+'/move_up.png" alt="move up" style="position:relative;top:0px;left:0px;"/></a>');
+	document.writeln('<a href="javascript:move_down()"><img src="'+imagedir+'/move_down.png" alt="move down" style="position:relative;top:0px;left:-3px"/></a>');
+	document.writeln('<a href="javascript:remove_wms()"><img src="'+imagedir+'/delete_wms.png" alt="remove wms" style="position:relative;top:0px;left:-6px"/></a>');
+	document.writeln("</div>");
+}
+</SCRIPT>
+<DIV id="treeContainer"></DIV>
+</BODY>
+</HTML>

Modified: branches/2.5/http/javascripts/geometry.js
===================================================================
--- branches/2.5/http/javascripts/geometry.js	2008-08-11 08:19:21 UTC (rev 2763)
+++ branches/2.5/http/javascripts/geometry.js	2008-08-11 08:21:14 UTC (rev 2764)
@@ -389,8 +389,8 @@
 																				var currentPoint = currentPolygon[n];
 																				this.getGeometry(-1,-1).addPointByCoordinates(currentPoint[0], currentPoint[1]);
 																			}
+																			this.getGeometry(-1,-1).setEpsg(featureEpsg);
 																		}
-																		this.getGeometry(-1,-1).setEpsg(featureEpsg);
 																		this.close();
 																		break;
 							
@@ -1157,8 +1157,6 @@
 	 * @private
 	 */
  	this.drawGeometry = function(t,g,col){
- 		//console.log("geometry = %s",g);
- 		//console.log("t = %s",t); 
 		if(t == geomType.point) {
 			var poiIcon = g.e.getElementValueByName("Mapbender:icon");
 			for(var i=0, ilen = g.count(); i < ilen; i++){

Modified: branches/2.5/http/javascripts/map.js
===================================================================
--- branches/2.5/http/javascripts/map.js	2008-08-11 08:19:21 UTC (rev 2763)
+++ branches/2.5/http/javascripts/map.js	2008-08-11 08:21:14 UTC (rev 2764)
@@ -1,2141 +1,2155 @@
-var ie = document.all?1:0;
-var n6 = document.getElementById&&!document.all?1:0;
-var n4 = document.layers?1:0;
-
-var mb_mapObj = [];
-var mb_fiWin = null;
-var mb_panActive = false;
-var clickX;
-var clickY;
-var mb_start_x = 0;
-var mb_start_y = 0;
-var mb_end_x = 0;
-var mb_end_y = 0;
-var mb_offset_top = 0;
-var mb_offset_right = 0;
-var mb_offset_bottom = 0;
-var mb_offset_left = 0;
-var mb_log = null;
-
-function mb_removeFunctionFromArray(arrayname,stringFunction){
-	var length = eval(arrayname+".length");
-	for(var i=0; i<length; i++){
-		if(eval(arrayname+"["+i+"]") == stringFunction){
-			var newArray1 = eval(arrayname+".slice(0, "+(i-1)+")");
-			var newArray2 = eval(arrayname+".slice("+(i+1)+", "+length+")");
-			eval(arrayname + " = newArray1.concat(newArray2)");
-			i--;
-			length--;
-		}
-	}
-}
-
-function localize() {
-	eventLocalize.trigger();
-/*
-	for(var i=0; i<mb_l10nFunctions.length; i++){
-		eval(mb_l10nFunctions[i]); 	 
-	} 	 
-*/
-}
-function mb_execloadWmsSubFunctions(){
-	eventAfterLoadWMS.trigger();
-/*
-	for(var i=0; i<mb_loadWmsSubFunctions.length; i++){
-		eval(mb_loadWmsSubFunctions[i]); 	 
-	} 	 
-*/
-}
-
-function mb_execWfsReadSubFunctions(geom) { 	 
-	for(var i=0; i<mb_WfsReadSubFunctions.length; i++){ 	 
-		mb_WfsReadSubFunctions[i](geom); 	 
-	} 	 
-}
-
-function mb_execWfsWriteSubFunctions() { 	 
-	for(var i=0; i<mb_WfsWriteSubFunctions.length; i++){
-		mb_WfsWriteSubFunctions[i](); 	 
-	} 	 
-}
-
-function mb_setWmcExtensionData(anArray) {
-	for (var i in anArray) {
-		if (typeof(anArray[i]) != "undefined") {
-			currentWmcExtensionData[i] = anArray[i];
-		}
-	}
-}
-
-function mb_getWmcExtensionData(arrayKey) {
-	for (var i in restoredWmcExtensionData) {
-		if (arrayKey == i) {
-			return restoredWmcExtensionData[i];
-		}
-	}
-	var e = new Mb_warning("mb_getWmcExtensionData: "+arrayKey+" not found. Maybe this GUI does not allow loading or saving WMC documents from/to the session");
-	return null;
-}
-
-var mb_security_proxy = "http://wms1.ccgis.de/mapbender/tools/security_proxy.php?mb_ows_security_proxy=";
-
-var mb_trans = new Image(); 
-mb_trans.src = "../img/transparent.gif";
-/*END OF GLOBALS*/
-
-
-function init() {
-	eventInitMap.trigger();
-	eventInit.trigger();
-/*
-	for(var i=0; i<mb_InitFunctions.length; i++){
-		eval(mb_InitFunctions[i]);
-	}
-*/
-	
-	for(var i=0; i<mb_mapObj.length; i++){
-		setMapRequest(mb_mapObj[i].frameName);
-	}      	
-}
-
-function deleteWmsObject() {
-	wms = [];
-	wms_layer_count = 0;
-}
-
-function deleteMapObj() {
-	mb_mapObj = [];
-}
-
-function mb_registerMapObj(frameName, elementName,wms_index,width, height){
-	mb_mapObj[mb_mapObj.length] = new mb_mapObj_const(frameName, elementName, width, height, wms_index);    
-}
-
-function mb_mapObj_const(frameName, elementName, width, height, wms_index){
-	this.width = width;
-	this.height = height;
-	this.frameName = frameName;
-	this.elementName = elementName;
-	this.layers = [];
-	this.styles = [];
-	this.querylayers = [];
-	this.geom = "";
-	this.gml = ""; 
-
-	if (wms_index !== null){
-		this.wms = [];
-		this.wms[0] = wms[wms_index];
-		this.wms[0].mapURL = false;
-		var cnt_layers = 0;
-		var cnt_querylayers = 0;
-		var styles = "";
-		var layers = "";
-		var querylayers = "";
-		for (var ii=0; ii<this.wms[0].objLayer.length; ii++){
-			if (this.wms[0].objLayer[ii].gui_layer_visible == 1 && ii>0){
-				if (cnt_layers > 0) {
-					layers += ","; styles += ","; 
-				}
-				layers += this.wms[0].objLayer[ii].layer_name; 
-				styles += ""; 
-				cnt_layers++;
-			}   
-			if (this.wms[0].objLayer[ii].gui_layer_querylayer == 1 && ii>0) {
-				if (cnt_querylayers > 0) {
-					querylayers += ",";
-				}
-				querylayers += this.wms[0].objLayer[ii].layer_name; 
-				cnt_querylayers++;
-			}                      
-		}
-		this.layers[0] = layers;
-		this.styles[0] = styles;
-		this.querylayers[0] = querylayers;   
-	}
-	else {
-		this.wms = [];
-		for(var i=0; i<wms.length; i++){
-			this.wms[i] = wms[i];
-			this.wms[i].mapURL = false;
-		}
-		for(i=0; i< this.wms.length; i++){
-			var cnt_layers = 0;
-			var cnt_querylayers = 0;
-			var styles = "";
-			var layers = "";
-			var querylayers = "";
-			for(var ii=0; ii<this.wms[i].objLayer.length; ii++){
-				if(this.wms[i].objLayer[ii].gui_layer_visible == 1 && ii>0){
-					if(cnt_layers > 0){
-						layers += ","; styles += ","; 
-					}
-					layers += wms[i].objLayer[ii].layer_name; 
-					styles += ""; 
-					cnt_layers++;
-				}            
-				if(this.wms[i].objLayer[ii].gui_layer_querylayer == 1 && ii>0){
-					if(cnt_querylayers > 0){
-						querylayers += ",";
-					}
-					querylayers += wms[i].objLayer[ii].layer_name; 
-					cnt_querylayers++;
-				}                          
-			}
-			this.layers[i] = layers;
-			this.styles[i] = styles;
-			this.querylayers[i] = querylayers;
-		}
-	}
-   this.epsg = wms[0].gui_wms_epsg;
-   this.extent = setExtent(this.width,this.height,this.epsg);
-   this.mapURL = [];
-   
-	/**
-	 * get the width of the mapObj
-	 *
-	 * @member mb_mapObj_const
-	 * @return width of the mapObj  
-	 * @type integer  
-	 */
-	this.getWidth = function(){
-		return parseInt(this.width, 10);
-	};
-	
-	/**
-	 * set the width of the mapObj
-	 *
-	 * @param {integer} widht the width of the mapObj  
-	 */
-	this.setWidth = function(width){
-		this.width = parseInt(width, 10);
-	};
-	
-	/**
-	 * get the height of the mapObj
-	 *
-	 * @member mb_mapObj_const
-	 * @return width of the mapObj  
-	 * @type integer  
-	 */
-	this.getHeight = function(){
-		return parseInt(this.height, 10);
-	};
-	
-	/**
-	 * set the height of the mapObj
-	 *
-	 * @param {integer} height the height of the mapObj  
-	 */
-	this.setHeight = function(height){
-		this.height = parseInt(height, 10);
-	};
-	
-	/**
-	 * get the extent of the mapObj
-	 *
-	 * @member mb_mapObj_const
-	 * @return extent of the mapObj as commaseparated minx,minx,maxx,maxy  
-	 * @type string
-	 */
-	this.getExtent = function(){
-		return this.extent;
-	};
-	
-	/**
-	 * get the extent as minx, maxx, miny, maxy
-	 *
-	 * @return extent and additional informations of the mapObj  
-	 * @type Object
-	 */
-	this.getExtentInfos = function(){
-		var c = this.getExtent().split(",");
-		var ext = new Extent(c[0],c[1],c[2],c[3]);
-		return ext;
-	};
-	
-	/**
-	 * converts the extent of the mapobject so that the maximum	extent will be displayed
-	 *
-	 */
-	this.calculateExtent = function(ext){
-		var relation_px_x = this.getWidth() / this.getHeight();
-		var relation_px_y = this.getHeight() / this.getWidth();
-		var relation_bbox_x = ext.extentx / ext.extenty;     
-		if(relation_bbox_x <= relation_px_x){                
-			ext.minx = ext.centerx - relation_px_x * ext.extenty / 2;
-			ext.maxx = ext.centerx + relation_px_x * ext.extenty / 2;
-		}
-		if(relation_bbox_x > relation_px_x){                
-			ext.miny = ext.centery - relation_px_y * ext.extentx / 2;
-			ext.maxy = ext.centery + relation_px_y * ext.extentx / 2;
-		}
-		this.setExtent(ext.minx,ext.miny,ext.maxx,ext.maxy);
-	};
-	
-	
-	/**
-	 * zoom the map with a zoomfactor and optional to x,y coords
-	 * 
-	 * @param {boolean} in_ in = true, out = false
-	 * @param {float} factor the zoomfactor 1 equals 100%
-	 * @param {float} x center to x-position
-	 * @param {float} y center to y-position
-	 */
-	 this.zoom = function(in_, factor, x, y){
-		factor = parseFloat(factor);
-		if (!in_) {
-			factor = 1 / factor;
-		}
-		
-		var extent = this.getExtentInfos();
-		var distx = extent.maxx - extent.minx;
-		var disty =  extent.maxy - extent.miny;
-		
-		
-		if(x && y){
-			var centerx = parseFloat(x);
-			var centery = parseFloat(y);
-		}
-		else{
-			var centerx = extent.minx + distx/2;
-			var centery = extent.miny + disty/2;
-		}
-		
-		
-		var new_distx = distx / factor;
-		var new_disty = disty / factor;
-		var minx = centerx - new_distx / 2;
-		var miny = centery - new_disty / 2;
-		var maxx = centerx + new_distx / 2;
-		var maxy = centery + new_disty / 2;
-		this.setExtent(minx,miny,maxx,maxy);
-		//Todo:
-		//setMapRequest!
-	 };
-
-	/**
-	 * set the extent of the wms
-	 */
-	 this.setExtent = function(minx,miny,maxx,maxy){
-	 	this.extent = String(minx)+","+String(miny)+","+String(maxx)+","+String(maxy);
-	 };
-	
-	/**
-	 * get the srs of the mapObj
-	 *
-	 * @return srs as epsg:number  
-	 * @type string
-	 */
-	this.getSRS = function(){
-		return this.epsg;
-	};
-	
-	/**
-	 * get all mapRequests 
-	 *
-	 * @return array of mapRequests of this map object  
-	 * @type string[]  
-	 */
-	this.getMapRequests = function(){
-		var allRequests = [];
-		//loop through all wms to get the mapRequests
-		for(var i=0; i<this.wms.length; i++){
-			var currentRequest = this.wms[i].getMapRequest(this);
-			if(currentRequest){ 
-				allRequests.push(currentRequest);
-			}
-		}
-		if(allRequests.length > 0){
-			return allRequests;
-		}
-		return false;
-	};
-	
-	/**
-	 * get all MapRequests 
-	 *
-	 * @return array of all mapRequests of this map-object  
-	 * @type string[]  
-	 */
-	this.getMapRequests = function(){
-		var allRequests = [];
-		//loop through all wms to get the MapRequests
-		for(var i=0; i<this.wms.length; i++){
-			var currentRequest = this.wms[i].getMapRequest(this);
-			if(currentRequest){ 
-				allRequests.push(currentRequest);
-			}
-		}
-		if(allRequests.length > 0){
-			return allRequests;
-		}
-		return false;
-	};
-	
-	/**
-	 * get all featureInfoRequests 
-	 *
-	 * @member mb_mapObj_const
-	 * @param float x the x-value of the click position in pixel
-	 * @param float y the y-value of the click position in pixel
-	 * @return array of all featureInfoRequests of this map object  
-	 * @type string[]  
-	 */
-	this.getFeatureInfoRequests = function(clickPoint){
-		var allRequests = [];
-		//loop through all wms to get the FeatureInfoRequests
-		for(var i=0; i<this.wms.length; i++){
-			var currentRequest = this.wms[i].getFeatureInfoRequest(this, clickPoint);
-			if(currentRequest){ 
-				allRequests.push(currentRequest);
-			}
-		}
-		if(allRequests.length > 0){
-			return allRequests;
-		}
-		return false;
-	};
-	
-	/**
-	 * calculation of the mapscale 
-	 *
-	 * @member mb_mapObj_const
-	 * @return scale  
-	 * @type integer  
-	 */
-	this.getScale = function(){
-		var scale;
-		var bbox = this.extent.split(",");
-		var xtenty;
-		if(this.epsg=="EPSG:4326"){
-			var pxLenx = (parseFloat(bbox[2])-parseFloat(bbox[0]))/this.width;
-			var pxLeny = (parseFloat(bbox[3])-parseFloat(bbox[1]))/this.height;
-			var lat_from = ((parseFloat(bbox[3])-parseFloat(bbox[1])/2)*Math.PI)/180;
-			var lat_to = ((parseFloat(bbox[3])-parseFloat(bbox[1])/2+pxLeny)*Math.PI)/180;
-			var lon_from = ((parseFloat(bbox[2])-parseFloat(bbox[0])/2)*Math.PI)/180;
-			var lon_to = ((parseFloat(bbox[2])-parseFloat(bbox[0])/2+pxLeny)*Math.PI)/180;
-			var dist=6371229*Math.acos(Math.sin(lat_from)*Math.sin(lat_to)+Math.cos(lat_from)*Math.cos(lat_to)*Math.cos(lon_from-lon_to));
-			scale = (dist/Math.SQRT2) * (mb_resolution * 100);
-		}else{
-			xtenty =  parseFloat(bbox[3]) - parseFloat(bbox[1]);
-			scale = (xtenty / this.height) * (mb_resolution * 100);
-		}
-		return Math.round(scale);
-	};
-	/**
-	 * move a wms or layer 
-	 *
-	 * @param int wms_id id of wms to move
-	 * @param int layer_id id of layer to move
-	 * @return true of successful
-	 * @type boolean
-	 */
-	this.move = function(wms_id, layer_id, moveUp){
-		var i,j;
-		for(i=0;i<this.wms.length;i++){
-			if (wms_id == this.wms[i].wms_id) {
-				break;
-			}
-		}
-		
-		//check if only one wms is affected?
-		if (layer_id && layer_id != this.wms[i].objLayer[0].layer_id) {
-			return this.wms[i].moveLayer(layer_id, moveUp);
-		}
-		
-		//else swap wms
-		j = i + (moveUp?-1:1);
-		if (!(i != j && i >= 0 && i < this.wms.length && j >= 0 && j < this.wms.length)) {
-			return false;
-		}
-		
-		upper = this.wms[i];
-		this.wms[i] = this.wms[j];
-		this.wms[j] = upper;
-		var upperLayers = this.layers[i];
-		var upperStyles = this.styles[i];
-		var upperQuerylayers = this.querylayers[i];
-		this.layers[i] = this.layers[j];
-		this.styles[i] = this.styles[j];
-		this.querylayers[i] = this.querylayers[j];
-		this.layers[j] = upperLayers;
-		this.styles[j] = upperStyles;
-		this.querylayers[j] = upperQuerylayers;
-		
-		return true;
-	};
-	
-	eventAfterMapObjectConstruction.trigger();
-}
-
-/*
- * get the conjunction character of an URL
- * @param {String} onlineresource
- * @return the character & or ?
- * @type String
- */
-function mb_getConjunctionCharacter(onlineresource){
-	var conChar;
-	if(onlineresource.indexOf("?") > -1){ 
-		if(onlineresource.charAt(onlineresource.length-1) == "?"){ 
-			conChar = "";
-		}else if(onlineresource.charAt(onlineresource.length-1) == "&"){
-			conChar = "";
-		}else{
-			conChar = "&";
-		}
-	}
-	if(onlineresource.indexOf("?") == -1){
-		conChar = "?";
-	} 
-	return conChar;  
-}
-
-
-function mb_moveWmsById (mapObj_ind, wms_id, toIndex) {
-	return mb_wmsMoveByIndex(mapObj_ind, getWMSIndexById(mapObj_ind, wms_id), toIndex);
-}
-
-function mb_wmsMoveByIndex(mapObj_ind, fromIndex, toIndex) {
-	if (fromIndex != toIndex && fromIndex >= 0 && fromIndex < mb_mapObj[mapObj_ind].wms.length && toIndex >= 0 && toIndex < mb_mapObj[mapObj_ind].wms.length) {
-		var changed = false;
-
-		if (fromIndex > toIndex) {
-			for (var i = fromIndex; i > toIndex ; i--) {
-				var result = mb_swapWmsByIndex(mapObj_ind, i-1, i);
-				if (result === true) {
-					changed = true;
-				}
-			}
-		}
-		else {
-			for (var i = fromIndex; i < toIndex ; i++) {
-				var result = mb_swapWmsByIndex(mapObj_ind, i, i+1);
-				if (result === true) {
-					changed = true;
-				}
-			}
-		}
-		return changed;
-	}
-	else {
-		return false;
-	}
-}
-
-function mb_swapWmsById(mapObj_ind, wms1_id, wms2_id) {
-	return mb_swapWmsByIndex(mapObj_ind, getWMSIndexById(mapObj_ind, wms1_id), getWMSIndexById(mapObj_ind, wms2_id));
-}
-
-function mb_swapWmsByIndex(mapObj_ind, indexA, indexB) {
-	if (indexA != indexB && indexA >= 0 && indexA < mb_mapObj[mapObj_ind].wms.length && indexB >= 0 && indexB < mb_mapObj[mapObj_ind].wms.length) {
-		upper = mb_mapObj[mapObj_ind].wms[indexA];
-		mb_mapObj[mapObj_ind].wms[indexA] = mb_mapObj[mapObj_ind].wms[indexB];
-		mb_mapObj[mapObj_ind].wms[indexB] = upper;
-		var upperLayers = mb_mapObj[mapObj_ind].layers[indexA];
-		var upperStyles = mb_mapObj[mapObj_ind].styles[indexA];
-		var upperQuerylayers = mb_mapObj[mapObj_ind].querylayers[indexA];
-		mb_mapObj[mapObj_ind].layers[indexA] = mb_mapObj[mapObj_ind].layers[indexB];
-		mb_mapObj[mapObj_ind].styles[indexA] = mb_mapObj[mapObj_ind].styles[indexB];
-		mb_mapObj[mapObj_ind].querylayers[indexA] = mb_mapObj[mapObj_ind].querylayers[indexB];
-		mb_mapObj[mapObj_ind].layers[indexB] = upperLayers;
-		mb_mapObj[mapObj_ind].styles[indexB] = upperStyles;
-		mb_mapObj[mapObj_ind].querylayers[indexB] = upperQuerylayers;
-		return true;
-	}
-	else {
-		return false;
-	}
-}
-
-function mb_moveUpWmsByIndex(mapObj_ind, index) {
-	if (index > 0 && index < wms.length) {
-		return mb_swapWmsByIndex(mapObj_ind, index-1, index);
-	}
-	else {
-		return false;
-	}
-}
-
-function mb_moveDownWmsByIndex(mapObj_ind, index) {
-	if (index >= 0 && index < wms.length-1) {
-		return mb_swapWmsByIndex(mapObj_ind, index, index+1);
-	}
-	else {
-		return false;
-	}
-}
-
-function mb_mapObjaddWMS(obj){
-	var cnt_layers = 0;
-	var cnt_querylayers = 0;
-	var styles = "";
-	var layers = "";
-	var querylayers = "";
-	var ind = getMapObjIndexByName(obj);
-	//is the id valid?
-	for( var i=0; i<(wms.length-1); i++){
-		if(parseInt(wms[i].wms_id, 10) >= parseInt(wms[wms.length-1].wms_id, 10)){
-			wms[wms.length-1].wms_id = parseInt(mb_mapObj[ind].wms[i].wms_id, 10) + 1;
-		}
-	} 
-	mb_mapObj[ind].wms[mb_mapObj[ind].wms.length] = wms[wms.length-1];
-	mb_mapObj[ind].layers[mb_mapObj[ind].layers.length] = layers;
-	mb_mapObj[ind].styles[mb_mapObj[ind].styles.length] = styles;
-	mb_mapObj[ind].querylayers[mb_mapObj[ind].querylayers.length] = querylayers;  
-	mb_execloadWmsSubFunctions();
-	return true; 
-}
-//CB
-function mb_mapObjaddWMSwithLayers(obj,layers,querylayers){
-	var cnt_layers = 0;
-	var cnt_querylayers = 0;
-	var styles = "";
-	var ind = getMapObjIndexByName(obj);
-	mb_mapObj[ind].wms[mb_mapObj[ind].wms.length] = wms[wms.length-1];
-	mb_mapObj[ind].layers[mb_mapObj[ind].layers.length] = layers;
-	mb_mapObj[ind].styles[mb_mapObj[ind].styles.length] = styles;
-	mb_mapObj[ind].querylayers[mb_mapObj[ind].querylayers.length] = querylayers;   
-}
-function mb_mapObjremoveWMS(objind,wmsind){
-	var wms_ID = null;
-	
-	var new_wmsarray = [];
-	var new_layerarray = [];
-	var new_querylayerarray = [];
-	var new_stylesarray = [];
-	var new_mapURLarray = [];
-	
-	for	(var i=0;i<mb_mapObj[objind].wms.length; i++){
-		if(i != wmsind){
-			new_wmsarray[new_wmsarray.length] = mb_mapObj[objind].wms[i];
-			new_layerarray[new_layerarray.length] = mb_mapObj[objind].layers[i];
-			new_querylayerarray[new_querylayerarray.length] = mb_mapObj[objind].querylayers[i];
-			new_stylesarray[new_stylesarray.length] = mb_mapObj[objind].styles[i];
-			new_mapURLarray[new_mapURLarray.length] = mb_mapObj[objind].mapURL[i];
-		}
-		else {
-			wms_ID = mb_mapObj[objind].wms[i].wms_id;
-		}
-	}
-	mb_mapObj[objind].wms = new_wmsarray; 
-	mb_mapObj[objind].layers = new_layerarray; 
-	mb_mapObj[objind].querylayers = new_querylayerarray; 
-	mb_mapObj[objind].styles = new_stylesarray; 
-	mb_mapObj[objind].mapURL = new_mapURLarray;
-
-	var another_new_wmsarray = [];
-	for	(var i=0;i<wms.length; i++){
-		if(wms[i].wms_id != wms_ID){
-			another_new_wmsarray[another_new_wmsarray.length] = wms[i]; 
-		}
-	}
-	wms = another_new_wmsarray; 
-}
-function setExtent(width,height,epsg){
-   for(var i=0; i < wms[0].gui_epsg.length; i++){
-      if(wms[0].gui_epsg[i] == epsg){      
-         var bbox_minx = parseFloat(wms[0].gui_minx[i]);
-         var bbox_miny = parseFloat(wms[0].gui_miny[i]);
-         var bbox_maxx = parseFloat(wms[0].gui_maxx[i]);
-         var bbox_maxy = parseFloat(wms[0].gui_maxy[i]);     
-   
-         var extenty = bbox_maxy - bbox_miny;
-         var extentx = bbox_maxx - bbox_minx;
-
-         var relation_px_x = width / height;
-         var relation_px_y = height / width;
-         var relation_bbox_x = extentx / extenty;         
-         var centerx = bbox_minx + (extentx/2);
-         var centery = bbox_miny + (extenty/2);
-         if(relation_bbox_x <= relation_px_x){                
-                bbox_minx = centerx - relation_px_x * extenty / 2;
-                bbox_maxx = centerx + relation_px_x * extenty / 2;
-         }
-        
-         if(relation_bbox_x > relation_px_x){                
-                bbox_miny = centery - relation_px_y * extentx / 2;
-                bbox_maxy = centery + relation_px_y * extentx / 2;
-         }
-        return bbox_minx  +","+ bbox_miny +","+ bbox_maxx  +","+ bbox_maxy;
-     }
-   }
-}
-function setMapRequest(frameName){
-	var functionName = 'setMapRequest';
-	var ts = mb_timestamp();
-
-
-	var ret = eventBeforeMapRequest.trigger({frameName:frameName}, "AND");
-	if (ret === false) {
-		return true;
-	}
-/*
-	for(var i=0; i<mb_MapRequestPreFunctions.length; i++){
-		var ret = eval(mb_MapRequestPreFunctions[i]);
-		if(ret == false){
-			return true;
-		}
-	}
-*/
-	for(var i=0; i<mb_mapObj.length; i++){
-		var newMapRequest = "";
-		if(mb_mapObj[i].frameName == frameName){
-			for(var ii=0; ii<mb_mapObj[i].wms.length; ii++){
-				if(mb_mapObj[i].wms[ii].gui_wms_visible > 0){
-					var myDivId = "div_" + ii;          
-					var myMapId = "map_" + ii;
-					//disable Layer which are out of scale
-					var validLayers = mb_checkScale(frameName,i,ii);
-					var layerNames = validLayers.toString();
-					if(mb_mapObj[i].layers[ii] !== "" && layerNames !== ''){
-						var newMapURL = "";
-
-						if (mb_mapObj[i].wms[ii].gui_wms_mapopacity != 1) {
- 							var cadenaOpacity = "opacity:"+mb_mapObj[i].wms[ii].gui_wms_mapopacity+"; Filter: Alpha(Opacity="+mb_mapObj[i].wms[ii].gui_wms_mapopacity*100+"); -moz-opacity:"+mb_mapObj[i].wms[ii].gui_wms_mapopacity+" ; -khtml-opacity:"+mb_mapObj[i].wms[ii].gui_wms_mapopacity;
-	 						newMapRequest += "<div id='"+myDivId+"' style=\"position:absolute; top:0px; left:0px; z-index:"+ii+";"+cadenaOpacity+"\">";
-						}
-						// IE problem: layers that are already transparent (defined in map file) 
-						// are sabotaged by the Mapbender opacity setting...
-						// this solution helps to display these layers correctly if no opacity
-						// manipulation is taking place in Mapbender
-						//
-						// solution needed for both WMS and Mapbender transparency in IE
-						// see: 
-						else {
-							newMapRequest += "<div id='"+myDivId+"' style='position:absolute; top:0px; left:0px; z-index:"+ii+"'>";
-						}
-
-						newMapRequest += "<img id='"+myMapId+"' name='mapimage' src='";
-						newMapURL += mb_mapObj[i].wms[ii].wms_getmap;   
-						
-						newMapURL += mb_getConjunctionCharacter(mb_mapObj[i].wms[ii].wms_getmap);
-						
-						if(mb_mapObj[i].wms[ii].wms_version == "1.0.0"){newMapURL += "WMTVER="+mb_mapObj[i].wms[ii].wms_version+"&REQUEST=map&";}
-						if(mb_mapObj[i].wms[ii].wms_version != "1.0.0"){newMapURL += "VERSION="+mb_mapObj[i].wms[ii].wms_version+"&REQUEST=GetMap&SERVICE=WMS&";} 
-						
-						newMapURL += "LAYERS="+layerNames+"&";
-						newMapURL += "STYLES=";
-						var layer = layerNames.split(",");
-						for(var j=0; j<layer.length; j++){
-							if(j>0){
-								newMapURL  += ",";
-							}
-							if(mb_mapObj[i].wms[ii].getCurrentStyleByLayerName(layer[j]) === false){
-								newMapURL  += "";
-							}
-							else{
-								newMapURL  += mb_mapObj[i].wms[ii].getCurrentStyleByLayerName(layer[j]);
-							}
-						}
-						newMapURL += "&";
-						newMapURL += "SRS="+mb_mapObj[i].epsg+"&";
-						newMapURL += "BBOX="+mb_mapObj[i].extent+"&";
-						newMapURL += "WIDTH="+mb_mapObj[i].width+"&";
-						newMapURL += "HEIGHT="+mb_mapObj[i].height+"&";
-						newMapURL += "FORMAT="+mb_mapObj[i].wms[ii].gui_wms_mapformat+"&";
-						newMapURL += "BGCOLOR=0xffffff&";
-						if(mb_mapObj[i].wms[ii].gui_wms_mapformat.search(/gif/i)>-1 || mb_mapObj[i].wms[ii].gui_wms_mapformat.search(/png/i)>-1){
-							newMapURL += "TRANSPARENT=TRUE&";
-						}
-						newMapURL += "EXCEPTIONS="+mb_mapObj[i].wms[ii].gui_wms_exceptionformat;
-						// add vendor-specifics
-						for(var v=0; v < mb_vendorSpecific.length; v++){
-							var vendorSpecificString = eval(mb_vendorSpecific[v]); 
-
-							// if eval doesn't evaluate a function, the result is undefined.
-							// Sometimes it is necessary not to evaluate a function, for
-							// example if you want to change a variable from the current
-							// scope (see mod_addSLD.php) 
-							if (typeof(vendorSpecificString) != "undefined") {
-								newMapURL += "&" + vendorSpecificString; 
-							}
-						}           
-						// add Filter
-						if(mb_mapObj[i].wms[ii].wms_filter){
-							var tmp = mb_mapObj[i].wms[ii].wms_filter +"?id="+ mb_styleID;
-
-							var temp = "&SLD=" + tmp+ "&";
-							newMapURL += temp;
-						}
-						// add sld
-						if(mb_mapObj[i].wms[ii].gui_wms_sldurl){
-							//alert(mb_mapObj[i].wms[ii].gui_wms_sldurl);
-							var temp = "&SLD=" + escape(mb_mapObj[i].wms[ii].gui_wms_sldurl) + "&";
-							newMapURL += temp;
-						}
-						if(mb_log){
-							var tmp = eval(mb_log + "('" + newMapURL + "','" + ts + "')");
-						}
-						newMapRequest += newMapURL;
-						mb_mapObj[i].mapURL[ii] = newMapURL;	
-						mb_mapObj[i].wms[ii].mapURL = newMapURL;
-						newMapRequest += "' width='"+mb_mapObj[i].width+"' height='"+mb_mapObj[i].height+"' border='0'></div>";   
-					}
-					else{
-						mb_mapObj[i].mapURL[ii] = false;
-						mb_mapObj[i].wms[ii].mapURL = false;
-						newMapRequest += "<div id='" + myDivId + "' style='position:absolute; top:0px; left:0px; z-index:" + ii + "'>";
-						newMapRequest += "<img id='"+myMapId+"' name='mapimage' src='" + mb_trans.src;
-						newMapRequest += "' width='"+mb_mapObj[i].width+"' height='"+mb_mapObj[i].height+"' border='0'>";
-						newMapRequest +="</div>";
-					}
-				}
-			}
-			//prompt("",newMapRequest);
-			writeTag(mb_mapObj[i].frameName,mb_mapObj[i].elementName,newMapRequest);
-		}
-	}
-	eventAfterMapRequest.trigger({"frameName":frameName, "myMapId":myMapId});
-/*
-	for(var i=0; i<mb_MapRequestSubFunctions.length; i++){
-		eval(mb_MapRequestSubFunctions[i]);
-	}
-*/
-}
-function setSingleMapRequest(frameName,wms_id){
-	var functionName = 'setSingleMapRequest';
-	
-	var ts = mb_timestamp();	
-
-	eventBeforeMapRequest.trigger({frameName:frameName});
-/*
-	for(var i=0; i<mb_MapRequestPreFunctions.length; i++){
-		eval(mb_MapRequestPreFunctions[i]);
-	}	
-*/
-	for(i=0; i<mb_mapObj.length; i++){
-		var newMapRequest = "";
-		if(mb_mapObj[i].frameName == frameName){
-			for(var ii=0; ii<mb_mapObj[i].wms.length; ii++){ 
-				var myDivId = "div_" + ii;
-				var myMapId = "map_" + ii;
-				//disable Layer which are out of scale
-				var validLayers = mb_checkScale(frameName,i,ii);
-				var layerNames = validLayers.toString();
-				
-				if(mb_mapObj[i].wms[ii].wms_id == wms_id){  
-					var newMapURL = "";
-					newMapRequest += "<img id='"+myMapId+"' name='mapimage' src='";
-					newMapURL += mb_mapObj[i].wms[ii].wms_getmap; 
-
-					newMapURL += mb_getConjunctionCharacter(mb_mapObj[i].wms[ii].wms_getmap);
-						
-					if(mb_mapObj[i].wms[ii].wms_version == "1.0.0"){newMapURL += "WMTVER="+mb_mapObj[i].wms[ii].wms_version+"&REQUEST=map&";}
-					if(mb_mapObj[i].wms[ii].wms_version != "1.0.0"){newMapURL += "VERSION="+mb_mapObj[i].wms[ii].wms_version+"&REQUEST=GetMap&SERVICE=WMS&";}             
-					
-					newMapURL += "LAYERS="+layerNames+"&";
-					var layer = layerNames.split(",");
+var ie = document.all?1:0;
+var n6 = document.getElementById&&!document.all?1:0;
+var n4 = document.layers?1:0;
+
+var mb_mapObj = [];
+var mb_fiWin = null;
+var mb_panActive = false;
+var clickX;
+var clickY;
+var mb_start_x = 0;
+var mb_start_y = 0;
+var mb_end_x = 0;
+var mb_end_y = 0;
+var mb_offset_top = 0;
+var mb_offset_right = 0;
+var mb_offset_bottom = 0;
+var mb_offset_left = 0;
+var mb_log = null;
+
+function mb_removeFunctionFromArray(arrayname,stringFunction){
+	var length = eval(arrayname+".length");
+	for(var i=0; i<length; i++){
+		if(eval(arrayname+"["+i+"]") == stringFunction){
+			var newArray1 = eval(arrayname+".slice(0, "+(i-1)+")");
+			var newArray2 = eval(arrayname+".slice("+(i+1)+", "+length+")");
+			eval(arrayname + " = newArray1.concat(newArray2)");
+			i--;
+			length--;
+		}
+	}
+}
+
+function localize() {
+	eventLocalize.trigger();
+/*
+	for(var i=0; i<mb_l10nFunctions.length; i++){
+		eval(mb_l10nFunctions[i]); 	 
+	} 	 
+*/
+}
+function mb_execloadWmsSubFunctions(){
+	eventAfterLoadWMS.trigger();
+/*
+	for(var i=0; i<mb_loadWmsSubFunctions.length; i++){
+		eval(mb_loadWmsSubFunctions[i]); 	 
+	} 	 
+*/
+}
+
+function mb_execWfsReadSubFunctions(geom) { 	 
+	for(var i=0; i<mb_WfsReadSubFunctions.length; i++){ 	 
+		mb_WfsReadSubFunctions[i](geom); 	 
+	} 	 
+}
+
+function mb_execWfsWriteSubFunctions() { 	 
+	for(var i=0; i<mb_WfsWriteSubFunctions.length; i++){
+		mb_WfsWriteSubFunctions[i](); 	 
+	} 	 
+}
+
+function mb_setWmcExtensionData(anArray) {
+	for (var i in anArray) {
+		if (typeof(anArray[i]) != "undefined") {
+			currentWmcExtensionData[i] = anArray[i];
+		}
+	}
+}
+
+function mb_getWmcExtensionData(arrayKey) {
+	for (var i in restoredWmcExtensionData) {
+		if (arrayKey == i) {
+			return restoredWmcExtensionData[i];
+		}
+	}
+	var e = new Mb_warning("mb_getWmcExtensionData: "+arrayKey+" not found. Maybe this GUI does not allow loading or saving WMC documents from/to the session");
+	return null;
+}
+
+var mb_security_proxy = "http://wms1.ccgis.de/mapbender/tools/security_proxy.php?mb_ows_security_proxy=";
+
+var mb_trans = new Image(); 
+mb_trans.src = "../img/transparent.gif";
+/*END OF GLOBALS*/
+
+
+function init() {
+	eventInitMap.trigger();
+	eventInit.trigger();
+/*
+	for(var i=0; i<mb_InitFunctions.length; i++){
+		eval(mb_InitFunctions[i]);
+	}
+*/
+	
+	for(var i=0; i<mb_mapObj.length; i++){
+		setMapRequest(mb_mapObj[i].frameName);
+	}      	
+}
+
+function deleteWmsObject() {
+	wms = [];
+	wms_layer_count = 0;
+}
+
+function deleteMapObj() {
+	mb_mapObj = [];
+}
+
+function mb_registerMapObj(frameName, elementName,wms_index,width, height){
+	mb_mapObj[mb_mapObj.length] = new mb_mapObj_const(frameName, elementName, width, height, wms_index);    
+}
+
+function mb_mapObj_const(frameName, elementName, width, height, wms_index){
+	this.width = width;
+	this.height = height;
+	this.frameName = frameName;
+	this.elementName = elementName;
+	this.layers = [];
+	this.styles = [];
+	this.querylayers = [];
+	this.geom = "";
+	this.gml = ""; 
+
+	if (wms_index !== null){
+		this.wms = [];
+		this.wms[0] = wms[wms_index];
+		this.wms[0].mapURL = false;
+		var cnt_layers = 0;
+		var cnt_querylayers = 0;
+		var styles = "";
+		var layers = "";
+		var querylayers = "";
+		for (var ii=0; ii<this.wms[0].objLayer.length; ii++){
+			if (this.wms[0].objLayer[ii].gui_layer_visible == 1 && ii>0){
+				if (cnt_layers > 0) {
+					layers += ","; styles += ","; 
+				}
+				layers += this.wms[0].objLayer[ii].layer_name; 
+				styles += ""; 
+				cnt_layers++;
+			}   
+			if (this.wms[0].objLayer[ii].gui_layer_querylayer == 1 && ii>0) {
+				if (cnt_querylayers > 0) {
+					querylayers += ",";
+				}
+				querylayers += this.wms[0].objLayer[ii].layer_name; 
+				cnt_querylayers++;
+			}                      
+		}
+		this.layers[0] = layers;
+		this.styles[0] = styles;
+		this.querylayers[0] = querylayers;   
+	}
+	else {
+		this.wms = [];
+		for(var i=0; i<wms.length; i++){
+			this.wms[i] = wms[i];
+			this.wms[i].mapURL = false;
+		}
+		for(i=0; i< this.wms.length; i++){
+			var cnt_layers = 0;
+			var cnt_querylayers = 0;
+			var styles = "";
+			var layers = "";
+			var querylayers = "";
+			for(var ii=0; ii<this.wms[i].objLayer.length; ii++){
+				if(this.wms[i].objLayer[ii].gui_layer_visible == 1 && ii>0){
+					if(cnt_layers > 0){
+						layers += ","; styles += ","; 
+					}
+					layers += wms[i].objLayer[ii].layer_name; 
+					styles += ""; 
+					cnt_layers++;
+				}            
+				if(this.wms[i].objLayer[ii].gui_layer_querylayer == 1 && ii>0){
+					if(cnt_querylayers > 0){
+						querylayers += ",";
+					}
+					querylayers += wms[i].objLayer[ii].layer_name; 
+					cnt_querylayers++;
+				}                          
+			}
+			this.layers[i] = layers;
+			this.styles[i] = styles;
+			this.querylayers[i] = querylayers;
+		}
+	}
+   this.epsg = wms[0].gui_wms_epsg;
+   this.extent = setExtent(this.width,this.height,this.epsg);
+   this.mapURL = [];
+   
+	/**
+	 * get the width of the mapObj
+	 *
+	 * @member mb_mapObj_const
+	 * @return width of the mapObj  
+	 * @type integer  
+	 */
+	this.getWidth = function(){
+		return parseInt(this.width, 10);
+	};
+	
+	/**
+	 * set the width of the mapObj
+	 *
+	 * @param {integer} widht the width of the mapObj  
+	 */
+	this.setWidth = function(width){
+		this.width = parseInt(width, 10);
+	};
+	
+	/**
+	 * get the height of the mapObj
+	 *
+	 * @member mb_mapObj_const
+	 * @return width of the mapObj  
+	 * @type integer  
+	 */
+	this.getHeight = function(){
+		return parseInt(this.height, 10);
+	};
+	
+	/**
+	 * set the height of the mapObj
+	 *
+	 * @param {integer} height the height of the mapObj  
+	 */
+	this.setHeight = function(height){
+		this.height = parseInt(height, 10);
+	};
+	
+	/**
+	 * get the extent of the mapObj
+	 *
+	 * @member mb_mapObj_const
+	 * @return extent of the mapObj as commaseparated minx,minx,maxx,maxy  
+	 * @type string
+	 */
+	this.getExtent = function(){
+		return this.extent;
+	};
+	
+	/**
+	 * get the extent as minx, maxx, miny, maxy
+	 *
+	 * @return extent and additional informations of the mapObj  
+	 * @type Object
+	 */
+	this.getExtentInfos = function(){
+		var c = this.getExtent().split(",");
+		var ext = new Extent(c[0],c[1],c[2],c[3]);
+		return ext;
+	};
+	
+	/**
+	 * converts the extent of the mapobject so that the maximum	extent will be displayed
+	 *
+	 */
+	this.calculateExtent = function(ext){
+		var relation_px_x = this.getWidth() / this.getHeight();
+		var relation_px_y = this.getHeight() / this.getWidth();
+		var relation_bbox_x = ext.extentx / ext.extenty;     
+		if(relation_bbox_x <= relation_px_x){                
+			ext.minx = ext.centerx - relation_px_x * ext.extenty / 2;
+			ext.maxx = ext.centerx + relation_px_x * ext.extenty / 2;
+		}
+		if(relation_bbox_x > relation_px_x){                
+			ext.miny = ext.centery - relation_px_y * ext.extentx / 2;
+			ext.maxy = ext.centery + relation_px_y * ext.extentx / 2;
+		}
+		this.setExtent(ext.minx,ext.miny,ext.maxx,ext.maxy);
+	};
+	
+	
+	/**
+	 * zoom the map with a zoomfactor and optional to x,y coords
+	 * 
+	 * @param {boolean} in_ in = true, out = false
+	 * @param {float} factor the zoomfactor 1 equals 100%
+	 * @param {float} x center to x-position
+	 * @param {float} y center to y-position
+	 */
+	 this.zoom = function(in_, factor, x, y){
+		factor = parseFloat(factor);
+		if (!in_) {
+			factor = 1 / factor;
+		}
+		
+		var extent = this.getExtentInfos();
+		var distx = extent.maxx - extent.minx;
+		var disty =  extent.maxy - extent.miny;
+		
+		
+		if(x && y){
+			var centerx = parseFloat(x);
+			var centery = parseFloat(y);
+		}
+		else{
+			var centerx = extent.minx + distx/2;
+			var centery = extent.miny + disty/2;
+		}
+		
+		
+		var new_distx = distx / factor;
+		var new_disty = disty / factor;
+		var minx = centerx - new_distx / 2;
+		var miny = centery - new_disty / 2;
+		var maxx = centerx + new_distx / 2;
+		var maxy = centery + new_disty / 2;
+		this.setExtent(minx,miny,maxx,maxy);
+		//Todo:
+		//setMapRequest!
+	 };
+
+	/**
+	 * set the extent of the wms
+	 */
+	 this.setExtent = function(minx,miny,maxx,maxy){
+	 	this.extent = String(minx)+","+String(miny)+","+String(maxx)+","+String(maxy);
+	 };
+	
+	/**
+	 * get the srs of the mapObj
+	 *
+	 * @return srs as epsg:number  
+	 * @type string
+	 */
+	this.getSRS = function(){
+		return this.epsg;
+	};
+	
+	/**
+	 * get all mapRequests 
+	 *
+	 * @return array of mapRequests of this map object  
+	 * @type string[]  
+	 */
+	this.getMapRequests = function(){
+		var allRequests = [];
+		//loop through all wms to get the mapRequests
+		for(var i=0; i<this.wms.length; i++){
+			var currentRequest = this.wms[i].getMapRequest(this);
+			if(currentRequest){ 
+				allRequests.push(currentRequest);
+			}
+		}
+		if(allRequests.length > 0){
+			return allRequests;
+		}
+		return false;
+	};
+	
+	/**
+	 * get all MapRequests 
+	 *
+	 * @return array of all mapRequests of this map-object  
+	 * @type string[]  
+	 */
+	this.getMapRequests = function(){
+		var allRequests = [];
+		//loop through all wms to get the MapRequests
+		for(var i=0; i<this.wms.length; i++){
+			var currentRequest = this.wms[i].getMapRequest(this);
+			if(currentRequest){ 
+				allRequests.push(currentRequest);
+			}
+		}
+		if(allRequests.length > 0){
+			return allRequests;
+		}
+		return false;
+	};
+	
+	/**
+	 * get all featureInfoRequests 
+	 *
+	 * @member mb_mapObj_const
+	 * @param float x the x-value of the click position in pixel
+	 * @param float y the y-value of the click position in pixel
+	 * @return array of all featureInfoRequests of this map object  
+	 * @type string[]  
+	 */
+	this.getFeatureInfoRequests = function(clickPoint){
+		var allRequests = [];
+		//loop through all wms to get the FeatureInfoRequests
+		for(var i=0; i<this.wms.length; i++){
+			var currentRequest = this.wms[i].getFeatureInfoRequest(this, clickPoint);
+			if(currentRequest){ 
+				allRequests.push(currentRequest);
+			}
+		}
+		if(allRequests.length > 0){
+			return allRequests;
+		}
+		return false;
+	};
+	
+	/**
+	 * calculation of the mapscale 
+	 *
+	 * @member mb_mapObj_const
+	 * @return scale  
+	 * @type integer  
+	 */
+	this.getScale = function(){
+		var scale;
+		var bbox = this.extent.split(",");
+		var xtenty;
+		if(this.epsg=="EPSG:4326"){
+			var pxLenx = (parseFloat(bbox[2])-parseFloat(bbox[0]))/this.width;
+			var pxLeny = (parseFloat(bbox[3])-parseFloat(bbox[1]))/this.height;
+			var lat_from = ((parseFloat(bbox[3])-parseFloat(bbox[1])/2)*Math.PI)/180;
+			var lat_to = ((parseFloat(bbox[3])-parseFloat(bbox[1])/2+pxLeny)*Math.PI)/180;
+			var lon_from = ((parseFloat(bbox[2])-parseFloat(bbox[0])/2)*Math.PI)/180;
+			var lon_to = ((parseFloat(bbox[2])-parseFloat(bbox[0])/2+pxLeny)*Math.PI)/180;
+			var dist=6371229*Math.acos(Math.sin(lat_from)*Math.sin(lat_to)+Math.cos(lat_from)*Math.cos(lat_to)*Math.cos(lon_from-lon_to));
+			scale = (dist/Math.SQRT2) * (mb_resolution * 100);
+		}else{
+			xtenty =  parseFloat(bbox[3]) - parseFloat(bbox[1]);
+			scale = (xtenty / this.height) * (mb_resolution * 100);
+		}
+		return Math.round(scale);
+	};
+	/**
+	 * move a wms or layer 
+	 *
+	 * @param int wms_id id of wms to move
+	 * @param int layer_id id of layer to move
+	 * @return true of successful
+	 * @type boolean
+	 */
+	this.move = function(wms_id, layer_id, moveUp){
+		var i,j;
+		for(i=0;i<this.wms.length;i++){
+			if (wms_id == this.wms[i].wms_id) {
+				break;
+			}
+		}
+		
+		//check if only one wms is affected?
+		if (layer_id && layer_id != this.wms[i].objLayer[0].layer_id) {
+			return this.wms[i].moveLayer(layer_id, moveUp);
+		}
+		
+		//else swap wms
+		j = i + (moveUp?-1:1);
+		if (!(i != j && i >= 0 && i < this.wms.length && j >= 0 && j < this.wms.length)) {
+			return false;
+		}
+		
+		upper = this.wms[i];
+		this.wms[i] = this.wms[j];
+		this.wms[j] = upper;
+		var upperLayers = this.layers[i];
+		var upperStyles = this.styles[i];
+		var upperQuerylayers = this.querylayers[i];
+		this.layers[i] = this.layers[j];
+		this.styles[i] = this.styles[j];
+		this.querylayers[i] = this.querylayers[j];
+		this.layers[j] = upperLayers;
+		this.styles[j] = upperStyles;
+		this.querylayers[j] = upperQuerylayers;
+		
+		return true;
+	};
+	
+	eventAfterMapObjectConstruction.trigger();
+}
+
+/*
+ * get the conjunction character of an URL
+ * @param {String} onlineresource
+ * @return the character & or ?
+ * @type String
+ */
+function mb_getConjunctionCharacter(onlineresource){
+	var conChar;
+	if(onlineresource.indexOf("?") > -1){ 
+		if(onlineresource.charAt(onlineresource.length-1) == "?"){ 
+			conChar = "";
+		}else if(onlineresource.charAt(onlineresource.length-1) == "&"){
+			conChar = "";
+		}else{
+			conChar = "&";
+		}
+	}
+	if(onlineresource.indexOf("?") == -1){
+		conChar = "?";
+	} 
+	return conChar;  
+}
+
+
+function mb_moveWmsById (mapObj_ind, wms_id, toIndex) {
+	return mb_wmsMoveByIndex(mapObj_ind, getWMSIndexById(mapObj_ind, wms_id), toIndex);
+}
+
+function mb_wmsMoveByIndex(mapObj_ind, fromIndex, toIndex) {
+	if (fromIndex != toIndex && fromIndex >= 0 && fromIndex < mb_mapObj[mapObj_ind].wms.length && toIndex >= 0 && toIndex < mb_mapObj[mapObj_ind].wms.length) {
+		var changed = false;
+
+		if (fromIndex > toIndex) {
+			for (var i = fromIndex; i > toIndex ; i--) {
+				var result = mb_swapWmsByIndex(mapObj_ind, i-1, i);
+				if (result === true) {
+					changed = true;
+				}
+			}
+		}
+		else {
+			for (var i = fromIndex; i < toIndex ; i++) {
+				var result = mb_swapWmsByIndex(mapObj_ind, i, i+1);
+				if (result === true) {
+					changed = true;
+				}
+			}
+		}
+		return changed;
+	}
+	else {
+		return false;
+	}
+}
+
+function mb_swapWmsById(mapObj_ind, wms1_id, wms2_id) {
+	return mb_swapWmsByIndex(mapObj_ind, getWMSIndexById(mapObj_ind, wms1_id), getWMSIndexById(mapObj_ind, wms2_id));
+}
+
+function mb_swapWmsByIndex(mapObj_ind, indexA, indexB) {
+	if (indexA != indexB && indexA >= 0 && indexA < mb_mapObj[mapObj_ind].wms.length && indexB >= 0 && indexB < mb_mapObj[mapObj_ind].wms.length) {
+		upper = mb_mapObj[mapObj_ind].wms[indexA];
+		mb_mapObj[mapObj_ind].wms[indexA] = mb_mapObj[mapObj_ind].wms[indexB];
+		mb_mapObj[mapObj_ind].wms[indexB] = upper;
+		var upperLayers = mb_mapObj[mapObj_ind].layers[indexA];
+		var upperStyles = mb_mapObj[mapObj_ind].styles[indexA];
+		var upperQuerylayers = mb_mapObj[mapObj_ind].querylayers[indexA];
+		mb_mapObj[mapObj_ind].layers[indexA] = mb_mapObj[mapObj_ind].layers[indexB];
+		mb_mapObj[mapObj_ind].styles[indexA] = mb_mapObj[mapObj_ind].styles[indexB];
+		mb_mapObj[mapObj_ind].querylayers[indexA] = mb_mapObj[mapObj_ind].querylayers[indexB];
+		mb_mapObj[mapObj_ind].layers[indexB] = upperLayers;
+		mb_mapObj[mapObj_ind].styles[indexB] = upperStyles;
+		mb_mapObj[mapObj_ind].querylayers[indexB] = upperQuerylayers;
+		return true;
+	}
+	else {
+		return false;
+	}
+}
+
+function mb_moveUpWmsByIndex(mapObj_ind, index) {
+	if (index > 0 && index < wms.length) {
+		return mb_swapWmsByIndex(mapObj_ind, index-1, index);
+	}
+	else {
+		return false;
+	}
+}
+
+function mb_moveDownWmsByIndex(mapObj_ind, index) {
+	if (index >= 0 && index < wms.length-1) {
+		return mb_swapWmsByIndex(mapObj_ind, index, index+1);
+	}
+	else {
+		return false;
+	}
+}
+
+function mb_mapObjaddWMS(obj){
+	var cnt_layers = 0;
+	var cnt_querylayers = 0;
+	var styles = "";
+	var layers = "";
+	var querylayers = "";
+	var ind = getMapObjIndexByName(obj);
+	//is the id valid?
+	for( var i=0; i<(wms.length-1); i++){
+		if(parseInt(wms[i].wms_id, 10) >= parseInt(wms[wms.length-1].wms_id, 10)){
+			wms[wms.length-1].wms_id = parseInt(mb_mapObj[ind].wms[i].wms_id, 10) + 1;
+		}
+	} 
+	mb_mapObj[ind].wms[mb_mapObj[ind].wms.length] = wms[wms.length-1];
+	mb_mapObj[ind].layers[mb_mapObj[ind].layers.length] = layers;
+	mb_mapObj[ind].styles[mb_mapObj[ind].styles.length] = styles;
+	mb_mapObj[ind].querylayers[mb_mapObj[ind].querylayers.length] = querylayers;  
+	mb_execloadWmsSubFunctions();
+	return true; 
+}
+//CB
+function mb_mapObjaddWMSwithLayers(obj,layers,querylayers){
+	var cnt_layers = 0;
+	var cnt_querylayers = 0;
+	var styles = "";
+	var ind = getMapObjIndexByName(obj);
+	mb_mapObj[ind].wms[mb_mapObj[ind].wms.length] = wms[wms.length-1];
+	mb_mapObj[ind].layers[mb_mapObj[ind].layers.length] = layers;
+	mb_mapObj[ind].styles[mb_mapObj[ind].styles.length] = styles;
+	mb_mapObj[ind].querylayers[mb_mapObj[ind].querylayers.length] = querylayers;   
+}
+function mb_mapObjremoveWMS(objind,wmsind){
+	var wms_ID = null;
+	
+	var new_wmsarray = [];
+	var new_layerarray = [];
+	var new_querylayerarray = [];
+	var new_stylesarray = [];
+	var new_mapURLarray = [];
+	
+	for	(var i=0;i<mb_mapObj[objind].wms.length; i++){
+		if(i != wmsind){
+			new_wmsarray[new_wmsarray.length] = mb_mapObj[objind].wms[i];
+			new_layerarray[new_layerarray.length] = mb_mapObj[objind].layers[i];
+			new_querylayerarray[new_querylayerarray.length] = mb_mapObj[objind].querylayers[i];
+			new_stylesarray[new_stylesarray.length] = mb_mapObj[objind].styles[i];
+			new_mapURLarray[new_mapURLarray.length] = mb_mapObj[objind].mapURL[i];
+		}
+		else {
+			wms_ID = mb_mapObj[objind].wms[i].wms_id;
+		}
+	}
+	mb_mapObj[objind].wms = new_wmsarray; 
+	mb_mapObj[objind].layers = new_layerarray; 
+	mb_mapObj[objind].querylayers = new_querylayerarray; 
+	mb_mapObj[objind].styles = new_stylesarray; 
+	mb_mapObj[objind].mapURL = new_mapURLarray;
+
+	var another_new_wmsarray = [];
+	for	(var i=0;i<wms.length; i++){
+		if(wms[i].wms_id != wms_ID){
+			another_new_wmsarray[another_new_wmsarray.length] = wms[i]; 
+		}
+	}
+	wms = another_new_wmsarray; 
+}
+function setExtent(width,height,epsg){
+   for(var i=0; i < wms[0].gui_epsg.length; i++){
+      if(wms[0].gui_epsg[i] == epsg){      
+         var bbox_minx = parseFloat(wms[0].gui_minx[i]);
+         var bbox_miny = parseFloat(wms[0].gui_miny[i]);
+         var bbox_maxx = parseFloat(wms[0].gui_maxx[i]);
+         var bbox_maxy = parseFloat(wms[0].gui_maxy[i]);     
+   
+         var extenty = bbox_maxy - bbox_miny;
+         var extentx = bbox_maxx - bbox_minx;
+
+         var relation_px_x = width / height;
+         var relation_px_y = height / width;
+         var relation_bbox_x = extentx / extenty;         
+         var centerx = bbox_minx + (extentx/2);
+         var centery = bbox_miny + (extenty/2);
+         if(relation_bbox_x <= relation_px_x){                
+                bbox_minx = centerx - relation_px_x * extenty / 2;
+                bbox_maxx = centerx + relation_px_x * extenty / 2;
+         }
+        
+         if(relation_bbox_x > relation_px_x){                
+                bbox_miny = centery - relation_px_y * extentx / 2;
+                bbox_maxy = centery + relation_px_y * extentx / 2;
+         }
+        return bbox_minx  +","+ bbox_miny +","+ bbox_maxx  +","+ bbox_maxy;
+     }
+   }
+}
+function setMapRequest(frameName){
+	var functionName = 'setMapRequest';
+	var ts = mb_timestamp();
+
+
+	var ret = eventBeforeMapRequest.trigger({frameName:frameName}, "AND");
+	if (ret === false) {
+		return true;
+	}
+/*
+	for(var i=0; i<mb_MapRequestPreFunctions.length; i++){
+		var ret = eval(mb_MapRequestPreFunctions[i]);
+		if(ret == false){
+			return true;
+		}
+	}
+*/
+	for(var i=0; i<mb_mapObj.length; i++){
+		var newMapRequest = "";
+		if(mb_mapObj[i].frameName == frameName){
+			for(var ii=0; ii<mb_mapObj[i].wms.length; ii++){
+				if(mb_mapObj[i].wms[ii].gui_wms_visible > 0){
+					var myDivId = "div_" + ii;          
+					var myMapId = "map_" + ii;
+					//disable Layer which are out of scale
+					var validLayers = mb_checkScale(frameName,i,ii);
+					var layerNames = validLayers.toString();
+					if(mb_mapObj[i].layers[ii] !== "" && layerNames !== ''){
+						var newMapURL = "";
+
+						if (mb_mapObj[i].wms[ii].gui_wms_mapopacity != 1) {
+ 							var cadenaOpacity = "opacity:"+mb_mapObj[i].wms[ii].gui_wms_mapopacity+"; Filter: Alpha(Opacity="+mb_mapObj[i].wms[ii].gui_wms_mapopacity*100+"); -moz-opacity:"+mb_mapObj[i].wms[ii].gui_wms_mapopacity+" ; -khtml-opacity:"+mb_mapObj[i].wms[ii].gui_wms_mapopacity;
+	 						newMapRequest += "<div id='"+myDivId+"' style=\"position:absolute; top:0px; left:0px; z-index:"+ii+";"+cadenaOpacity+"\">";
+						}
+						// IE problem: layers that are already transparent (defined in map file) 
+						// are sabotaged by the Mapbender opacity setting...
+						// this solution helps to display these layers correctly if no opacity
+						// manipulation is taking place in Mapbender
+						//
+						// solution needed for both WMS and Mapbender transparency in IE
+						// see: 
+						else {
+							newMapRequest += "<div id='"+myDivId+"' style='position:absolute; top:0px; left:0px; z-index:"+ii+"'>";
+						}
+
+						newMapRequest += "<img id='"+myMapId+"' name='mapimage' src='";
+						newMapURL += mb_mapObj[i].wms[ii].wms_getmap;   
+						
+						newMapURL += mb_getConjunctionCharacter(mb_mapObj[i].wms[ii].wms_getmap);
+						
+						if(mb_mapObj[i].wms[ii].wms_version == "1.0.0"){newMapURL += "WMTVER="+mb_mapObj[i].wms[ii].wms_version+"&REQUEST=map&";}
+						if(mb_mapObj[i].wms[ii].wms_version != "1.0.0"){newMapURL += "VERSION="+mb_mapObj[i].wms[ii].wms_version+"&REQUEST=GetMap&SERVICE=WMS&";} 
+						
+						newMapURL += "LAYERS="+layerNames+"&";
+						newMapURL += "STYLES=";
+						var layer = layerNames.split(",");
+						for(var j=0; j<layer.length; j++){
+							if(j>0){
+								newMapURL  += ",";
+							}
+							if(mb_mapObj[i].wms[ii].getCurrentStyleByLayerName(layer[j]) === false){
+								newMapURL  += "";
+							}
+							else{
+								newMapURL  += mb_mapObj[i].wms[ii].getCurrentStyleByLayerName(layer[j]);
+							}
+						}
+						newMapURL += "&";
+						newMapURL += "SRS="+mb_mapObj[i].epsg+"&";
+						newMapURL += "BBOX="+mb_mapObj[i].extent+"&";
+						newMapURL += "WIDTH="+mb_mapObj[i].width+"&";
+						newMapURL += "HEIGHT="+mb_mapObj[i].height+"&";
+						newMapURL += "FORMAT="+mb_mapObj[i].wms[ii].gui_wms_mapformat+"&";
+						newMapURL += "BGCOLOR=0xffffff&";
+						if(mb_mapObj[i].wms[ii].gui_wms_mapformat.search(/gif/i)>-1 || mb_mapObj[i].wms[ii].gui_wms_mapformat.search(/png/i)>-1){
+							newMapURL += "TRANSPARENT=TRUE&";
+						}
+						newMapURL += "EXCEPTIONS="+mb_mapObj[i].wms[ii].gui_wms_exceptionformat;
+						// add vendor-specifics
+						for(var v=0; v < mb_vendorSpecific.length; v++){
+							var vendorSpecificString = eval(mb_vendorSpecific[v]); 
+
+							// if eval doesn't evaluate a function, the result is undefined.
+							// Sometimes it is necessary not to evaluate a function, for
+							// example if you want to change a variable from the current
+							// scope (see mod_addSLD.php) 
+							if (typeof(vendorSpecificString) != "undefined") {
+								newMapURL += "&" + vendorSpecificString; 
+							}
+						}           
+						// add Filter
+						if(mb_mapObj[i].wms[ii].wms_filter){
+							var tmp = mb_mapObj[i].wms[ii].wms_filter +"?id="+ mb_styleID;
+
+							var temp = "&SLD=" + tmp+ "&";
+							newMapURL += temp;
+						}
+						// add sld
+						if(mb_mapObj[i].wms[ii].gui_wms_sldurl){
+							//alert(mb_mapObj[i].wms[ii].gui_wms_sldurl);
+							var temp = "&SLD=" + escape(mb_mapObj[i].wms[ii].gui_wms_sldurl) + "&";
+							newMapURL += temp;
+						}
+						if(mb_log){
+							var tmp = eval(mb_log + "('" + newMapURL + "','" + ts + "')");
+						}
+						newMapRequest += newMapURL;
+						mb_mapObj[i].mapURL[ii] = newMapURL;	
+						mb_mapObj[i].wms[ii].mapURL = newMapURL;
+						newMapRequest += "' width='"+mb_mapObj[i].width+"' height='"+mb_mapObj[i].height+"' border='0'></div>";   
+					}
+					else{
+						mb_mapObj[i].mapURL[ii] = false;
+						mb_mapObj[i].wms[ii].mapURL = false;
+						newMapRequest += "<div id='" + myDivId + "' style='position:absolute; top:0px; left:0px; z-index:" + ii + "'>";
+						newMapRequest += "<img id='"+myMapId+"' name='mapimage' src='" + mb_trans.src;
+						newMapRequest += "' width='"+mb_mapObj[i].width+"' height='"+mb_mapObj[i].height+"' border='0'>";
+						newMapRequest +="</div>";
+					}
+				}
+			}
+			//prompt("",newMapRequest);
+			writeTag(mb_mapObj[i].frameName,mb_mapObj[i].elementName,newMapRequest);
+		}
+	}
+	eventAfterMapRequest.trigger({"frameName":frameName, "myMapId":myMapId});
+/*
+	for(var i=0; i<mb_MapRequestSubFunctions.length; i++){
+		eval(mb_MapRequestSubFunctions[i]);
+	}
+*/
+}
+function setSingleMapRequest(frameName,wms_id){
+	var functionName = 'setSingleMapRequest';
+	
+	var ts = mb_timestamp();	
+
+	eventBeforeMapRequest.trigger({frameName:frameName});
+/*
+	for(var i=0; i<mb_MapRequestPreFunctions.length; i++){
+		eval(mb_MapRequestPreFunctions[i]);
+	}	
+*/
+	for(i=0; i<mb_mapObj.length; i++){
+		var newMapRequest = "";
+		if(mb_mapObj[i].frameName == frameName){
+			for(var ii=0; ii<mb_mapObj[i].wms.length; ii++){ 
+				var myDivId = "div_" + ii;
+				var myMapId = "map_" + ii;
+				//disable Layer which are out of scale
+				var validLayers = mb_checkScale(frameName,i,ii);
+				var layerNames = validLayers.toString();
+				
+				if(mb_mapObj[i].wms[ii].wms_id == wms_id){  
+					var newMapURL = "";
+					newMapRequest += "<img id='"+myMapId+"' name='mapimage' src='";
+					newMapURL += mb_mapObj[i].wms[ii].wms_getmap; 
+
+					newMapURL += mb_getConjunctionCharacter(mb_mapObj[i].wms[ii].wms_getmap);
+						
+					if(mb_mapObj[i].wms[ii].wms_version == "1.0.0"){newMapURL += "WMTVER="+mb_mapObj[i].wms[ii].wms_version+"&REQUEST=map&";}
+					if(mb_mapObj[i].wms[ii].wms_version != "1.0.0"){newMapURL += "VERSION="+mb_mapObj[i].wms[ii].wms_version+"&REQUEST=GetMap&SERVICE=WMS&";}             
+					
+					newMapURL += "LAYERS="+layerNames+"&";
+					var layer = layerNames.split(",");
 					newMapURL += "STYLES=";
-					for(var j=0; j<layer.length; j++){
-						if(j>0){
-							newMapURL  += ",";
-						}
-						if(mb_mapObj[i].wms[ii].getCurrentStyleByLayerName(layer[j])===false){
-							newMapURL  += "";
-						}
-						else{
-							newMapURL  += mb_mapObj[i].wms[ii].getCurrentStyleByLayerName(layer[j]);
-						}
-					}
+					for(var j=0; j<layer.length; j++){
+						if(j>0){
+							newMapURL  += ",";
+						}
+						if(mb_mapObj[i].wms[ii].getCurrentStyleByLayerName(layer[j])===false){
+							newMapURL  += "";
+						}
+						else{
+							newMapURL  += mb_mapObj[i].wms[ii].getCurrentStyleByLayerName(layer[j]);
+						}
+					}
 					newMapURL += "&";
-					newMapURL += "SRS="+mb_mapObj[i].epsg+"&";
-					newMapURL += "BBOX="+mb_mapObj[i].extent+"&";
-					newMapURL += "WIDTH="+mb_mapObj[i].width+"&";
-					newMapURL += "HEIGHT="+mb_mapObj[i].height+"&";
-					newMapURL += "FORMAT="+mb_mapObj[i].wms[ii].gui_wms_mapformat+"&";
-					newMapURL += "BGCOLOR=0xffffff&";
-					if(mb_mapObj[i].wms[ii].gui_wms_mapformat.search(/gif/i)>-1 || mb_mapObj[i].wms[ii].gui_wms_mapformat.search(/png/i)>-1){
-						newMapURL += "TRANSPARENT=TRUE&";
-					}
-					newMapURL += "EXCEPTIONS="+mb_mapObj[i].wms[ii].gui_wms_exceptionformat;
-					// add vendor-specific
-					for (var v = 0; v < mb_vendorSpecific.length; v++) {
-						var vendorSpecificString = eval(mb_vendorSpecific[v]); 
-						// if eval doesn't evaluate a function, the result is undefined.
-						// Sometimes it is necessary not to evaluate a function, for
-						// example if you want to change a variable from the current
-						// scope (see mod_addSLD.php) 
-						if (typeof(vendorSpecificString) != "undefined") {
-							newMapURL += "&" + vendorSpecificString;
-						} 
-					}
-					// add Filter
-					if(mb_mapObj[i].wms[ii].wms_filter){
-						var tmp = mb_mapObj[i].wms[ii].wms_filter +"?id="+ mb_styleID;
-						//prompt("",tmp);;
-						var temp = "&SLD=" + tmp+ "&";
-						newMapURL += temp;
-					}
-					// add sld
-					if(mb_mapObj[i].wms[ii].gui_wms_sldurl){
-						//alert(mb_mapObj[i].wms[ii].gui_wms_sldurl);
-						var temp = "&SLD=" + escape(mb_mapObj[i].wms[ii].gui_wms_sldurl) + "&";
-						newMapURL += temp;
-					}
-
-					//prompt("",newMapURL);
+					newMapURL += "SRS="+mb_mapObj[i].epsg+"&";
+					newMapURL += "BBOX="+mb_mapObj[i].extent+"&";
+					newMapURL += "WIDTH="+mb_mapObj[i].width+"&";
+					newMapURL += "HEIGHT="+mb_mapObj[i].height+"&";
+					newMapURL += "FORMAT="+mb_mapObj[i].wms[ii].gui_wms_mapformat+"&";
+					newMapURL += "BGCOLOR=0xffffff&";
+					if(mb_mapObj[i].wms[ii].gui_wms_mapformat.search(/gif/i)>-1 || mb_mapObj[i].wms[ii].gui_wms_mapformat.search(/png/i)>-1){
+						newMapURL += "TRANSPARENT=TRUE&";
+					}
+					newMapURL += "EXCEPTIONS="+mb_mapObj[i].wms[ii].gui_wms_exceptionformat;
+					// add vendor-specific
+					for (var v = 0; v < mb_vendorSpecific.length; v++) {
+						var vendorSpecificString = eval(mb_vendorSpecific[v]); 
+						// if eval doesn't evaluate a function, the result is undefined.
+						// Sometimes it is necessary not to evaluate a function, for
+						// example if you want to change a variable from the current
+						// scope (see mod_addSLD.php) 
+						if (typeof(vendorSpecificString) != "undefined") {
+							newMapURL += "&" + vendorSpecificString;
+						} 
+					}
+					// add Filter
+					if(mb_mapObj[i].wms[ii].wms_filter){
+						var tmp = mb_mapObj[i].wms[ii].wms_filter +"?id="+ mb_styleID;
+						//prompt("",tmp);;
+						var temp = "&SLD=" + tmp+ "&";
+						newMapURL += temp;
+					}
+					// add sld
+					if(mb_mapObj[i].wms[ii].gui_wms_sldurl){
+						//alert(mb_mapObj[i].wms[ii].gui_wms_sldurl);
+						var temp = "&SLD=" + escape(mb_mapObj[i].wms[ii].gui_wms_sldurl) + "&";
+						newMapURL += temp;
+					}
+
+					//prompt("",newMapURL);
 					if(mb_mapObj[i].layers[ii] !== "" && layerNames!==''){
-						newMapRequest += newMapURL;
-						mb_mapObj[i].mapURL[ii] = newMapURL;
-						mb_mapObj[i].wms[ii].mapURL = newMapURL;
-						newMapRequest += "' width='"+mb_mapObj[i].width+"' height='"+mb_mapObj[i].height+"' border='0'>";
-					}
-					else{
-						mb_mapObj[i].mapURL[ii] = false;
-						mb_mapObj[i].wms[ii].mapURL = false;
-						newMapRequest = "<img id='"+myMapId+"' name='mapimage' src='" + mb_trans.src;
-						newMapRequest += "' width='"+mb_mapObj[i].width+"' height='"+mb_mapObj[i].height+"' border='0'>";
-					}        
-					//prompt("",newMapRequest);
-					if(mb_log){
-						var tmp = eval(mb_log + "('" + newMapURL + "','" + ts + "')");
-					}
-					writeTag(mb_mapObj[i].frameName,myDivId,newMapRequest);
-				}                            
-			}           
-		}      
-	}   
-	eventAfterMapRequest.trigger({"frameName":frameName, "myMapId":myMapId});
-/*
-	for(var i=0; i<mb_MapRequestSubFunctions.length; i++){
-		eval(mb_MapRequestSubFunctions[i]);
-	}  
-*/
-}
-function mb_restateLayers(frameName,wms_id){
-	//alert(frameName + " / " + wms_id);
-	var ind = getMapObjIndexByName(frameName);	
-	for(var i=0; i<mb_mapObj[ind].wms.length; i++){
-		if(mb_mapObj[ind].wms[i].wms_id == wms_id){
-			var cnt_layers = 0;
-			var cnt_querylayers = 0;
-			var layers = "";
-			var styles = "";
-			var querylayers = "";
-			for(var ii=0; ii<mb_mapObj[ind].wms[i].objLayer.length; ii++){
-				if(mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_visible == 1 && !mb_mapObj[ind].wms[i].objLayer[ii].has_childs){
-					if(cnt_layers > 0){layers += ","; styles += ","; }
-					layers += mb_mapObj[ind].wms[i].objLayer[ii].layer_name;
-					//alert(mb_mapObj[ind].wms[i].objLayer[ii].layer_name); 
-					styles += ""; 
-					cnt_layers++;
-				}            
-				if(mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_querylayer == 1 && !mb_mapObj[ind].wms[i].objLayer[ii].has_childs){
-					if(cnt_querylayers > 0){querylayers += ",";}
-					querylayers += mb_mapObj[ind].wms[i].objLayer[ii].layer_name; 
-					cnt_querylayers++;
-				}
-			}
-			mb_mapObj[ind].layers[i] = layers;
-			mb_mapObj[ind].querylayers[i] = querylayers;
-			mb_mapObj[ind].styles[i] = styles;
-		}
-	}
-}
-
-function mb_checkScale(frameName,mObj,wmsObj){
-	var thisLayer = mb_mapObj[mObj].layers[wmsObj].split(",");
-	var thisScale = mb_getScale(frameName);  
-	var str_layer = "";
-	var cnt_layer = 0;
-	for(var i=0; i<mb_mapObj[mObj].wms[wmsObj].objLayer.length; i++){  
-		var myLayername = mb_mapObj[mObj].wms[wmsObj].objLayer[i].layer_name;
-		var myMinscale = mb_mapObj[mObj].wms[wmsObj].objLayer[i].gui_layer_minscale;
-		var myMaxscale = mb_mapObj[mObj].wms[wmsObj].objLayer[i].gui_layer_maxscale;
-		for(var ii=0; ii<thisLayer.length; ii++){
-			var minscaleOK = false;
-			var maxscaleOK = false;   
-			if(thisLayer[ii] == myLayername){
-				if(myMinscale === 0 || thisScale >= myMinscale){minscaleOK = true;}
-				if(myMaxscale === 0 || thisScale <= myMaxscale){maxscaleOK = true;}
-				if(maxscaleOK === true && minscaleOK === true  && !mb_mapObj[mObj].wms[wmsObj].objLayer[i].has_childs){
+						newMapRequest += newMapURL;
+						mb_mapObj[i].mapURL[ii] = newMapURL;
+						mb_mapObj[i].wms[ii].mapURL = newMapURL;
+						newMapRequest += "' width='"+mb_mapObj[i].width+"' height='"+mb_mapObj[i].height+"' border='0'>";
+					}
+					else{
+						mb_mapObj[i].mapURL[ii] = false;
+						mb_mapObj[i].wms[ii].mapURL = false;
+						newMapRequest = "<img id='"+myMapId+"' name='mapimage' src='" + mb_trans.src;
+						newMapRequest += "' width='"+mb_mapObj[i].width+"' height='"+mb_mapObj[i].height+"' border='0'>";
+					}        
+					//prompt("",newMapRequest);
+					if(mb_log){
+						var tmp = eval(mb_log + "('" + newMapURL + "','" + ts + "')");
+					}
+					writeTag(mb_mapObj[i].frameName,myDivId,newMapRequest);
+				}                            
+			}           
+		}      
+	}   
+	eventAfterMapRequest.trigger({"frameName":frameName, "myMapId":myMapId});
+/*
+	for(var i=0; i<mb_MapRequestSubFunctions.length; i++){
+		eval(mb_MapRequestSubFunctions[i]);
+	}  
+*/
+}
+function mb_restateLayers(frameName,wms_id){
+	//alert(frameName + " / " + wms_id);
+	var ind = getMapObjIndexByName(frameName);	
+	for(var i=0; i<mb_mapObj[ind].wms.length; i++){
+		if(mb_mapObj[ind].wms[i].wms_id == wms_id){
+			var cnt_layers = 0;
+			var cnt_querylayers = 0;
+			var layers = "";
+			var styles = "";
+			var querylayers = "";
+			for(var ii=0; ii<mb_mapObj[ind].wms[i].objLayer.length; ii++){
+				if(mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_visible == 1 && !mb_mapObj[ind].wms[i].objLayer[ii].has_childs){
+					if(cnt_layers > 0){layers += ","; styles += ","; }
+					layers += mb_mapObj[ind].wms[i].objLayer[ii].layer_name;
+					//alert(mb_mapObj[ind].wms[i].objLayer[ii].layer_name); 
+					styles += ""; 
+					cnt_layers++;
+				}            
+				if(mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_querylayer == 1 && !mb_mapObj[ind].wms[i].objLayer[ii].has_childs){
+					if(cnt_querylayers > 0){querylayers += ",";}
+					querylayers += mb_mapObj[ind].wms[i].objLayer[ii].layer_name; 
+					cnt_querylayers++;
+				}
+			}
+			mb_mapObj[ind].layers[i] = layers;
+			mb_mapObj[ind].querylayers[i] = querylayers;
+			mb_mapObj[ind].styles[i] = styles;
+		}
+	}
+}
+
+function mb_checkScale(frameName,mObj,wmsObj){
+	var thisLayer = mb_mapObj[mObj].layers[wmsObj].split(",");
+	var thisScale = mb_getScale(frameName);  
+	var str_layer = "";
+	var cnt_layer = 0;
+	for(var i=0; i<mb_mapObj[mObj].wms[wmsObj].objLayer.length; i++){  
+		var myLayername = mb_mapObj[mObj].wms[wmsObj].objLayer[i].layer_name;
+		var myMinscale = mb_mapObj[mObj].wms[wmsObj].objLayer[i].gui_layer_minscale;
+		var myMaxscale = mb_mapObj[mObj].wms[wmsObj].objLayer[i].gui_layer_maxscale;
+		for(var ii=0; ii<thisLayer.length; ii++){
+			var minscaleOK = false;
+			var maxscaleOK = false;   
+			if(thisLayer[ii] == myLayername){
+				if(myMinscale === 0 || thisScale >= myMinscale){minscaleOK = true;}
+				if(myMaxscale === 0 || thisScale <= myMaxscale){maxscaleOK = true;}
+				if(maxscaleOK === true && minscaleOK === true  && !mb_mapObj[mObj].wms[wmsObj].objLayer[i].has_childs){
 					if(cnt_layer > 0){str_layer += ","; }//str_styles += ","; str_titles += ",";str_parent += ","; str_legendurls += ",";}
-					str_layer += thisLayer[ii];
-					cnt_layer++;
-				}
-			}
-		}
-	}
-	var str_layerstyles = [];
-	str_layerstyles[0] = str_layer;
-	return str_layerstyles;
-}
-function setFeatureInfoRequest(fName,x,y, path) {
-	var functionName = 'setFeatureInfoRequest';
-	var ts = mb_timestamp();
-	eventBeforeFeatureInfo.trigger({"fName":fName});
-/*
-	for(var i=0; i<mb_FeatureInfoPreFunctions.length; i++){
-		eval(mb_FeatureInfoPreFunctions[i]);
-	}   
-*/
-	var cnt_fi = 0;
-	for(i=0; i<mb_mapObj.length; i++){
-		if(mb_mapObj[i].frameName == fName){
-			for(var ii=0; ii<mb_mapObj[i].wms.length; ii++){
-				var newfeatureInfoRequest = "";
-				var requestParams = "";
-				var validation = false;
-				newfeatureInfoRequest += mb_mapObj[i].wms[ii].wms_getfeatureinfo;          
-            	newfeatureInfoRequest += mb_getConjunctionCharacter(mb_mapObj[i].wms[ii].wms_getfeatureinfo);
-            	
-				if(mb_mapObj[i].wms[ii].wms_version == "1.0.0"){requestParams += "WMTVER="+mb_mapObj[i].wms[ii].wms_version+"&REQUEST=feature_info&";}
-				if(mb_mapObj[i].wms[ii].wms_version != "1.0.0"){requestParams += "VERSION="+mb_mapObj[i].wms[ii].wms_version+"&REQUEST=GetFeatureInfo&SERVICE=WMS&";}
-				requestParams += "SRS="+mb_mapObj[i].epsg+"&";
-				requestParams += "BBOX="+mb_mapObj[i].extent+"&";
-				requestParams += "WIDTH="+mb_mapObj[i].width+"&";
-				requestParams += "HEIGHT="+mb_mapObj[i].height+"&";
-				requestParams += "LAYERS="+mb_mapObj[i].layers[ii]+"&";
-				requestParams += "STYLES="+mb_mapObj[i].styles[ii]+"&";
-				requestParams += "FORMAT="+mb_mapObj[i].wms[ii].gui_wms_mapformat+"&";
-				requestParams += "INFO_FORMAT="+mb_mapObj[i].wms[ii].gui_wms_featureinfoformat+"&";
-				requestParams += "EXCEPTIONS=application/vnd.ogc.se_xml&";
-				if(mb_feature_count > 0){             
-					requestParams += "FEATURE_COUNT="+mb_feature_count+"&";
-				}
-				requestParams += "QUERY_LAYERS="+mb_mapObj[i].querylayers[ii]+"&";
-				requestParams += "X=" + x  + "&";
-				requestParams += "Y=" + y;
-				
-				if(mb_mapObj[i].querylayers[ii] !== "" && mb_mapObj[i].layers[ii] !== ""){
-					validation = true;
-				}
-				//add vendor-specific
-				for(var v=0; v < mb_vendorSpecific.length; v++){
-					var vendorSpecificString = eval(mb_vendorSpecific[v]); 
-					requestParams += "&" + vendorSpecificString; 
-				}
-				if(mb_log && validation){
-					var tmp = eval(mb_log + "('" + newfeatureInfoRequest + requestParams + "','" + ts + "')");
-				}
-				if(document.getElementById("FeatureInfoRedirect") && validation){
-					newfeatureInfoRequest += requestParams;
-					if(path){
-						window.frames.FeatureInfoRedirect.document.getElementById(mb_mapObj[i].wms[ii].wms_id).src = path + "?url=" + escape(newfeatureInfoRequest)+"&"+mb_nr;
-					}
-					else{
-						window.frames.FeatureInfoRedirect.document.getElementById(mb_mapObj[i].wms[ii].wms_id).src = newfeatureInfoRequest;
-					}
-					cnt_fi++;
-            	}
-				else if(path && validation){
-					newfeatureInfoRequest += requestParams;
-					try{
-						var p = new mb_popup("Feature Info","url:"+path + "?url=" + escape(newfeatureInfoRequest)+"&"+mb_nr,300,400);
-						p.show();
-					}catch(e){
-						window.open(path + "?url=" + escape(newfeatureInfoRequest)+"&"+mb_nr, "" , "width=300,height=400,scrollbars=yes,resizable=yes");
-					}
-					cnt_fi++;
-				}
-				else if(validation){
-					newfeatureInfoRequest += requestParams;
-					try{
-						var p = new mb_popup("Feature Info","url:"+newfeatureInfoRequest,300,400);
-						p.show();
-					}
-					catch(e){
-						window.open(newfeatureInfoRequest, "" , "width=300,height=400,scrollbars=yes,resizable=yes");					
-					}
-					cnt_fi++;
-				}    
-			}
-		}
-	}
-   	if(cnt_fi === 0){
-		alert(unescape("Please select a layer! \n Bitte waehlen Sie eine Ebene zur Abfrage aus!"));
-	}
-}
-
-/*
- * global function to zoom a mapobject
- * 
- * use: mb_mapObj.zoom() {@link mb_mapObj_const#zoom}
- * @deprecated
- * 
- */
-function zoom(frameName,in_, factor,x,y) {
-	var obj = getMapObjByName(frameName);
-	if(x && y){
-		obj.zoom(in_, factor, x, y);
-	}
-	else{
-		obj.zoom(in_, factor, false, false);
-	}	
-	setMapRequest(frameName);
-}
-function mb_panMap(frameName,dir){
-   var ind = getMapObjIndexByName(frameName);
-   var arrayBBox = mb_mapObj[ind].extent.split(",");
-   var minx = parseFloat(arrayBBox[0]);
-   var miny = parseFloat(arrayBBox[1]);
-   var maxx = parseFloat(arrayBBox[2]);
-   var maxy = parseFloat(arrayBBox[3]);
-   var xtentx = parseFloat(arrayBBox[2]) - parseFloat(arrayBBox[0]);
-   var xtenty =  parseFloat(arrayBBox[3]) - parseFloat(arrayBBox[1]);
-
-   if(dir == "NW"){minx = minx - (xtentx/2); maxx = maxx - (xtentx/2); miny = miny + (xtenty/2); maxy = maxy + (xtenty/2);}
-   if(dir == "N"){miny = miny + (xtenty/2); maxy = maxy + (xtenty/2);}
-   if(dir == "NE"){minx = minx + (xtentx/2); maxx = maxx + (xtentx/2); miny = miny + (xtenty/2); maxy = maxy + (xtenty/2);}
-   if(dir == "W"){minx = minx - (xtentx/2); maxx = maxx - (xtentx/2);}
-   if(dir == "E"){minx = minx + (xtentx/2); maxx = maxx + (xtentx/2);}
-   if(dir == "SW"){minx = minx - (xtentx/2); maxx = maxx - (xtentx/2); miny = miny - (xtenty/2); maxy = maxy - (xtenty/2);}
-   if(dir == "S"){miny = miny - (xtenty/2); maxy = maxy - (xtenty/2);}
-   if(dir == "SE"){minx = minx + (xtentx/2); maxx = maxx + (xtentx/2); miny = miny - (xtenty/2); maxy = maxy - (xtenty/2);}
-  mb_mapObj[ind].extent = minx + "," + miny + "," + maxx + "," + maxy;
-  setMapRequest(frameName);
-}
-
-function handleSelectedLayer (frameName, wms_title, layerName, type, status) {
-//	alert(frameName + " , " +wms_title + " , " +layerName + " , " +type + " , " +status);
-//	type = {visible || querylayer] status = {0 || 1}
-	for (var i=0; i < mb_mapObj.length; i++) {
-		if (mb_mapObj[i].frameName == frameName) {
-			var cnt_layer = 0;
-			var str_layer = "";
-			var myMapObj = i;
-			for (var ii = 0; ii < mb_mapObj[i].wms.length; ii++) {
-				if (mb_mapObj[i].wms[ii].wms_title == wms_title) { //ii is true
-					var myWMS = ii; 
-					if (type == "visible") {
-						var arrayLayer = mb_mapObj[i].layers[ii].split(",");
-					}
-					if (type == "querylayer") {
-						var arrayLayer = mb_mapObj[i].querylayers[ii].split(",");
-					}
-					for (var iii = 1; iii < mb_mapObj[i].wms[ii].objLayer.length; iii++) {
-						var layer_name = mb_mapObj[i].wms[ii].objLayer[iii].layer_name;
-						if (type == "querylayer") {
-							if (layer_name == layerName && status == 1 && mb_mapObj[i].wms[ii].objLayer[iii].layer_queryable == 1){
-								if (cnt_layer > 0) {
-									str_layer += ",";
-								}
-								str_layer += layer_name;
-								cnt_layer++;                   
-							}
-						}
-						else if (type == "visible") {
-							if (layer_name == layerName && status == 1) {
-								if (cnt_layer > 0) {
-									str_layer += ",";
-								}
-								str_layer += layer_name;
-								cnt_layer++;                   
-							}
-						}
-						for (var iiii = 0; iiii < arrayLayer.length; iiii++) {
-							if (layer_name == arrayLayer[iiii] && layer_name != layerName) {
-								if (cnt_layer > 0) {
-									str_layer += ",";
-								}
-								str_layer += layer_name;
-								cnt_layer++;             
-							}
-						}
-					}
-				}   
-			}         
-		}
-	}
-	if (type == "visible") {
-		mb_mapObj[myMapObj].layers[myWMS] = str_layer;
-		var array_str_layer = str_layer.split(",");
-		var str_styles = "";
-		for (var cnt=0; cnt < array_str_layer.length; cnt++) {
-			if (cnt > 0) {
-				str_styles += ",";
-			}
-			str_styles += "";
-		}
-		mb_mapObj[myMapObj].styles[myWMS] = str_styles;
-	}
-	if (type == "querylayer") {
-		mb_mapObj[myMapObj].querylayers[myWMS] = str_layer;
-	}
-/*
-	if(type == 'visible'){
-		setSingleMapRequest(frameName,wms_title);
-	}
-*/
-}
-
-function handleSelectedLayer_array(mapObj, array_wms, array_layer, type, status){
-	//alert(mapObj+" / "+array_wms[0]+" / "+ array_layer[0]+" / "+ type+" / "+ status);
-	var ind = getMapObjIndexByName(mapObj);
-	for(var j=0; j<array_wms.length; j++){
-		for(var i=0; i<mb_mapObj[ind].wms.length; i++){
-			if(mb_mapObj[ind].wms[i].wms_id == array_wms[j]){
-				var check = false;
-				for(var ii=0; ii<mb_mapObj[ind].wms[i].objLayer.length; ii++){
-					if(mb_mapObj[ind].wms[i].wms_id == array_wms[j] && mb_mapObj[ind].wms[i].objLayer[ii].layer_name == array_layer[j]){
-						if(type == "visible"){
-							mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_visible = parseInt(status, 10);
-							//alert(mb_mapObj[ind].wms[i].objLayer[ii].layer_name);
-							check = true;
-						}
-                        if(type == "querylayer" && (mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_queryable == "1" || mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_queryable == 1)){
-							mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_querylayer = parseInt(status, 10);
-						}
-					}
-				}
-                mb_restateLayers(mapObj, array_wms[j]);
-                //alert('restate');
-                /*
-                * hier noch checken, welche wms sich geaendert haben und disctinct eine singleRequest aufrufen:
-                */ 
-                if(check === true){					
-                    
-                    if(mb_mapObj[ind].wms[i].gui_wms_visible == 1){
-						setSingleMapRequest(mapObj,mb_mapObj[ind].wms[i].wms_id);
-                        //alert('sSMR');
-					}
-				}
-			}
-		}
-	}
-}
-
-function makeClickPos2RealWorldPos(frameName, myClickX, myClickY) {
-	var ind = getMapObjIndexByName(frameName);
-	var width = parseInt(mb_mapObj[ind].width, 10);
-	var height = parseInt(mb_mapObj[ind].height, 10);
-	var arrayBBox = mb_mapObj[ind].extent.split(",");
-	var minX = parseFloat(arrayBBox[0]);
-	var minY = parseFloat(arrayBBox[1]);
-	var maxX = parseFloat(arrayBBox[2]);
-	var maxY = parseFloat(arrayBBox[3]);
-	var deltaX = (maxX - minX)/width;
-	var deltaY = (maxY - minY)/height;
-	if(deltaX > 0){
-		var roundx = 1/Math.pow(10,(Math.round(Math.log(deltaX)/Math.log(10))));
-	}
-	else{
-		var roundx =  Math.pow(10,(Math.round(Math.log(deltaX)/Math.log(10))));
-	}
-	if(deltaY > 0){
-		var roundy = 1/Math.pow(10,(Math.round(Math.log(deltaY)/Math.log(10))));
-	}
-	else{
-		var roundy =  Math.pow(10,(Math.round(Math.log(deltaY)/Math.log(10))));
-	}	
-	var xtentx = maxX - minX;
-	var xtenty =  maxY - minY;
-	var posX = parseFloat(minX + (myClickX / width) * xtentx);
-	var posY = parseFloat(maxY - (myClickY / height) * xtenty);
-	posX = Math.round(posX * roundx)/roundx;
-	posY = Math.round(posY * roundy)/roundy;
-	return [posX, posY];
-}
-
-function makeRealWorld2mapPos(frameName,rw_posx, rw_posy){
-   var ind = getMapObjIndexByName(frameName);
-   var mpObj = mb_mapObj[ind]; 
-   var arrayBBox = mpObj.extent.split(",");
-   var minX = parseFloat(arrayBBox[0]);
-   var minY = parseFloat(arrayBBox[1]);
-   var maxX = parseFloat(arrayBBox[2]);
-   var maxY = parseFloat(arrayBBox[3]);
-   return [Math.round((rw_posx - minX)*mpObj.width/(maxX - minX)), Math.round((maxY - rw_posy)*mpObj.height/(maxY - minY))];
-}
-
-function mb_arrangeElement(frameName, elName, left, top) {
-   if(frameName !== ""){
-      window.frames[frameName].document.getElementById(elName).style.top = top;
-      window.frames[frameName].document.getElementById(elName).style.left = left;
-   }
-   else{
-      document.getElementById(elName).style.top = top;
-      document.getElementById(elName).style.left = left;   
-   }
-}
-
-/***********************Drag & Drop***********************/
-function mb_getMousePos(e,fName){
-if(fName){
-     if(ie){
-        clickX = window.frames[fName].event.clientX;
-        clickY = window.frames[fName].event.clientY;
-     }
-     else{
-        clickX = e.pageX;
-        clickY = e.pageY;
-     }
-  }
-  else{
-       if(ie){
-        clickX = event.clientX;
-        clickY = event.clientY;
-     }
-     else{
-        clickX = e.pageX;
-        clickY = e.pageY;
-     }
-  }
-  var pos = [clickX,clickY];
-  return pos;
-}
-// function for object-identification 
-function getMapObjIndexByName(frameName){
-	for(var i=0; i<mb_mapObj.length; i++){
-		if(mb_mapObj[i].frameName == frameName){
-			return i;
-		}
-	}   
-}
-function getMapObjByName(frameName){
-	for(var i=0; i<mb_mapObj.length; i++){
-		if(mb_mapObj[i].frameName == frameName){
-			return mb_mapObj[i];
-		}
-	}
-	return false;
-}
-function mb_getLayerTitleByName(map_index, wms_index, myLayer_name){
-	for(var i=0; i<mb_mapObj[map_index].wms[wms_index].objLayer.length; i++){
-		if(mb_mapObj[map_index].wms[wms_index].objLayer[i].layer_name == myLayer_name){
-			return mb_mapObj[map_index].wms[wms_index].objLayer[i].layer_title;
-		}
-	}
-}
-function getWMSIDByTitle(frameName,wms_title){
-   var ind = getMapObjIndexByName(frameName);
-   for(var i=0; i< mb_mapObj[ind].wms.length; i++){
-      if(mb_mapObj[ind].wms[i].wms_title == wms_title){
-         //return i;
-         return mb_mapObj[ind].wms[i].wms_id;
-      }
-   }
-}
-function getWMSIndexByTitle(frameName,wms_title){
-   var ind = getMapObjIndexByName(frameName);
-   for(var i=0; i< mb_mapObj[ind].wms.length; i++){
-      if(mb_mapObj[ind].wms[i].wms_title == wms_title){
-         return i;
-      }
-   }
-}
-function getWMSIndexById(frameName,wms_id){
-   var ind = getMapObjIndexByName(frameName);
-   for(var i=0; i< mb_mapObj[ind].wms.length; i++){
-      if(mb_mapObj[ind].wms[i].wms_id == wms_id){
-         return i;
-      }
-   }
-}
-//scale
-function mb_getScale(frameName) {
-
-	var myScale = eventBeforeGetScale.trigger({"frameName":frameName});
-/*
-   for(var i=0; i<mb_GetScalePreFunctions.length; i++){
-		var myScale = eval(mb_GetScalePreFunctions[i]);
-	}
-*/
-   if(typeof(myScale) == "number"){
-      var Y_str = myScale;
-   }
-   else{
-      var ind = getMapObjIndexByName(frameName);
-      var arrayBBox = mb_mapObj[ind].extent.split(",");
-      var xtenty =  parseFloat(arrayBBox[3]) - parseFloat(arrayBBox[1]);
-      var scaleY = (xtenty / mb_mapObj[ind].height) *(mb_resolution * 100);
-      if (scaleY<1){
-      	var Y_str = scaleY;
-      }else{
-      	var Y_str = Math.round(scaleY);
-      }
-   }   
-   return Y_str;   
-}
-
-function mb_repaintScale(frameName, x, y, scale){
-   var ind = getMapObjIndexByName(frameName);
-   if(x === null && y === null){
-      var arrayBBox = mb_mapObj[ind].extent.split(",");
-      x = parseFloat(arrayBBox[0]) + ((parseFloat(arrayBBox[2]) - parseFloat(arrayBBox[0]))/2);
-      y = parseFloat(arrayBBox[1]) + ((parseFloat(arrayBBox[3]) - parseFloat(arrayBBox[1]))/2);
-   }
-   var minx = parseFloat(x) - (mb_mapObj[ind].width / (mb_resolution * 100 *2) * scale);
-   var miny = parseFloat(y) -  (mb_mapObj[ind].height / (mb_resolution * 100 *2) * scale);
-   var maxx = parseFloat(x) + (mb_mapObj[ind].width / (mb_resolution * 100 *2) * scale);
-   var maxy = parseFloat(y) +  (mb_mapObj[ind].height / (mb_resolution * 100 *2) * scale);
-   mb_repaint(frameName,minx, miny, maxx, maxy);
-}
-function mb_repaint(frameName,minx,miny,maxx,maxy){
-   var ind = getMapObjIndexByName(frameName);
-   mb_mapObj[ind].extent = minx + "," + miny + "," + maxx + "," + maxy;
-   setMapRequest(frameName);
-}
-/*
- * converts the extent of the mapobject so that the maximum	extent will be displayed {@link mb_mapObj_const#calculateExtent}
- * use: mb_mapObj.calculateExtent
- * @deprecated
- * 
- */
-function mb_calculateExtent(frameName,minx,miny,maxx,maxy){
-  var map = getMapObjByName(frameName);
-  var extent = new Extent(minx,miny,maxx,maxy);
-  map.calculateExtent(extent);
-}
-/*
- * @class extent
- * @param {float} minx
- * @param {float} miny
- * @param {float} maxx
- * @param {float} maxy
- * @return the extent as object
- * @type Object
- */
-function Extent(minx,miny,maxx,maxy){
-	this.minx = parseFloat(minx);
-	this.miny = parseFloat(miny);
-	this.maxx = parseFloat(maxx);
-	this.maxy = parseFloat(maxy);
-	this.extentx = this.maxx - this.minx;
-	this.extenty = this.maxy - this.miny;
-	this.centerx = this.minx + this.extentx/2;
-	this.centery = this.miny + this.extenty/2;	
-	return this;
-}
-
-function mb_showHighlight(frameName,x,y){
-   var pos = makeRealWorld2mapPos(frameName,x, y);
-   mb_arrangeElement(frameName,"highlight",pos[0]-7, pos[1]-7);
-   window.frames[frameName].document.getElementById("highlight").style.visibility = 'visible';
-}
-function mb_hideHighlight(frameName){
-   mb_arrangeElement(frameName,"highlight",-20, -20);
-   mb_arrangeElement(frameName,"highlight",-20, -20);
-   window.frames[frameName].document.getElementById("highlight").style.visibility = 'hidden';
-}
-function mb_permanentHighlight(frameName,x,y){   
-   var pos = makeRealWorld2mapPos(frameName,x, y);
-   mb_arrangeElement(frameName,"permanent",pos[0]-7, pos[1]-7);
-   window.frames[frameName].document.getElementById("permanent").style.visibility = 'visible';
-}
-// framename, commaseparated coordinates, commaseparated rgb values (color)
-//new: coords is array!
-function mb_markResult(frameName,geom,col){
-	var x = "";
-	var y = "";
-	var tmp = [];
-	var ind = getMapObjIndexByName(frameName);
-	for(var i=0; i < geom.length; i++){
-		if(i > 0){
-			x += ":";
-			y += ":";
-		}
-		tmp = geom[i].split(",");
-		for(var ii=0; ii < tmp.length; ii+=2){			
-			var pos = makeRealWorld2mapPos(frameName,tmp[ii], tmp[ii+1]);
-			if(ii>0){
-				x += ",";
-				y += ",";
-			}
-			x += pos[0];
-			y += pos[1];
-		}      
-	}
-	var source = "<img src='../extensions/markResult.php?x=" + x + "&y=" + y + "&width=" + mb_mapObj[ind].width + "&height=" + mb_mapObj[ind].height + "&color="+col+"'>";
-	//prompt("",source);
-	writeTag(frameName,"markResult",source);   
-}
-function mb_disableResult(frameName){
-   writeTag(frameName,"markResult","");
-}
-
-function mb_registerGML(frameName,obj){
-	var ind = getMapObjIndexByName(frameName);
-	mb_mapObj[ind].geom = obj;
-}
-function mb_timestamp(){
-	var d = new Date();
-	var ts = Math.round(Date.parse(d)/1000);
-	return ts;
-}
-function mb_getlayerposbyname(objInd,wmsInd,lname){
-	var t = mb_mapObj[objInd].wms[wmsInd];
-	for(var i=0; i < t.objLayer.length; i++){
-		if(t.objLayer[i].layer_name == lname){
-			return t.objLayer[i].layer_pos;
-		}
-	}
-}
-function mb_getLayerObjByName(fname,wms_id,layer_name){
-	var ind = getMapObjIndexByName(fname);
-	var wmsInd = getWMSIndexById(fname,wms_id);
-	var t = mb_mapObj[ind].wms[wmsInd];
-	for(var i=0; i < t.objLayer.length; i++){
-		if(t.objLayer[i].layer_name == layer_name){
-			return t.objLayer[i];
-		}
-	}
-}
-function mb_getchildsbyname(objInd,wmsInd,lname){
-	var t = mb_mapObj[objInd].wms[wmsInd];
-	var pos = mb_getlayerposbyname(objInd, wmsInd,lname);
-	var l = [];
-	l.name = [];
-	l.title = [];
-	l.legendurl = [];
-	for(var i=0; i < t.objLayer.length; i++){
-		if(t.objLayer[i].layer_parent == pos){
-			l.name[l.name.length] = t.objLayer[i].layer_name;
-			l.title[l.title.length] = t.objLayer[i].layer_title;
-			if(t.objLayer[i].layer_style.length>0){
-				l.legendurl[l.legendurl.length] = t.objLayer[i].layer_style[0].legendurl;
-			}else{
-				l.legendurl[l.legendurl.length] = 0 ;
-			}
-		}
-	}
-	if(l.name.length > 0){
-		return l;
-	}
-	else{
-		return false;
-	}
-}
-
-/*
- ***************************************************************************************
- *   div tag
- ***************************************************************************************
- */
-
-/**
- * @class Represents a div tag. May be located in any frame of Mapbender.
- * 
- * @constructor
- * @param aTagName {String} the name of the tag
- * @param aFrameName {String} the name of frame where the div tag is being created
- * @param aStyle {Object} an object containing a set of name value pairs, like
- *                        {position:absolute,top:30,z-Index:30}
- */
-function DivTag (aTagName, aFrameName, aStyle) {
-	/**
-	 * @ignore
-	 */
-	this.exists = function () { 
-		return (rootNode.getElementById(tagName)) ? true : false;
-	};
-	
-	/**
-	 * @ignore
-	 */
-	this.getTag = function() {
-		return rootNode.getElementById(tagName);
-	};
-	
-	/**
-	 * @private
-	 */
-	var determineRootNode = function () {
-		node = document;
-		if (frameName !== "") {
-			if (checkFrame()) {node = window.frames[frameName].document;}
-			else {var e = new Mb_exception("frame "+frameName+" doesn't exist.");}
-		}
-		return node;	
-	};
-	
-	/**
-	 * @private
-	 */
-	var toCamelCase = function(aString) {
-		var newString = "";
-		for (var i = 0; i < aString.length; i++) {
-			if (aString.substr(i,1) != "-") {
-				newString += aString.substr(i,1); 
-			}
-			else {
-				i++;
-				newString += aString.substr(i,1).toUpperCase();
-			}
-		}
-		return newString;
-	};
-	
-	/**
-	 * @private
-	 */
-	var setStyle = function () {
-		if (that.exists()) {
-			var node = rootNode.getElementById(tagName);
-			node.setAttribute("style", "");
-			
-			for (var attr in tagStyle) {
-				if (typeof(tagStyle[attr]) != "function" && typeof(tagStyle[attr]) != "object") {
-					var evalString = "node.style."+toCamelCase(attr)+" = \"" + tagStyle[attr] + "\";"; 
-					eval(evalString);				
-				}
-			}
-		}
-	};
-	
-	/**
-	 * @private
-	 */
-	var create = function () {
-		if (!that.exists()) {
-			var divTag = rootNode.createElement("div");
-			var divTagAppended = rootNode.getElementsByTagName("body")[0].appendChild(divTag);
-			divTagAppended.id = tagName;
-		}
-		else {
-			that.clean();
-		}
-		setStyle();
-	};
-
-	/**
-	 * @private
-	 */
-	var checkFrame = function () {
-		if (frameName !== "") {
-			return (typeof(window.frames[frameName]) != 'undefined');
-		}
-		return true;
-	};
-	
-	var that = this;
-	var tagName = aTagName;
-	var frameName = aFrameName;
-	var rootNode = determineRootNode();
-	var tagStyle = aStyle;
-
-	create();
-}
-/**
- * Writes a text into the div tag, while removing existing content.
- * 
- * @param {String} someText the text that is inserted into the tag.
- */
-DivTag.prototype.write = function (someText) {
-	if (this.exists()) {
-		this.getTag().innerHTML = someText;
-	}
-};
-
-/**
- * Deletes the div tag content.
- */
-DivTag.prototype.clean = function () {
-	this.write("");
-};
-
-
-/*
- ***************************************************************************************
- *   Javascript exception handling
- ***************************************************************************************
- */
-
-/**
- * @class An abstract class, logs JavaScript events like errors, warnings etc.
- *
- * @constructor
- */
-var Mb_log = function() {
-	var that = this;
-	
-	var levelArray = global_log_levels.split(",");
-	var log_level = global_mb_log_level;
-	var log_js = global_mb_log_js;
-	
-	var indexOfLevel = function(aLevel) {
-		for (var i = 0; i < levelArray.length; i++) {
-			if (aLevel == levelArray[i])  {
-				return i;
-			}
-		}
-		return false;
-	};
-	var isValidLevel = function(aLevel) {
-		var isNotOff = typeof(log_js) != 'undefined' && log_js != "off";
-		var levelIndex = indexOfLevel(aLevel);
-		var isAppropriate = (typeof(levelIndex)=='number' && levelIndex < indexOfLevel(log_level));
-		return (isNotOff && isAppropriate);
-	};
-	this.throwException = function (message, level) {
-		if (isValidLevel(level)) {
-			if (log_js == "on") {
-				try {
-					mb_ajax_post('../php/mb_js_exception.php', {level:level,text:message});
-				}
-				catch(e) {
-					alert(e + ": " + message);
-				}
-			}
-			else if (log_js == "alert") {
-				alert(message);
-			}
-			else if (log_js == "console") {
-				if (level == "warning") {
-					console.warn("%s", message);
-				}
-				else if (level == "error") {
-					console.error("%s", message);
-				}
-				else {
-					console.log("%s", message);
-				}
-			}
-		}
-	};
-};	
-
-/**
- *  class for exception logging
- *
- * @extends {@link Mb_log}
- * @param message the message that is being logged
- */	
-function Mb_exception(message) {
-	 var level = "error";
-	this.throwException(message, level);
-}
-Mb_exception.prototype = new Mb_log();
-
-/**
- *  class for warning logging
- *
- * @extends {@link Mb_log}
- * @param message the message that is being logged
- */
-function Mb_warning(message) {
-	var level = "warning";
-	this.throwException(message, level);
-}
-Mb_warning.prototype = new Mb_log();
- 
-/**
- *  class for notice logging
- *
- * @extends {@link Mb_log}
- * @param message the message that is being logged
- */	
- 
-function Mb_notice(message) {
-	var level = "notice";
-	this.throwException(message, level);
-}
-Mb_notice.prototype = new Mb_log();
-
-/*
- ***************************************************************************************
- *   AJAX wrapper functions
- ***************************************************************************************
- */
-/**
- * A wrapper for an AJAX request via GET 
- *
- * @param {String} url the URL of a (presumably a server side) script.
- * @param {Object} param An object containing parameters, f.e. {name1:value1, name2:value2}
- * @param {Function} callback A function that is called when the server side script has been processed. The function is called with two parameters, result and status. Result is the output of the server side script (XML, HTML, whatever), status is a {String}, either "success" or "error". 
- */
-function mb_ajax_get(url, param, callback) {
-	try {
-//		$.ajaxSetup({async:false}); 
-		$.get(url, param, callback);
-	}
-	catch(e) {
-		var error = new Mb_exception('map.php: mb_ajax_get:'+e);
-	}
-}	
-
-/**
- * A wrapper for an AJAX request via POST 
- *
- * @param {String} url the URL of a (presumably a server side) script.
- * @param {Object} param An object containing parameters, f.e. {name1:value1, name2:value2}
- * @param {Function} callback A function that is called when the server side script has been processed. The function is called with two parameters, result and status. Result is the output of the server side script (XML, HTML, whatever), status is a {String}, either "success" or "error". 
- */
-function mb_ajax_post(url, param, callback) {
-	try {
-//		$.ajaxSetup({async:false}); 
-		$.post(url, param, callback);
-	}
-	catch(e) {
-		var error = new Mb_exception('map.php: mb_ajax_post:'+e);
-	}
-}	
-	
-/**
- * A wrapper for an AJAX request via GET 
- *
- * @param {String} url the URL of a (presumably a server side) script.
- * @param {Object} param An object containing parameters, f.e. {name1:value1, name2:value2}
- * @param {Function} callback A function that is called when the server side script has been processed. The function is called with two parameters, result and status. Result is the output of the server side script (a JavaScript Object, not a String!), status is a {String}, either "success" or "error". 
- */
-function mb_ajax_json(url, param, callback) {
-	try {
-//		window.frames['ajax'].$.ajaxSetup({async:false}); //TODO: find out why async doesn't work sometimes
-		$.getJSON(url, param, callback);
-	}
-	catch(e) {
-		var error = new Mb_exception('map.php: mb_ajax_json:'+e);
-	}
-}	
-
-/*
- ***************************************************************************************
- *   button handling
- ***************************************************************************************
- */
- 
-var mb_button = [];
-
-function mb_regButton_frame(wii, frameName, param){
-	var ind = mb_button.length;
-	mb_button[ind] = new mb_conButton(wii, ind);
-	if (frameName === null) {
-		if (param === null) {
-			eval(wii+"("+ind+")");
-		}
-		else {
-			eval(wii+"("+ind+", "+param+")");
-		}
-	}
-	else if (param === null) {
-		eval("window.frames['" + frameName + "']."+wii+"("+ind+")");
-	}
-	else {
-		eval("window.frames['" + frameName + "']."+wii+"("+ind+", "+param+")");
-	}
-	mb_button[ind].prev = mb_button[ind].src;
-	mb_button[ind].src = mb_button[ind].img_off;
-	mb_button[ind].onmouseover = function () {
-		mb_button_over(ind);
-	};
-	mb_button[ind].onmouseout = function(){
-		mb_button_out(ind);
-	};
-	mb_button[ind].onclick = function(){
-		mb_button_click(ind);
-	};
-	if (frameName === null) {
-		mb_button[ind].frameName = "";
-	}
-	else {
-		mb_button[ind].frameName = frameName;
-	}
-}
-
-function mb_regButton(wii){
-	mb_regButton_frame(wii, null, null);
-}
-
-function mb_conButton(wii, ind){
-   this.wii = wii;
-   return true;
-}
-function mb_button_over(ind){
-   if(mb_button[ind].status === 0){
-      mb_button[ind].prev = mb_button[ind].src;
-      mb_button[ind].src = mb_button[ind].img_over;
-   }
-}
-function mb_button_out(ind){
-   if(mb_button[ind].status === 0){
-   		mb_button[ind].src = mb_button[ind].img_off;
-   }
-}
-function mb_button_click(ind){
-   var mbStatus = mb_button[ind].status;
-   if(mbStatus === 0){
-      mb_disableButton(mb_button[ind].elName);
-      mb_button[ind].prev = mb_button[ind].img_on;
-      mb_button[ind].src = mb_button[ind].img_on;
-      mb_button[ind].status = 1;
-      if (mb_button[ind].frameName !== "") {
-          window.frames[mb_button[ind].frameName].document.getElementById(mb_button[ind].elName).go();
-      }
-      else {
-	      document.getElementById(mb_button[ind].elName).go();
-      }
-   }
-   else{
-      mb_button[ind].prev = mb_button[ind].img_off;
-      mb_button[ind].src = mb_button[ind].img_off;
-      mb_button[ind].status = 0;      
-      if (mb_button[ind].frameName !== "") {
-          window.frames[mb_button[ind].frameName].document.getElementById(mb_button[ind].elName).stop();
-      }
-      else {
-	      document.getElementById(mb_button[ind].elName).stop();
-      }
-   }
-}
-function mb_disableButton(elName){
-   for(var i=0; i<mb_button.length; i++){
-      if(mb_button[i].elName != elName && mb_button[i].status == 1){
-            mb_button[i].status = 0;
-		      if (mb_button[i].frameName !== "") {
-    	        window.frames[mb_button[i].frameName].document.getElementById(mb_button[i].elName).src = mb_button[i].img_off;
-	            window.frames[mb_button[i].frameName].document.getElementById(mb_button[i].elName).stop();
-		      }
-		      else {
-    	        document.getElementById(mb_button[i].elName).src = mb_button[i].img_off;
-	            document.getElementById(mb_button[i].elName).stop();
-		      }
-            return true;
-       
-      }
-   }
-}
-function mb_disableThisButton(elName){
-   for(var i=0; i<mb_button.length; i++){
-      if(mb_button[i].elName == elName && mb_button[i].status == 1){
-      		//alert(mb_button[i].elName);
-            mb_button[i].status = 0;
-		      if (mb_button[i].frameName !== "") {
-    	        window.frames[mb_button[i].frameName].document.getElementById(mb_button[i].elName).src = mb_button[i].img_off;
-	            window.frames[mb_button[i].frameName].document.getElementById(mb_button[i].elName).stop();
-		      }
-		      else {
-        	    document.getElementById(mb_button[i].elName).src = mb_button[i].img_off;
-		        document.getElementById(mb_button[i].elName).stop();
-		      }
-            return true;
-       
-      }
-   }
-}
-function updateButtonTooltips(obj) {
-/*	
- * the buttons are only initialized on mouseover! 
- * So when localizing, not all buttons may have been registered 
- *
-	for(var i=0; i<mb_button.length; i++){
-//		console.log("button %i", i);
-		for(var j=0; j<obj.length; j++){
-			if (mb_button[i].elName == obj[j].id) {
-//			console.log("%s %s", mb_button[i].elName, obj[j].id);
-				if (mb_button[i].frameName !== "") {
-					window.frames[mb_button[i].frameName].document.getElementById(mb_button[i].elName).title = obj[j].title;
-				}
-				else {
-					document.getElementById(mb_button[i].elName).title = obj[j].title;
-				}
-			}
-		}
-	}
-*/
-
-	// an alternative, fixes above error,
-	// but this one only changes those in the main frame
-	var imageArray = document.getElementsByTagName("img");
-	for (var i = 0; i < imageArray.length; i++) {
-		for(var j=0; j<obj.length; j++){
-			if (imageArray[i].id == obj[j].id) {
-				document.getElementById(imageArray[i].id).title = obj[j].title;
-			}
-		}
-	}
-}
-
-function mb_localizeButtons(){
-	mb_ajax_json("../php/mod_button_tooltips.php", function(obj, status){
-		updateButtonTooltips(obj);
-	});
-}
-
-eventLocalize.register(function () {
-	mb_localizeButtons();
-});
-
-eventInit.register(function () {
-	mb_localizeButtons();
-});
-
-
-/*
- ***************************************************************************************
- *   miscellaneous functions
- ***************************************************************************************
- */
-
-function cloneObject(obj) { 
-    if (typeof obj !== 'object' || obj === null) {
-        return obj;
-    }
-    var c = obj instanceof Array ? [] : {};
-    for (var i in obj) {
-        var prop = obj[i];
-        if (typeof prop == 'object') {
-           if (prop instanceof Array) {
-               c[i] = [];
-               for (var j = 0; j < prop.length; j++) {
-                   if (typeof prop[j] != 'object') {
-                       c[i].push(prop[j]);
-                   } else {
-                       c[i].push(cloneObject(prop[j]));
-                   }
-               }
-           } else {
-               c[i] = cloneObject(prop);
-           }
-        } else {
-           c[i] = prop;
-        }
-    }
-    return c;
-}
-
-
-/**
- * @class A List object is an array of arbitrary objects with additional methods. 
- *
- * @constructor
- */
-var List = function() {
-	
-	/**
-	 * gets the number of elements in this {@link List}
-	 *
-	 * @returns number of elements in this {@link List}
-	 * @type Integer
-	 */
-	this.count = function() {
-		return this.list.length;
-	};
-
-	/**
-	 * deletes the object at index i; -1 refers to the last object in this {@link List}
-	 *
-	 * @param {Integer} i index
-	 */
-	this.del = function(i){
-		i = this.getIndex(i);
-		if (i !== false) {
-			for(var z = i; z < this.count() - 1; z++){
-				this.list[z] = this.list[z+1];
-			}
-			this.list.length -= 1;
-			return true;
-		}
-		return false;
-	};
-
-	/**
-	 * empties this {@link List}
-	 */
-	this.empty = function() {
-		while (this.list !== null && this.count() > 0) {
-			this.list.pop();
-		}
-	};
-	
-	/**
-	 * @param {Integer} i index
-	 * @returns the object at index i; -1 refers to the last object in this {@link List}
-	 * @type Integer or false
-	 */
-	this.get = function(i) {
-		i = this.getIndex(i);
-		if (i !== false) {return this.list[i];}
-		return false;		
-	};
-	/**
-	 * adds a reference to item to this {@link List}.
-	 *
-	 * @param {Object} item an object
-	 */
-	this.add = function(item) {
-		var i = this.list.length;
-		this.list[i] = item;
-	};
-	/**
-	 * adds a copy of item to this {@link List}.
-	 *
-	 * @param {Object} item an object
-	 */
-	this.addCopy = function(item) {
-		this.add(cloneObject(item));
-	};
-	/**
-	 * attaches the {@link List} aList to this {@link List}
-	 *
-	 * @param {List} aList another list
-	 */
-	this.union = function(aList) {
-		for (var i=0; i < aList.count(); i++) {this.addCopy(aList.get(i));}
-	};
-	/**
-	 * checks if the index is valid and returns it if it is; if i == -1, the correct index is retrieved.
-	 *
-	 * @private
-	 * @return Integer or false
-	 * @type Integer
-	 */
-	this.getIndex = function(i){ 
-		var len = this.list.length;
-		if (i<0 && len + i > -1) {
-			return len + i;			
-		}
-		else if (i > -1 && i < len){
-			return i;
-		}
-		var e = new Mb_exception("class List: function getIndex: member index " + i + " is not valid");
-		return false;
-	};
-	/**
-	 * @returns a {String} representation of this List
-	 * @type String
-	 */
-	this.toString = function(){
-		var str = "";
-		for (var i =0 ; i < this.count() ; i++){
-			str += this.get(i).toString();
-		}
-		return str;	
-	};	
-	
-	this.list = null;
-};
-
-
-/*
- ***************************************************************************************
- *   deprecated functions
- ***************************************************************************************
- */
-
-// only used in mod_perimeter.php
-// previously used in mod_initWmc.php, mod_digitize_tab.php, mod_geometryArray.js
-function mb_checkTag(frameName, tagName, elementId, appendAtTagName, attributes){
-	var oldElement;
-	var newElement;
-	var prefix;
-	if(frameName && frameName !== ""){
-		prefix = window.frames[frameName].document;
-	}
-	else if(!frameName || frameName === ""){
-		prefix = document;
-	}
-	oldElement = prefix.getElementById(elementId);
-	if (oldElement === null) {
-		newElement = prefix.createElement(tagName);
-		newElement = prefix.getElementsByTagName(appendAtTagName)[0].appendChild(newElement);
-	}
-	else {
-		if (oldElement.nodeName.toLowerCase() == tagName.toLowerCase()) {
-			for (var i=0; i<attributes.length; i++) {
-				oldElement.setAttribute(attributes[i][0], attributes[i][1]);
-			}
-			return oldElement;
-		}
-		else {
-			return false;
-		}
-	}
-	var newElementAttributeNode = document.createAttribute("id");
-	newElementAttributeNode.value = elementId;
-	newElement.setAttributeNode(newElementAttributeNode);
-	for (var i=0; i<attributes.length; i++) {
-		newElement.setAttribute(attributes[i][0], attributes[i][1]);
-	}
-	return newElement;
-}
\ No newline at end of file
+					str_layer += thisLayer[ii];
+					cnt_layer++;
+				}
+			}
+		}
+	}
+	var str_layerstyles = [];
+	str_layerstyles[0] = str_layer;
+	return str_layerstyles;
+}
+function setFeatureInfoRequest(fName,x,y, path) {
+	var functionName = 'setFeatureInfoRequest';
+	var ts = mb_timestamp();
+	eventBeforeFeatureInfo.trigger({"fName":fName});
+/*
+	for(var i=0; i<mb_FeatureInfoPreFunctions.length; i++){
+		eval(mb_FeatureInfoPreFunctions[i]);
+	}   
+*/
+	var cnt_fi = 0;
+	for(i=0; i<mb_mapObj.length; i++){
+		if(mb_mapObj[i].frameName == fName){
+			for(var ii=0; ii<mb_mapObj[i].wms.length; ii++){
+				var newfeatureInfoRequest = "";
+				var requestParams = "";
+				var validation = false;
+				newfeatureInfoRequest += mb_mapObj[i].wms[ii].wms_getfeatureinfo;          
+            	newfeatureInfoRequest += mb_getConjunctionCharacter(mb_mapObj[i].wms[ii].wms_getfeatureinfo);
+            	
+				if(mb_mapObj[i].wms[ii].wms_version == "1.0.0"){requestParams += "WMTVER="+mb_mapObj[i].wms[ii].wms_version+"&REQUEST=feature_info&";}
+				if(mb_mapObj[i].wms[ii].wms_version != "1.0.0"){requestParams += "VERSION="+mb_mapObj[i].wms[ii].wms_version+"&REQUEST=GetFeatureInfo&SERVICE=WMS&";}
+				requestParams += "SRS="+mb_mapObj[i].epsg+"&";
+				requestParams += "BBOX="+mb_mapObj[i].extent+"&";
+				requestParams += "WIDTH="+mb_mapObj[i].width+"&";
+				requestParams += "HEIGHT="+mb_mapObj[i].height+"&";
+				requestParams += "LAYERS="+mb_mapObj[i].layers[ii]+"&";
+				requestParams += "STYLES="+mb_mapObj[i].styles[ii]+"&";
+				requestParams += "FORMAT="+mb_mapObj[i].wms[ii].gui_wms_mapformat+"&";
+				requestParams += "INFO_FORMAT="+mb_mapObj[i].wms[ii].gui_wms_featureinfoformat+"&";
+				requestParams += "EXCEPTIONS=application/vnd.ogc.se_xml&";
+				if(mb_feature_count > 0){             
+					requestParams += "FEATURE_COUNT="+mb_feature_count+"&";
+				}
+				requestParams += "QUERY_LAYERS="+mb_mapObj[i].querylayers[ii]+"&";
+				requestParams += "X=" + x  + "&";
+				requestParams += "Y=" + y;
+				
+				if(mb_mapObj[i].querylayers[ii] !== "" && mb_mapObj[i].layers[ii] !== ""){
+					validation = true;
+				}
+				//add vendor-specific
+				for(var v=0; v < mb_vendorSpecific.length; v++){
+					var vendorSpecificString = eval(mb_vendorSpecific[v]); 
+					requestParams += "&" + vendorSpecificString; 
+				}
+				if(mb_log && validation){
+					var tmp = eval(mb_log + "('" + newfeatureInfoRequest + requestParams + "','" + ts + "')");
+				}
+				if(document.getElementById("FeatureInfoRedirect") && validation){
+					newfeatureInfoRequest += requestParams;
+					if(path){
+						window.frames.FeatureInfoRedirect.document.getElementById(mb_mapObj[i].wms[ii].wms_id).src = path + "?url=" + escape(newfeatureInfoRequest)+"&"+mb_nr;
+					}
+					else{
+						window.frames.FeatureInfoRedirect.document.getElementById(mb_mapObj[i].wms[ii].wms_id).src = newfeatureInfoRequest;
+					}
+					cnt_fi++;
+            	}
+				else if(path && validation){
+					newfeatureInfoRequest += requestParams;
+					try{
+						var p = new mb_popup({
+							title:"Feature Info",
+							url:path + "?url=" + escape(newfeatureInfoRequest)+"&"+mb_nr,
+							width:600,
+							height:500,
+							top:200,
+							left:600
+						});
+						p.show();
+					}catch(e){
+						window.open(path + "?url=" + escape(newfeatureInfoRequest)+"&"+mb_nr, "" , "width=300,height=400,scrollbars=yes,resizable=yes");
+					}
+					cnt_fi++;
+				}
+				else if(validation){
+					newfeatureInfoRequest += requestParams;
+					try{
+						var p = new mb_popup({
+							title:"Feature Info",
+							url:newfeatureInfoRequest,
+							width:600,
+							height:500,
+							top:200,
+							left:600
+						});
+						p.show();
+					}
+					catch(e){
+						window.open(newfeatureInfoRequest, "" , "width=300,height=400,scrollbars=yes,resizable=yes");					
+					}
+					cnt_fi++;
+				}    
+			}
+		}
+	}
+   	if(cnt_fi === 0){
+		alert(unescape("Please select a layer! \n Bitte waehlen Sie eine Ebene zur Abfrage aus!"));
+	}
+}
+
+/*
+ * global function to zoom a mapobject
+ * 
+ * use: mb_mapObj.zoom() {@link mb_mapObj_const#zoom}
+ * @deprecated
+ * 
+ */
+function zoom(frameName,in_, factor,x,y) {
+	var obj = getMapObjByName(frameName);
+	if(x && y){
+		obj.zoom(in_, factor, x, y);
+	}
+	else{
+		obj.zoom(in_, factor, false, false);
+	}	
+	setMapRequest(frameName);
+}
+function mb_panMap(frameName,dir){
+   var ind = getMapObjIndexByName(frameName);
+   var arrayBBox = mb_mapObj[ind].extent.split(",");
+   var minx = parseFloat(arrayBBox[0]);
+   var miny = parseFloat(arrayBBox[1]);
+   var maxx = parseFloat(arrayBBox[2]);
+   var maxy = parseFloat(arrayBBox[3]);
+   var xtentx = parseFloat(arrayBBox[2]) - parseFloat(arrayBBox[0]);
+   var xtenty =  parseFloat(arrayBBox[3]) - parseFloat(arrayBBox[1]);
+
+   if(dir == "NW"){minx = minx - (xtentx/2); maxx = maxx - (xtentx/2); miny = miny + (xtenty/2); maxy = maxy + (xtenty/2);}
+   if(dir == "N"){miny = miny + (xtenty/2); maxy = maxy + (xtenty/2);}
+   if(dir == "NE"){minx = minx + (xtentx/2); maxx = maxx + (xtentx/2); miny = miny + (xtenty/2); maxy = maxy + (xtenty/2);}
+   if(dir == "W"){minx = minx - (xtentx/2); maxx = maxx - (xtentx/2);}
+   if(dir == "E"){minx = minx + (xtentx/2); maxx = maxx + (xtentx/2);}
+   if(dir == "SW"){minx = minx - (xtentx/2); maxx = maxx - (xtentx/2); miny = miny - (xtenty/2); maxy = maxy - (xtenty/2);}
+   if(dir == "S"){miny = miny - (xtenty/2); maxy = maxy - (xtenty/2);}
+   if(dir == "SE"){minx = minx + (xtentx/2); maxx = maxx + (xtentx/2); miny = miny - (xtenty/2); maxy = maxy - (xtenty/2);}
+  mb_mapObj[ind].extent = minx + "," + miny + "," + maxx + "," + maxy;
+  setMapRequest(frameName);
+}
+
+function handleSelectedLayer (frameName, wms_title, layerName, type, status) {
+//	alert(frameName + " , " +wms_title + " , " +layerName + " , " +type + " , " +status);
+//	type = {visible || querylayer] status = {0 || 1}
+	for (var i=0; i < mb_mapObj.length; i++) {
+		if (mb_mapObj[i].frameName == frameName) {
+			var cnt_layer = 0;
+			var str_layer = "";
+			var myMapObj = i;
+			for (var ii = 0; ii < mb_mapObj[i].wms.length; ii++) {
+				if (mb_mapObj[i].wms[ii].wms_title == wms_title) { //ii is true
+					var myWMS = ii; 
+					if (type == "visible") {
+						var arrayLayer = mb_mapObj[i].layers[ii].split(",");
+					}
+					if (type == "querylayer") {
+						var arrayLayer = mb_mapObj[i].querylayers[ii].split(",");
+					}
+					for (var iii = 1; iii < mb_mapObj[i].wms[ii].objLayer.length; iii++) {
+						var layer_name = mb_mapObj[i].wms[ii].objLayer[iii].layer_name;
+						if (type == "querylayer") {
+							if (layer_name == layerName && status == 1 && mb_mapObj[i].wms[ii].objLayer[iii].layer_queryable == 1){
+								if (cnt_layer > 0) {
+									str_layer += ",";
+								}
+								str_layer += layer_name;
+								cnt_layer++;                   
+							}
+						}
+						else if (type == "visible") {
+							if (layer_name == layerName && status == 1) {
+								if (cnt_layer > 0) {
+									str_layer += ",";
+								}
+								str_layer += layer_name;
+								cnt_layer++;                   
+							}
+						}
+						for (var iiii = 0; iiii < arrayLayer.length; iiii++) {
+							if (layer_name == arrayLayer[iiii] && layer_name != layerName) {
+								if (cnt_layer > 0) {
+									str_layer += ",";
+								}
+								str_layer += layer_name;
+								cnt_layer++;             
+							}
+						}
+					}
+				}   
+			}         
+		}
+	}
+	if (type == "visible") {
+		mb_mapObj[myMapObj].layers[myWMS] = str_layer;
+		var array_str_layer = str_layer.split(",");
+		var str_styles = "";
+		for (var cnt=0; cnt < array_str_layer.length; cnt++) {
+			if (cnt > 0) {
+				str_styles += ",";
+			}
+			str_styles += "";
+		}
+		mb_mapObj[myMapObj].styles[myWMS] = str_styles;
+	}
+	if (type == "querylayer") {
+		mb_mapObj[myMapObj].querylayers[myWMS] = str_layer;
+	}
+/*
+	if(type == 'visible'){
+		setSingleMapRequest(frameName,wms_title);
+	}
+*/
+}
+
+function handleSelectedLayer_array(mapObj, array_wms, array_layer, type, status){
+	//alert(mapObj+" / "+array_wms[0]+" / "+ array_layer[0]+" / "+ type+" / "+ status);
+	var ind = getMapObjIndexByName(mapObj);
+	for(var j=0; j<array_wms.length; j++){
+		for(var i=0; i<mb_mapObj[ind].wms.length; i++){
+			if(mb_mapObj[ind].wms[i].wms_id == array_wms[j]){
+				var check = false;
+				for(var ii=0; ii<mb_mapObj[ind].wms[i].objLayer.length; ii++){
+					if(mb_mapObj[ind].wms[i].wms_id == array_wms[j] && mb_mapObj[ind].wms[i].objLayer[ii].layer_name == array_layer[j]){
+						if(type == "visible"){
+							mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_visible = parseInt(status, 10);
+							//alert(mb_mapObj[ind].wms[i].objLayer[ii].layer_name);
+							check = true;
+						}
+                        if(type == "querylayer" && (mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_queryable == "1" || mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_queryable == 1)){
+							mb_mapObj[ind].wms[i].objLayer[ii].gui_layer_querylayer = parseInt(status, 10);
+						}
+					}
+				}
+                mb_restateLayers(mapObj, array_wms[j]);
+                //alert('restate');
+                /*
+                * hier noch checken, welche wms sich geaendert haben und disctinct eine singleRequest aufrufen:
+                */ 
+                if(check === true){					
+                    
+                    if(mb_mapObj[ind].wms[i].gui_wms_visible == 1){
+						setSingleMapRequest(mapObj,mb_mapObj[ind].wms[i].wms_id);
+                        //alert('sSMR');
+					}
+				}
+			}
+		}
+	}
+}
+
+function makeClickPos2RealWorldPos(frameName, myClickX, myClickY) {
+	var ind = getMapObjIndexByName(frameName);
+	var width = parseInt(mb_mapObj[ind].width, 10);
+	var height = parseInt(mb_mapObj[ind].height, 10);
+	var arrayBBox = mb_mapObj[ind].extent.split(",");
+	var minX = parseFloat(arrayBBox[0]);
+	var minY = parseFloat(arrayBBox[1]);
+	var maxX = parseFloat(arrayBBox[2]);
+	var maxY = parseFloat(arrayBBox[3]);
+	var deltaX = (maxX - minX)/width;
+	var deltaY = (maxY - minY)/height;
+	if(deltaX > 0){
+		var roundx = 1/Math.pow(10,(Math.round(Math.log(deltaX)/Math.log(10))));
+	}
+	else{
+		var roundx =  Math.pow(10,(Math.round(Math.log(deltaX)/Math.log(10))));
+	}
+	if(deltaY > 0){
+		var roundy = 1/Math.pow(10,(Math.round(Math.log(deltaY)/Math.log(10))));
+	}
+	else{
+		var roundy =  Math.pow(10,(Math.round(Math.log(deltaY)/Math.log(10))));
+	}	
+	var xtentx = maxX - minX;
+	var xtenty =  maxY - minY;
+	var posX = parseFloat(minX + (myClickX / width) * xtentx);
+	var posY = parseFloat(maxY - (myClickY / height) * xtenty);
+	posX = Math.round(posX * roundx)/roundx;
+	posY = Math.round(posY * roundy)/roundy;
+	return [posX, posY];
+}
+
+function makeRealWorld2mapPos(frameName,rw_posx, rw_posy){
+   var ind = getMapObjIndexByName(frameName);
+   var mpObj = mb_mapObj[ind]; 
+   var arrayBBox = mpObj.extent.split(",");
+   var minX = parseFloat(arrayBBox[0]);
+   var minY = parseFloat(arrayBBox[1]);
+   var maxX = parseFloat(arrayBBox[2]);
+   var maxY = parseFloat(arrayBBox[3]);
+   return [Math.round((rw_posx - minX)*mpObj.width/(maxX - minX)), Math.round((maxY - rw_posy)*mpObj.height/(maxY - minY))];
+}
+
+function mb_arrangeElement(frameName, elName, left, top) {
+   if(frameName !== ""){
+      window.frames[frameName].document.getElementById(elName).style.top = top;
+      window.frames[frameName].document.getElementById(elName).style.left = left;
+   }
+   else{
+      document.getElementById(elName).style.top = top;
+      document.getElementById(elName).style.left = left;   
+   }
+}
+
+/***********************Drag & Drop***********************/
+function mb_getMousePos(e,fName){
+if(fName){
+     if(ie){
+        clickX = window.frames[fName].event.clientX;
+        clickY = window.frames[fName].event.clientY;
+     }
+     else{
+        clickX = e.pageX;
+        clickY = e.pageY;
+     }
+  }
+  else{
+       if(ie){
+        clickX = event.clientX;
+        clickY = event.clientY;
+     }
+     else{
+        clickX = e.pageX;
+        clickY = e.pageY;
+     }
+  }
+  var pos = [clickX,clickY];
+  return pos;
+}
+// function for object-identification 
+function getMapObjIndexByName(frameName){
+	for(var i=0; i<mb_mapObj.length; i++){
+		if(mb_mapObj[i].frameName == frameName){
+			return i;
+		}
+	}   
+}
+function getMapObjByName(frameName){
+	for(var i=0; i<mb_mapObj.length; i++){
+		if(mb_mapObj[i].frameName == frameName){
+			return mb_mapObj[i];
+		}
+	}
+	return false;
+}
+function mb_getLayerTitleByName(map_index, wms_index, myLayer_name){
+	for(var i=0; i<mb_mapObj[map_index].wms[wms_index].objLayer.length; i++){
+		if(mb_mapObj[map_index].wms[wms_index].objLayer[i].layer_name == myLayer_name){
+			return mb_mapObj[map_index].wms[wms_index].objLayer[i].layer_title;
+		}
+	}
+}
+function getWMSIDByTitle(frameName,wms_title){
+   var ind = getMapObjIndexByName(frameName);
+   for(var i=0; i< mb_mapObj[ind].wms.length; i++){
+      if(mb_mapObj[ind].wms[i].wms_title == wms_title){
+         //return i;
+         return mb_mapObj[ind].wms[i].wms_id;
+      }
+   }
+}
+function getWMSIndexByTitle(frameName,wms_title){
+   var ind = getMapObjIndexByName(frameName);
+   for(var i=0; i< mb_mapObj[ind].wms.length; i++){
+      if(mb_mapObj[ind].wms[i].wms_title == wms_title){
+         return i;
+      }
+   }
+}
+function getWMSIndexById(frameName,wms_id){
+   var ind = getMapObjIndexByName(frameName);
+   for(var i=0; i< mb_mapObj[ind].wms.length; i++){
+      if(mb_mapObj[ind].wms[i].wms_id == wms_id){
+         return i;
+      }
+   }
+}
+//scale
+function mb_getScale(frameName) {
+
+	var myScale = eventBeforeGetScale.trigger({"frameName":frameName});
+/*
+   for(var i=0; i<mb_GetScalePreFunctions.length; i++){
+		var myScale = eval(mb_GetScalePreFunctions[i]);
+	}
+*/
+   if(typeof(myScale) == "number"){
+      var Y_str = myScale;
+   }
+   else{
+      var ind = getMapObjIndexByName(frameName);
+      var arrayBBox = mb_mapObj[ind].extent.split(",");
+      var xtenty =  parseFloat(arrayBBox[3]) - parseFloat(arrayBBox[1]);
+      var scaleY = (xtenty / mb_mapObj[ind].height) *(mb_resolution * 100);
+      if (scaleY<1){
+      	var Y_str = scaleY;
+      }else{
+      	var Y_str = Math.round(scaleY);
+      }
+   }   
+   return Y_str;   
+}
+
+function mb_repaintScale(frameName, x, y, scale){
+   var ind = getMapObjIndexByName(frameName);
+   if(x === null && y === null){
+      var arrayBBox = mb_mapObj[ind].extent.split(",");
+      x = parseFloat(arrayBBox[0]) + ((parseFloat(arrayBBox[2]) - parseFloat(arrayBBox[0]))/2);
+      y = parseFloat(arrayBBox[1]) + ((parseFloat(arrayBBox[3]) - parseFloat(arrayBBox[1]))/2);
+   }
+   var minx = parseFloat(x) - (mb_mapObj[ind].width / (mb_resolution * 100 *2) * scale);
+   var miny = parseFloat(y) -  (mb_mapObj[ind].height / (mb_resolution * 100 *2) * scale);
+   var maxx = parseFloat(x) + (mb_mapObj[ind].width / (mb_resolution * 100 *2) * scale);
+   var maxy = parseFloat(y) +  (mb_mapObj[ind].height / (mb_resolution * 100 *2) * scale);
+   mb_repaint(frameName,minx, miny, maxx, maxy);
+}
+function mb_repaint(frameName,minx,miny,maxx,maxy){
+   var ind = getMapObjIndexByName(frameName);
+   mb_mapObj[ind].extent = minx + "," + miny + "," + maxx + "," + maxy;
+   setMapRequest(frameName);
+}
+/*
+ * converts the extent of the mapobject so that the maximum	extent will be displayed {@link mb_mapObj_const#calculateExtent}
+ * use: mb_mapObj.calculateExtent
+ * @deprecated
+ * 
+ */
+function mb_calculateExtent(frameName,minx,miny,maxx,maxy){
+  var map = getMapObjByName(frameName);
+  var extent = new Extent(minx,miny,maxx,maxy);
+  map.calculateExtent(extent);
+}
+/*
+ * @class extent
+ * @param {float} minx
+ * @param {float} miny
+ * @param {float} maxx
+ * @param {float} maxy
+ * @return the extent as object
+ * @type Object
+ */
+function Extent(minx,miny,maxx,maxy){
+	this.minx = parseFloat(minx);
+	this.miny = parseFloat(miny);
+	this.maxx = parseFloat(maxx);
+	this.maxy = parseFloat(maxy);
+	this.extentx = this.maxx - this.minx;
+	this.extenty = this.maxy - this.miny;
+	this.centerx = this.minx + this.extentx/2;
+	this.centery = this.miny + this.extenty/2;	
+	return this;
+}
+
+function mb_showHighlight(frameName,x,y){
+   var pos = makeRealWorld2mapPos(frameName,x, y);
+   mb_arrangeElement(frameName,"highlight",pos[0]-7, pos[1]-7);
+   window.frames[frameName].document.getElementById("highlight").style.visibility = 'visible';
+}
+function mb_hideHighlight(frameName){
+   mb_arrangeElement(frameName,"highlight",-20, -20);
+   mb_arrangeElement(frameName,"highlight",-20, -20);
+   window.frames[frameName].document.getElementById("highlight").style.visibility = 'hidden';
+}
+function mb_permanentHighlight(frameName,x,y){   
+   var pos = makeRealWorld2mapPos(frameName,x, y);
+   mb_arrangeElement(frameName,"permanent",pos[0]-7, pos[1]-7);
+   window.frames[frameName].document.getElementById("permanent").style.visibility = 'visible';
+}
+// framename, commaseparated coordinates, commaseparated rgb values (color)
+//new: coords is array!
+function mb_markResult(frameName,geom,col){
+	var x = "";
+	var y = "";
+	var tmp = [];
+	var ind = getMapObjIndexByName(frameName);
+	for(var i=0; i < geom.length; i++){
+		if(i > 0){
+			x += ":";
+			y += ":";
+		}
+		tmp = geom[i].split(",");
+		for(var ii=0; ii < tmp.length; ii+=2){			
+			var pos = makeRealWorld2mapPos(frameName,tmp[ii], tmp[ii+1]);
+			if(ii>0){
+				x += ",";
+				y += ",";
+			}
+			x += pos[0];
+			y += pos[1];
+		}      
+	}
+	var source = "<img src='../extensions/markResult.php?x=" + x + "&y=" + y + "&width=" + mb_mapObj[ind].width + "&height=" + mb_mapObj[ind].height + "&color="+col+"'>";
+	//prompt("",source);
+	writeTag(frameName,"markResult",source);   
+}
+function mb_disableResult(frameName){
+   writeTag(frameName,"markResult","");
+}
+
+function mb_registerGML(frameName,obj){
+	var ind = getMapObjIndexByName(frameName);
+	mb_mapObj[ind].geom = obj;
+}
+function mb_timestamp(){
+	var d = new Date();
+	var ts = Math.round(Date.parse(d)/1000);
+	return ts;
+}
+function mb_getlayerposbyname(objInd,wmsInd,lname){
+	var t = mb_mapObj[objInd].wms[wmsInd];
+	for(var i=0; i < t.objLayer.length; i++){
+		if(t.objLayer[i].layer_name == lname){
+			return t.objLayer[i].layer_pos;
+		}
+	}
+}
+function mb_getLayerObjByName(fname,wms_id,layer_name){
+	var ind = getMapObjIndexByName(fname);
+	var wmsInd = getWMSIndexById(fname,wms_id);
+	var t = mb_mapObj[ind].wms[wmsInd];
+	for(var i=0; i < t.objLayer.length; i++){
+		if(t.objLayer[i].layer_name == layer_name){
+			return t.objLayer[i];
+		}
+	}
+}
+function mb_getchildsbyname(objInd,wmsInd,lname){
+	var t = mb_mapObj[objInd].wms[wmsInd];
+	var pos = mb_getlayerposbyname(objInd, wmsInd,lname);
+	var l = [];
+	l.name = [];
+	l.title = [];
+	l.legendurl = [];
+	for(var i=0; i < t.objLayer.length; i++){
+		if(t.objLayer[i].layer_parent == pos){
+			l.name[l.name.length] = t.objLayer[i].layer_name;
+			l.title[l.title.length] = t.objLayer[i].layer_title;
+			if(t.objLayer[i].layer_style.length>0){
+				l.legendurl[l.legendurl.length] = t.objLayer[i].layer_style[0].legendurl;
+			}else{
+				l.legendurl[l.legendurl.length] = 0 ;
+			}
+		}
+	}
+	if(l.name.length > 0){
+		return l;
+	}
+	else{
+		return false;
+	}
+}
+
+/*
+ ***************************************************************************************
+ *   div tag
+ ***************************************************************************************
+ */
+
+/**
+ * @class Represents a div tag. May be located in any frame of Mapbender.
+ * 
+ * @constructor
+ * @param aTagName {String} the name of the tag
+ * @param aFrameName {String} the name of frame where the div tag is being created
+ * @param aStyle {Object} an object containing a set of name value pairs, like
+ *                        {position:absolute,top:30,z-Index:30}
+ */
+function DivTag (aTagName, aFrameName, aStyle) {
+	/**
+	 * @ignore
+	 */
+	this.exists = function () { 
+		return (rootNode.getElementById(tagName)) ? true : false;
+	};
+	
+	/**
+	 * @ignore
+	 */
+	this.getTag = function() {
+		return rootNode.getElementById(tagName);
+	};
+	
+	/**
+	 * @private
+	 */
+	var determineRootNode = function () {
+		node = document;
+		if (frameName !== "") {
+			if (checkFrame()) {node = window.frames[frameName].document;}
+			else {var e = new Mb_exception("frame "+frameName+" doesn't exist.");}
+		}
+		return node;	
+	};
+	
+	/**
+	 * @private
+	 */
+	var toCamelCase = function(aString) {
+		var newString = "";
+		for (var i = 0; i < aString.length; i++) {
+			if (aString.substr(i,1) != "-") {
+				newString += aString.substr(i,1); 
+			}
+			else {
+				i++;
+				newString += aString.substr(i,1).toUpperCase();
+			}
+		}
+		return newString;
+	};
+	
+	/**
+	 * @private
+	 */
+	var setStyle = function () {
+		if (that.exists()) {
+			var node = rootNode.getElementById(tagName);
+			node.setAttribute("style", "");
+			
+			for (var attr in tagStyle) {
+				if (typeof(tagStyle[attr]) != "function" && typeof(tagStyle[attr]) != "object") {
+					var evalString = "node.style."+toCamelCase(attr)+" = \"" + tagStyle[attr] + "\";"; 
+					eval(evalString);				
+				}
+			}
+		}
+	};
+	
+	/**
+	 * @private
+	 */
+	var create = function () {
+		if (!that.exists()) {
+			var divTag = rootNode.createElement("div");
+			var divTagAppended = rootNode.getElementsByTagName("body")[0].appendChild(divTag);
+			divTagAppended.id = tagName;
+		}
+		else {
+			that.clean();
+		}
+		setStyle();
+	};
+
+	/**
+	 * @private
+	 */
+	var checkFrame = function () {
+		if (frameName !== "") {
+			return (typeof(window.frames[frameName]) != 'undefined');
+		}
+		return true;
+	};
+	
+	var that = this;
+	var tagName = aTagName;
+	var frameName = aFrameName;
+	var rootNode = determineRootNode();
+	var tagStyle = aStyle;
+
+	create();
+}
+/**
+ * Writes a text into the div tag, while removing existing content.
+ * 
+ * @param {String} someText the text that is inserted into the tag.
+ */
+DivTag.prototype.write = function (someText) {
+	if (this.exists()) {
+		this.getTag().innerHTML = someText;
+	}
+};
+
+/**
+ * Deletes the div tag content.
+ */
+DivTag.prototype.clean = function () {
+	this.write("");
+};
+
+
+/*
+ ***************************************************************************************
+ *   Javascript exception handling
+ ***************************************************************************************
+ */
+
+/**
+ * @class An abstract class, logs JavaScript events like errors, warnings etc.
+ *
+ * @constructor
+ */
+var Mb_log = function() {
+	var that = this;
+	
+	var levelArray = global_log_levels.split(",");
+	var log_level = global_mb_log_level;
+	var log_js = global_mb_log_js;
+	
+	var indexOfLevel = function(aLevel) {
+		for (var i = 0; i < levelArray.length; i++) {
+			if (aLevel == levelArray[i])  {
+				return i;
+			}
+		}
+		return false;
+	};
+	var isValidLevel = function(aLevel) {
+		var isNotOff = typeof(log_js) != 'undefined' && log_js != "off";
+		var levelIndex = indexOfLevel(aLevel);
+		var isAppropriate = (typeof(levelIndex)=='number' && levelIndex < indexOfLevel(log_level));
+		return (isNotOff && isAppropriate);
+	};
+	this.throwException = function (message, level) {
+		if (isValidLevel(level)) {
+			if (log_js == "on") {
+				try {
+					mb_ajax_post('../php/mb_js_exception.php', {level:level,text:message});
+				}
+				catch(e) {
+					alert(e + ": " + message);
+				}
+			}
+			else if (log_js == "alert") {
+				alert(message);
+			}
+			else if (log_js == "console") {
+				if (level == "warning") {
+					console.warn("%s", message);
+				}
+				else if (level == "error") {
+					console.error("%s", message);
+				}
+				else {
+					console.log("%s", message);
+				}
+			}
+		}
+	};
+};	
+
+/**
+ *  class for exception logging
+ *
+ * @extends {@link Mb_log}
+ * @param message the message that is being logged
+ */	
+function Mb_exception(message) {
+	 var level = "error";
+	this.throwException(message, level);
+}
+Mb_exception.prototype = new Mb_log();
+
+/**
+ *  class for warning logging
+ *
+ * @extends {@link Mb_log}
+ * @param message the message that is being logged
+ */
+function Mb_warning(message) {
+	var level = "warning";
+	this.throwException(message, level);
+}
+Mb_warning.prototype = new Mb_log();
+ 
+/**
+ *  class for notice logging
+ *
+ * @extends {@link Mb_log}
+ * @param message the message that is being logged
+ */	
+ 
+function Mb_notice(message) {
+	var level = "notice";
+	this.throwException(message, level);
+}
+Mb_notice.prototype = new Mb_log();
+
+/*
+ ***************************************************************************************
+ *   AJAX wrapper functions
+ ***************************************************************************************
+ */
+/**
+ * A wrapper for an AJAX request via GET 
+ *
+ * @param {String} url the URL of a (presumably a server side) script.
+ * @param {Object} param An object containing parameters, f.e. {name1:value1, name2:value2}
+ * @param {Function} callback A function that is called when the server side script has been processed. The function is called with two parameters, result and status. Result is the output of the server side script (XML, HTML, whatever), status is a {String}, either "success" or "error". 
+ */
+function mb_ajax_get(url, param, callback) {
+	try {
+//		$.ajaxSetup({async:false}); 
+		$.get(url, param, callback);
+	}
+	catch(e) {
+		var error = new Mb_exception('map.php: mb_ajax_get:'+e);
+	}
+}	
+
+/**
+ * A wrapper for an AJAX request via POST 
+ *
+ * @param {String} url the URL of a (presumably a server side) script.
+ * @param {Object} param An object containing parameters, f.e. {name1:value1, name2:value2}
+ * @param {Function} callback A function that is called when the server side script has been processed. The function is called with two parameters, result and status. Result is the output of the server side script (XML, HTML, whatever), status is a {String}, either "success" or "error". 
+ */
+function mb_ajax_post(url, param, callback) {
+	try {
+//		$.ajaxSetup({async:false}); 
+		$.post(url, param, callback);
+	}
+	catch(e) {
+		var error = new Mb_exception('map.php: mb_ajax_post:'+e);
+	}
+}	
+	
+/**
+ * A wrapper for an AJAX request via GET 
+ *
+ * @param {String} url the URL of a (presumably a server side) script.
+ * @param {Object} param An object containing parameters, f.e. {name1:value1, name2:value2}
+ * @param {Function} callback A function that is called when the server side script has been processed. The function is called with two parameters, result and status. Result is the output of the server side script (a JavaScript Object, not a String!), status is a {String}, either "success" or "error". 
+ */
+function mb_ajax_json(url, param, callback) {
+	try {
+//		window.frames['ajax'].$.ajaxSetup({async:false}); //TODO: find out why async doesn't work sometimes
+		$.getJSON(url, param, callback);
+	}
+	catch(e) {
+		var error = new Mb_exception('map.php: mb_ajax_json:'+e);
+	}
+}	
+
+/*
+ ***************************************************************************************
+ *   button handling
+ ***************************************************************************************
+ */
+ 
+var mb_button = [];
+
+function mb_regButton_frame(wii, frameName, param){
+	var ind = mb_button.length;
+	mb_button[ind] = new mb_conButton(wii, ind);
+	if (frameName === null) {
+		if (param === null) {
+			eval(wii+"("+ind+")");
+		}
+		else {
+			eval(wii+"("+ind+", "+param+")");
+		}
+	}
+	else if (param === null) {
+		eval("window.frames['" + frameName + "']."+wii+"("+ind+")");
+	}
+	else {
+		eval("window.frames['" + frameName + "']."+wii+"("+ind+", "+param+")");
+	}
+	mb_button[ind].prev = mb_button[ind].src;
+	mb_button[ind].src = mb_button[ind].img_off;
+	mb_button[ind].onmouseover = function () {
+		mb_button_over(ind);
+	};
+	mb_button[ind].onmouseout = function(){
+		mb_button_out(ind);
+	};
+	mb_button[ind].onclick = function(){
+		mb_button_click(ind);
+	};
+	if (frameName === null) {
+		mb_button[ind].frameName = "";
+	}
+	else {
+		mb_button[ind].frameName = frameName;
+	}
+}
+
+function mb_regButton(wii){
+	mb_regButton_frame(wii, null, null);
+}
+
+function mb_conButton(wii, ind){
+   this.wii = wii;
+   return true;
+}
+function mb_button_over(ind){
+   if(mb_button[ind].status === 0){
+      mb_button[ind].prev = mb_button[ind].src;
+      mb_button[ind].src = mb_button[ind].img_over;
+   }
+}
+function mb_button_out(ind){
+   if(mb_button[ind].status === 0){
+   		mb_button[ind].src = mb_button[ind].img_off;
+   }
+}
+function mb_button_click(ind){
+   var mbStatus = mb_button[ind].status;
+   if(mbStatus === 0){
+      mb_disableButton(mb_button[ind].elName);
+      mb_button[ind].prev = mb_button[ind].img_on;
+      mb_button[ind].src = mb_button[ind].img_on;
+      mb_button[ind].status = 1;
+      if (mb_button[ind].frameName !== "") {
+          window.frames[mb_button[ind].frameName].document.getElementById(mb_button[ind].elName).go();
+      }
+      else {
+	      document.getElementById(mb_button[ind].elName).go();
+      }
+   }
+   else{
+      mb_button[ind].prev = mb_button[ind].img_off;
+      mb_button[ind].src = mb_button[ind].img_off;
+      mb_button[ind].status = 0;      
+      if (mb_button[ind].frameName !== "") {
+          window.frames[mb_button[ind].frameName].document.getElementById(mb_button[ind].elName).stop();
+      }
+      else {
+	      document.getElementById(mb_button[ind].elName).stop();
+      }
+   }
+}
+function mb_disableButton(elName){
+   for(var i=0; i<mb_button.length; i++){
+      if(mb_button[i].elName != elName && mb_button[i].status == 1){
+            mb_button[i].status = 0;
+		      if (mb_button[i].frameName !== "") {
+    	        window.frames[mb_button[i].frameName].document.getElementById(mb_button[i].elName).src = mb_button[i].img_off;
+	            window.frames[mb_button[i].frameName].document.getElementById(mb_button[i].elName).stop();
+		      }
+		      else {
+    	        document.getElementById(mb_button[i].elName).src = mb_button[i].img_off;
+	            document.getElementById(mb_button[i].elName).stop();
+		      }
+            return true;
+       
+      }
+   }
+}
+function mb_disableThisButton(elName){
+   for(var i=0; i<mb_button.length; i++){
+      if(mb_button[i].elName == elName && mb_button[i].status == 1){
+      		//alert(mb_button[i].elName);
+            mb_button[i].status = 0;
+		      if (mb_button[i].frameName !== "") {
+    	        window.frames[mb_button[i].frameName].document.getElementById(mb_button[i].elName).src = mb_button[i].img_off;
+	            window.frames[mb_button[i].frameName].document.getElementById(mb_button[i].elName).stop();
+		      }
+		      else {
+        	    document.getElementById(mb_button[i].elName).src = mb_button[i].img_off;
+		        document.getElementById(mb_button[i].elName).stop();
+		      }
+            return true;
+       
+      }
+   }
+}
+function updateButtonTooltips(obj) {
+/*	
+ * the buttons are only initialized on mouseover! 
+ * So when localizing, not all buttons may have been registered 
+ *
+	for(var i=0; i<mb_button.length; i++){
+//		console.log("button %i", i);
+		for(var j=0; j<obj.length; j++){
+			if (mb_button[i].elName == obj[j].id) {
+//			console.log("%s %s", mb_button[i].elName, obj[j].id);
+				if (mb_button[i].frameName !== "") {
+					window.frames[mb_button[i].frameName].document.getElementById(mb_button[i].elName).title = obj[j].title;
+				}
+				else {
+					document.getElementById(mb_button[i].elName).title = obj[j].title;
+				}
+			}
+		}
+	}
+*/
+
+	// an alternative, fixes above error,
+	// but this one only changes those in the main frame
+	var imageArray = document.getElementsByTagName("img");
+	for (var i = 0; i < imageArray.length; i++) {
+		for(var j=0; j<obj.length; j++){
+			if (imageArray[i].id == obj[j].id) {
+				document.getElementById(imageArray[i].id).title = obj[j].title;
+			}
+		}
+	}
+}
+
+function mb_localizeButtons(){
+	mb_ajax_json("../php/mod_button_tooltips.php", function(obj, status){
+		updateButtonTooltips(obj);
+	});
+}
+
+eventLocalize.register(function () {
+	mb_localizeButtons();
+});
+
+eventInit.register(function () {
+	mb_localizeButtons();
+});
+
+
+/*
+ ***************************************************************************************
+ *   miscellaneous functions
+ ***************************************************************************************
+ */
+
+function cloneObject(obj) { 
+    if (typeof obj !== 'object' || obj === null) {
+        return obj;
+    }
+    var c = obj instanceof Array ? [] : {};
+    for (var i in obj) {
+        var prop = obj[i];
+        if (typeof prop == 'object') {
+           if (prop instanceof Array) {
+               c[i] = [];
+               for (var j = 0; j < prop.length; j++) {
+                   if (typeof prop[j] != 'object') {
+                       c[i].push(prop[j]);
+                   } else {
+                       c[i].push(cloneObject(prop[j]));
+                   }
+               }
+           } else {
+               c[i] = cloneObject(prop);
+           }
+        } else {
+           c[i] = prop;
+        }
+    }
+    return c;
+}
+
+
+/**
+ * @class A List object is an array of arbitrary objects with additional methods. 
+ *
+ * @constructor
+ */
+var List = function() {
+	
+	/**
+	 * gets the number of elements in this {@link List}
+	 *
+	 * @returns number of elements in this {@link List}
+	 * @type Integer
+	 */
+	this.count = function() {
+		return this.list.length;
+	};
+
+	/**
+	 * deletes the object at index i; -1 refers to the last object in this {@link List}
+	 *
+	 * @param {Integer} i index
+	 */
+	this.del = function(i){
+		i = this.getIndex(i);
+		if (i !== false) {
+			for(var z = i; z < this.count() - 1; z++){
+				this.list[z] = this.list[z+1];
+			}
+			this.list.length -= 1;
+			return true;
+		}
+		return false;
+	};
+
+	/**
+	 * empties this {@link List}
+	 */
+	this.empty = function() {
+		while (this.list !== null && this.count() > 0) {
+			this.list.pop();
+		}
+	};
+	
+	/**
+	 * @param {Integer} i index
+	 * @returns the object at index i; -1 refers to the last object in this {@link List}
+	 * @type Integer or false
+	 */
+	this.get = function(i) {
+		i = this.getIndex(i);
+		if (i !== false) {return this.list[i];}
+		return false;		
+	};
+	/**
+	 * adds a reference to item to this {@link List}.
+	 *
+	 * @param {Object} item an object
+	 */
+	this.add = function(item) {
+		var i = this.list.length;
+		this.list[i] = item;
+	};
+	/**
+	 * adds a copy of item to this {@link List}.
+	 *
+	 * @param {Object} item an object
+	 */
+	this.addCopy = function(item) {
+		this.add(cloneObject(item));
+	};
+	/**
+	 * attaches the {@link List} aList to this {@link List}
+	 *
+	 * @param {List} aList another list
+	 */
+	this.union = function(aList) {
+		for (var i=0; i < aList.count(); i++) {this.addCopy(aList.get(i));}
+	};
+	/**
+	 * checks if the index is valid and returns it if it is; if i == -1, the correct index is retrieved.
+	 *
+	 * @private
+	 * @return Integer or false
+	 * @type Integer
+	 */
+	this.getIndex = function(i){ 
+		var len = this.list.length;
+		if (i<0 && len + i > -1) {
+			return len + i;			
+		}
+		else if (i > -1 && i < len){
+			return i;
+		}
+		var e = new Mb_exception("class List: function getIndex: member index " + i + " is not valid");
+		return false;
+	};
+	/**
+	 * @returns a {String} representation of this List
+	 * @type String
+	 */
+	this.toString = function(){
+		var str = "";
+		for (var i =0 ; i < this.count() ; i++){
+			str += this.get(i).toString();
+		}
+		return str;	
+	};	
+	
+	this.list = null;
+};
+
+
+/*
+ ***************************************************************************************
+ *   deprecated functions
+ ***************************************************************************************
+ */
+
+// only used in mod_perimeter.php
+// previously used in mod_initWmc.php, mod_digitize_tab.php, mod_geometryArray.js
+function mb_checkTag(frameName, tagName, elementId, appendAtTagName, attributes){
+	var oldElement;
+	var newElement;
+	var prefix;
+	if(frameName && frameName !== ""){
+		prefix = window.frames[frameName].document;
+	}
+	else if(!frameName || frameName === ""){
+		prefix = document;
+	}
+	oldElement = prefix.getElementById(elementId);
+	if (oldElement === null) {
+		newElement = prefix.createElement(tagName);
+		newElement = prefix.getElementsByTagName(appendAtTagName)[0].appendChild(newElement);
+	}
+	else {
+		if (oldElement.nodeName.toLowerCase() == tagName.toLowerCase()) {
+			for (var i=0; i<attributes.length; i++) {
+				oldElement.setAttribute(attributes[i][0], attributes[i][1]);
+			}
+			return oldElement;
+		}
+		else {
+			return false;
+		}
+	}
+	var newElementAttributeNode = document.createAttribute("id");
+	newElementAttributeNode.value = elementId;
+	newElement.setAttributeNode(newElementAttributeNode);
+	for (var i=0; i<attributes.length; i++) {
+		newElement.setAttribute(attributes[i][0], attributes[i][1]);
+	}
+	return newElement;
+}

Modified: branches/2.5/http/javascripts/map.php
===================================================================
--- branches/2.5/http/javascripts/map.php	2008-08-11 08:19:21 UTC (rev 2763)
+++ branches/2.5/http/javascripts/map.php	2008-08-11 08:21:14 UTC (rev 2764)
@@ -46,7 +46,6 @@
 */
 $_SESSION["mb_user_gui"] = $gui_id;
 
-session_write_close();
 ob_start();
 header('Content-type: application/x-javascript');
 
@@ -141,7 +140,4 @@
 		}
 	}
 }
-
-
-
-?>
\ No newline at end of file
+?>

Modified: branches/2.5/http/javascripts/mod_adminNavigation.js
===================================================================
--- branches/2.5/http/javascripts/mod_adminNavigation.js	2008-08-11 08:19:21 UTC (rev 2763)
+++ branches/2.5/http/javascripts/mod_adminNavigation.js	2008-08-11 08:21:14 UTC (rev 2764)
@@ -1,4 +1,5 @@
 function mod_adminNavigation_init(){
+	eventInit.trigger();
 	for (var i=0; i< document.getElementsByTagName("a").length; i++){
 		document.getElementsByTagName("a")[i].onclick = new Function("mod_adminNavigation(this)");
 	}
@@ -8,4 +9,4 @@
 		document.getElementsByTagName("a")[i].style.color = "#808080";
 	}
 	obj.style.color = "#0000ff";
-}
\ No newline at end of file
+}

Modified: branches/2.5/http/javascripts/mod_usemap.php
===================================================================
--- branches/2.5/http/javascripts/mod_usemap.php	2008-08-11 08:19:21 UTC (rev 2763)
+++ branches/2.5/http/javascripts/mod_usemap.php	2008-08-11 08:21:14 UTC (rev 2764)
@@ -34,6 +34,8 @@
 	url += "&extent=" + extent;
 	url += "&width=" + mb_mapObj[ind].width;
 	url += "&height=" + mb_mapObj[ind].height;
+	url += "&gui_id=<?php echo $gui_id;?>";
+	url += "&e_id=<?php echo $e_id;?>";
 	document.getElementById('usemap').src = url;
 	var myImg = window.frames[mod_usemap_target].document.getElementById("um_img").style; 
 	myImg.width = mb_mapObj[ind].width;

Modified: branches/2.5/http/php/mod_wfs_server.php
===================================================================
--- branches/2.5/http/php/mod_wfs_server.php	2008-08-11 08:19:21 UTC (rev 2763)
+++ branches/2.5/http/php/mod_wfs_server.php	2008-08-11 08:21:14 UTC (rev 2764)
@@ -186,7 +186,6 @@
 		return false;
 	}
 	$sql = "SELECT * FROM gui_wfs_conf WHERE fkey_gui_id = $1 AND fkey_wfs_conf_id IN (".join(",",$confs['id']).")";
-         	$e = new mb_exception("Error: aaaa " . $sql);
 	$v = array($obj->selectedGui);
 	$t = array('s');
 	$res = db_prep_query($sql,$v,$t);
@@ -316,4 +315,4 @@
 	header("Content-Type: text/x-json");
 	echo $output;
 }
-?>
\ No newline at end of file
+?>

Modified: branches/2.5/http/print/mod_printPDF_pdf.php
===================================================================
--- branches/2.5/http/print/mod_printPDF_pdf.php	2008-08-11 08:19:21 UTC (rev 2763)
+++ branches/2.5/http/print/mod_printPDF_pdf.php	2008-08-11 08:21:14 UTC (rev 2764)
@@ -17,11 +17,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-#require_once(dirname(__FILE__) . "/../php/mb_validateSession.php");
-ob_start();
-session_start();
-ini_set('error_reporting', 'E_ALL & ~ E_NOTICE');
-require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
 
 include (dirname(__FILE__)."/../classes/class.ezpdf.php");
 include (dirname(__FILE__)."/../classes/class_stripRequest.php");
@@ -30,7 +26,6 @@
 include (dirname(__FILE__)."/../print/".$_REQUEST["conf"]);
 include (dirname(__FILE__)."/../classes/class_SaveLegend.php");
 include (dirname(__FILE__)."/../print/print_functions.php");
-require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
 
 if($log == true){
 	include (dirname(__FILE__)."/../classes/class_log.php");

Modified: branches/2.5/http/print/printPDF.conf
===================================================================
--- branches/2.5/http/print/printPDF.conf	2008-08-11 08:19:21 UTC (rev 2763)
+++ branches/2.5/http/print/printPDF.conf	2008-08-11 08:21:14 UTC (rev 2764)
@@ -1,388 +1,388 @@
-<?php
-
-include_once(dirname(__FILE__)."/../../core/globalSettings.php");
-# filename for temporary imagefiles
-$filename = TMPDIR."/map_".substr(md5(uniqid(rand())),0,7).".png";
-
-/*
-* DOWNLOAD
-*/
-$download = true;
-$downloadFile = TMPDIR."/map_".substr(md5(uniqid(rand())),0,7).".pdf";
-$downloadText = _mb("Download: Map as PDF...");
-
-/*
-*run print as iframe or window
-*/
-$type = 'iframe';
-
-
-
-/*
-* Legend
-*/
-$legend=true;
-$label_legend = _mb('print legend');
-$legendFilename = TMPDIR."/legend_".substr(md5(uniqid(rand())),0,7).".png";
-$legendFilenameUserPolygon = TMPDIR."/legend_".substr(md5(uniqid(rand())),0,7).".png";
-$legendText = _mb("Legend");
-$legendFooter = _mb("powered by Mapbender");
-$legendImage = "./img/mapbender_logo.png";
-$legendImage_width = 90;
-$legendImage_height = 13;
-
-
-# log requests, class 'class_log.php' required
-$log = false;
-
-# delete images:
-$unlink = true;
-
-# labeling
-if(CHARSET=="UTF-8"){ 
-	$new_comment1 = utf8_decode($_REQUEST["comment1"]);
-	$new_comment2 = utf8_decode($_REQUEST["comment2"]);
-}
-else{
-	$new_comment1 = $_REQUEST["comment1"];
-	$new_comment2 = $_REQUEST["comment2"];
-}
-
-$text1 = _mb("Print preview");
-$text2 = "- Mapbender -";
-$text3 = "";
-$text4 = _mb("Scale 1:"). " ".$_REQUEST["map_scale"];
-$text5 = _mb("Date:") . " ".date("d.m.Y",strtotime("now"));
-
-$text6 = _mb("Notes:");
-$text7 = "";
-$text8 = $new_comment1;
-$text9 = $new_comment2;
-$text10 = "";
-
-
-$text11 = _mb("This copy has been automatically generated and is thus not valid without signature.");
-$text12 = _mb("This copy is protected by law (Par. 3 Abs. 1 VermKatG NW). It can be duplicaedted, modified, published or be passed to third parties only in agreement with");
-$text13 = _mb("the publisher, except duplicates and modifications aimed at internal use of government agencies or private use.");
-
-$text14 = _mb("This copy is protected,");
-$text15 = _mb("ask me!!!!");
-$text16 = _mb("or the publisher");
-$text17 = _mb("or use is internally.");
-
-/*
-* Labeling for buttons, textfields ...
-*/
-
-$label_format = _mb("Format:");
-$label_format_a4 = "A4";
-$label_format_a3 = "A3";
-$label_format_a2 = "A2";
-$label_format_a1 = "A1";
-$label_format_a0 = "A0";
-
-$label_orientation = _mb("Orientation:");
-$label_portrait = _mb("portrait");
-$label_landscape = _mb("landscape");
+<?php
 
-$label_quality = "Quality:";
-$label_72dpi = "72 dpi";
-$label_288dpi = "288 dpi";
-
+include_once(dirname(__FILE__)."/../../core/globalSettings.php");
+# filename for temporary imagefiles
+$filename = TMPDIR."/map_".substr(md5(uniqid(rand())),0,7).".png";
+
+/*
+* DOWNLOAD
+*/
+$download = true;
+$downloadFile = TMPDIR."/map_".substr(md5(uniqid(rand())),0,7).".pdf";
+$downloadText = _mb("Download: Map as PDF...");
+
+/*
+*run print as iframe or window
+*/
+$type = 'iframe';
+
+
+
+/*
+* Legend
+*/
+$legend=true;
+$label_legend = _mb('print legend');
+$legendFilename = TMPDIR."/legend_".substr(md5(uniqid(rand())),0,7).".png";
+$legendFilenameUserPolygon = TMPDIR."/legend_".substr(md5(uniqid(rand())),0,7).".png";
+$legendText = _mb("Legend");
+$legendFooter = _mb("powered by Mapbender");
+$legendImage = "./img/mapbender_logo.png";
+$legendImage_width = 90;
+$legendImage_height = 13;
+
+
+# log requests, class 'class_log.php' required
+$log = false;
+
+# delete images:
+$unlink = true;
+
+# labeling
+if(CHARSET=="UTF-8"){ 
+	$new_comment1 = utf8_decode($_REQUEST["comment1"]);
+	$new_comment2 = utf8_decode($_REQUEST["comment2"]);
+}
+else{
+	$new_comment1 = $_REQUEST["comment1"];
+	$new_comment2 = $_REQUEST["comment2"];
+}
+
+$text1 = _mb("Print preview");
+$text2 = "- Mapbender -";
+$text3 = "";
+$text4 = _mb("Scale 1:"). " ".$_REQUEST["map_scale"];
+$text5 = _mb("Date:") . " ".date("d.m.Y",strtotime("now"));
+
+$text6 = _mb("Notes:");
+$text7 = "";
+$text8 = $new_comment1;
+$text9 = $new_comment2;
+$text10 = "";
+
+
+$text11 = _mb("This copy has been automatically generated and is thus not valid without signature.");
+$text12 = _mb("This copy is protected by law (Par. 3 Abs. 1 VermKatG NW). It can be duplicaedted, modified, published or be passed to third parties only in agreement with");
+$text13 = _mb("the publisher, except duplicates and modifications aimed at internal use of government agencies or private use.");
+
+$text14 = _mb("This copy is protected,");
+$text15 = _mb("ask me!!!!");
+$text16 = _mb("or the publisher");
+$text17 = _mb("or use is internally.");
+
+/*
+* Labeling for buttons, textfields ...
+*/
+
+$label_format = _mb("Format");
+$label_format_a4 = "A4";
+$label_format_a3 = "A3";
+$label_format_a2 = "A2";
+$label_format_a1 = "A1";
+$label_format_a0 = "A0";
+
+$label_orientation = _mb("Orientation");
+$label_portrait = _mb("portrait");
+$label_landscape = _mb("landscape");
+
+$label_quality = _mb("Quality");
+$label_72dpi = "72 dpi";
+$label_288dpi = "288 dpi";
+
 $label_comment1 = _mb("Comment 1:");
-$label_comment2 = _mb("Comment 1:");
+$label_comment2 = _mb("Comment 2:");
 $comment1_length = 30;
 $comment2_length = 30;
-
-$label_button = _mb('Print');
-
-/*
-* default
-* url string matching and replacement
-*/
-$matching = false;
-$pattern =  "/192\.168\.2\.113/";
-$replacement = "192.168.2.5";
-
-/*
-* high quality printing 288dpi
-* highquality mapfiles will be supplemented with "_4"
-* example: germany.map -> germany_4.map
-*/
-
-
-$highquality = true;
-$highqualitymapfiles = array(
-	"/data/umn/germany/germany_demo.map",
-	"/data/umn/mapbender_user/mapbender_user.map"
-);
-
-# Dots per cm (72 dpi):
-# 28.346456692913385826771653543307 
-$DPC = 28.35;
-
-# available formats:
-$a4 = true;
-$a3 = true;
-$a2 = true;
-$a1 = false;
-$a0 = false;
-
-# dimensions of the map:
-
-# A4 portrait
-$a4p_mapOffset_left = 3.3 * $DPC;
-$a4p_mapOffset_bottom = 3 * $DPC;
-$a4p_map_width = 15.7 * $DPC; 
-$a4p_map_height = 22 * $DPC; 
-$a4p_page_width = 21 * $DPC;
-$a4p_page_height = 29.7 * $DPC;
-$a4p_header_height = 2.6 * $DPC;
-$a4p_footer_height = 1.12 * $DPC;
-        
-# A4 landscape
-$a4l_mapOffset_left = 2.3 * $DPC;
-$a4l_mapOffset_bottom = 1.8 * $DPC;
-$a4l_map_width = 25.2 * $DPC;
-$a4l_map_height = 16.4 * $DPC; 
-$a4l_page_width = 29.7 * $DPC;
-$a4l_page_height = 21 * $DPC;   
-$a4l_header_width = 8.5 * $DPC;
-$a4l_header_height = 6 * $DPC;
-        
-# A3 protrait
-$a3p_mapOffset_left = 3.3 * $DPC;
-$a3p_mapOffset_bottom = 3 * $DPC;
-$a3p_map_width = 24.1 * $DPC;
-$a3p_map_height = 36.7 * $DPC;
-$a3p_page_width = 29.7 * $DPC;
-$a3p_page_height = 42 * $DPC;
-$a3p_header_width =  8.5 * $DPC;
-$a3p_header_height = 6 * $DPC;
-
-# A3 landscape        
-$a3l_mapOffset_left = 2.3 * $DPC;
-$a3l_mapOffset_bottom = 1.8 * $DPC;
-$a3l_map_width = 37.4 * $DPC;
-$a3l_map_height = 25.4 * $DPC; 
-$a3l_page_width = 42 * $DPC;
-$a3l_page_height = 29.7 * $DPC;
-$a3l_header_width =  8.5 * $DPC;
-$a3l_header_height = 6 * $DPC;
-
-# a2 protrait
-$a2p_mapOffset_left = 3.2 * $DPC;
-$a2p_mapOffset_bottom = 2.3 * $DPC;
-$a2p_map_width = 37.3 * $DPC;
-$a2p_map_height = 54.8 * $DPC;
-$a2p_page_width = 42 * $DPC;
-$a2p_page_height = 59.4 * $DPC;
-$a2p_header_width =  8.5 * $DPC;
-$a2p_header_height = 6 * $DPC;
-
-# a2 landscape        
-$a2l_mapOffset_left = 3.2 * $DPC;
-$a2l_mapOffset_bottom = 2.3 * $DPC;
-$a2l_map_width = 54.1 * $DPC;
-$a2l_map_height = 37.3 * $DPC; 
-$a2l_page_width = 59.4 * $DPC;
-$a2l_page_height = 42 * $DPC;
-$a2l_header_width =  8.5 * $DPC;
-$a2l_header_height = 6 * $DPC;
-
-# a1 portrait
-$a1p_mapOffset_left = 3.2 * $DPC;
-$a1p_mapOffset_bottom = 2.3 * $DPC;
-$a1p_map_width = 54.5 * $DPC;
-$a1p_map_height = 79.5 * $DPC;
-$a1p_page_width = 59.4 * $DPC;
-$a1p_page_height = 84 * $DPC;
-$a1p_header_width =  8.5 * $DPC;
-$a1p_header_height = 6 * $DPC;
-
-# a1 landscape        
-$a1l_mapOffset_left = 3.2 * $DPC;
-$a1l_mapOffset_bottom = 2.3 * $DPC;
-$a1l_map_width = 79.5 * $DPC;
-$a1l_map_height = 55.5 * $DPC; 
-$a1l_page_width = 84 * $DPC;
-$a1l_page_height = 59.4 * $DPC;
-$a1l_header_width =  8.5 * $DPC;
-$a1l_header_height = 6 * $DPC;
-
-# a0 portrait
-$a0p_mapOffset_left = 3.2 * $DPC;
-$a0p_mapOffset_bottom = 2.3 * $DPC;
-$a0p_map_width = 79 * $DPC;
-$a0p_map_height = 115 * $DPC;
-$a0p_page_width = 84 * $DPC;
-$a0p_page_height = 118.8 * $DPC;
-$a0p_header_width =  8.5 * $DPC;
-$a0p_header_height = 6 * $DPC;
-
-# a0 landscape        
-$a0l_mapOffset_left = 3.2 * $DPC;
-$a0l_mapOffset_bottom = 2.3 * $DPC;
-$a0l_map_width = 113 * $DPC;
-$a0l_map_height = 80.5 * $DPC; 
-$a0l_page_width = 118.8 * $DPC;
-$a0l_page_height = 84 * $DPC;
-$a0l_header_width =  8.5 * $DPC;
-$a0l_header_height = 6 * $DPC;
-
-/*
-* Overview
-*/
-$overview = true;
-$a4p_overviewOffset_left = $a4p_mapOffset_left;
-$a4p_overviewOffset_bottom = $a4p_mapOffset_bottom;
-
-$a4l_overviewOffset_left = $a4l_mapOffset_left;
-$a4l_overviewOffset_bottom = $a4l_mapOffset_bottom;
-
-$a3p_overviewOffset_left = $a3p_mapOffset_left;
-$a3p_overviewOffset_bottom = $a3p_mapOffset_bottom;
-
-$a3l_overviewOffset_left = $a3l_mapOffset_left;
-$a3l_overviewOffset_bottom = $a3l_mapOffset_bottom;
-
-$a2p_overviewOffset_left = $a2p_mapOffset_left;
-$a2p_overviewOffset_bottom = $a2p_mapOffset_bottom;
-
-$a2l_overviewOffset_left = $a2l_mapOffset_left;
-$a2l_overviewOffset_bottom = $a2l_mapOffset_bottom;
-
-$a1p_overviewOffset_left = $a1p_mapOffset_left;
-$a1p_overviewOffset_bottom = $a1p_mapOffset_bottom;
-
-$a1l_overviewOffset_left = $a1l_mapOffset_left;
-$a1l_overviewOffset_bottom = $a1l_mapOffset_bottom;
-
-$a0p_overviewOffset_left = $a0p_mapOffset_left;
-$a0p_overviewOffset_bottom = $a0p_mapOffset_bottom;
-
-$a0l_overviewOffset_left = $a0l_mapOffset_left;
-$a0l_overviewOffset_bottom = $a0l_mapOffset_bottom;
-
-
-
-/*
-* Northarrow
-*/
-$northarrow = true;
-$northarrowImage = "./img/northarrow.png";
-
-$a4p_northarrow_left = $a4p_mapOffset_left + 160;
-$a4p_northarrow_bottom = $a4p_mapOffset_bottom +2 ;
-
-$a4l_northarrow_left = $a4l_mapOffset_left + 5;
-$a4l_northarrow_bottom = $a4l_mapOffset_bottom + $a4l_map_height - 40;
-
-$a3p_northarrow_left = $a3p_mapOffset_left +5;
-$a3p_northarrow_bottom = $a3p_mapOffset_bottom + $a3p_map_height - 80;
-
-$a3l_northarrow_left = $a3l_mapOffset_left + 5;
-$a3l_northarrow_bottom = $a3l_mapOffset_bottom + $a3l_map_height - 40;
-
-$a2p_northarrow_left = $a2p_mapOffset_left +5;
-$a2p_northarrow_bottom = $a2p_mapOffset_bottom + $a2p_map_height - 80;
-
-$a2l_northarrow_left = $a2l_mapOffset_left + 5;
-$a2l_northarrow_bottom = $a2l_mapOffset_bottom + $a2l_map_height - 80;
-
-$a1p_northarrow_left = $a1p_mapOffset_left +5;
-$a1p_northarrow_bottom = $a1p_mapOffset_bottom + $a1p_map_height - 80;
-
-$a1l_northarrow_left = $a1l_mapOffset_left + 5;
-$a1l_northarrow_bottom = $a1l_mapOffset_bottom + $a1l_map_height - 160;
-
-$a0p_northarrow_left = $a0p_mapOffset_left +5;
-$a0p_northarrow_bottom = $a0p_mapOffset_bottom + $a0p_map_height - 80;
-
-$a0l_northarrow_left = $a0l_mapOffset_left + 5;
-$a0l_northarrow_bottom = $a0l_mapOffset_bottom + $a0l_map_height - 160;
-
-$northarrowImage_width = 15; 
-$northarrowImage_height = 35; 
-
-/*
-* special image for the map-page
-*/
-$special = true;
-$specialImage = "../img/mapbender_oo.png";
-
-$a4p_special_left = $a4p_mapOffset_left + $a4p_map_width - 50 ;
-$a4p_special_bottom = $a4p_mapOffset_bottom + $a4p_map_height + 80; 
-
-$a4l_special_left = $a4l_mapOffset_left + $a4l_map_width - $a4l_header_width + 0.8 * $DPC + 10 ;
-$a4l_special_bottom = $a4l_mapOffset_bottom + 54; 
-
-$a3p_special_left = $a3p_mapOffset_left + $a3p_map_width - $a3p_header_width ;
-$a3p_special_bottom = $a3p_mapOffset_bottom + 30; 
-
-$a3l_special_left = $a3l_mapOffset_left + $a3l_map_width - $a3l_header_width + 0.8 * $DPC + 10;
-$a3l_special_bottom = $a3l_mapOffset_bottom + 60; 
-
-$a2p_special_left = $a2p_mapOffset_left + $a2p_map_width - $a2p_header_width + 0.1 *$DPC ;
-$a2p_special_bottom = $a2p_mapOffset_bottom + 110; 
-
-$a2l_special_left = $a2l_mapOffset_left + $a2l_map_width - $a2l_header_width + 0.2 * $DPC ;
-$a2l_special_bottom = $a2l_mapOffset_bottom + 110; 
-
-$a1p_special_left = $a1p_mapOffset_left + $a1p_map_width - $a1p_header_width + 0.1 *$DPC ;
-$a1p_special_bottom = $a1p_mapOffset_bottom + 110; 
-
-$a1l_special_left = $a1l_mapOffset_left + $a1l_map_width - $a1l_header_width + 0.2 * $DPC ;
-$a1l_special_bottom = $a1l_mapOffset_bottom + 110; 
-
-$a0p_special_left = $a0p_mapOffset_left + $a0p_map_width - $a0p_header_width + 0.1 *$DPC ;
-$a0p_special_bottom = $a0p_mapOffset_bottom + 110; 
-
-$a0l_special_left = $a0l_mapOffset_left + $a0l_map_width - $a0l_header_width + 0.2 * $DPC ;
-$a0l_special_bottom = $a0l_mapOffset_bottom + 110; 
-
-$specialImage_width = 65; 
-$specialImage_height = 15;  
-
-
-/*
-* dynamic scalebar
-*/
-$scalebar = true;
-$units = "Meter";
-
-$a4p_scalebar_left = $a4p_mapOffset_left + 2 * $a4p_map_width/3;
-$a4p_scalebar_bottom = $a4p_mapOffset_bottom  + 0.5 * $DPC;
-
-$a4l_scalebar_left = $a4l_mapOffset_left + $a4l_map_width/4 ;
-$a4l_scalebar_bottom = $a4l_mapOffset_bottom +  + 0.5 * $DPC;
-
-$a3p_scalebar_left = $a3p_mapOffset_left  + $a3p_map_width/4 ;
-$a3p_scalebar_bottom = $a3p_mapOffset_bottom + 0.5 * $DPC;
-
-$a3l_scalebar_left = $a3l_mapOffset_left  + $a3l_map_width/4 ;
-$a3l_scalebar_bottom = $a3l_mapOffset_bottom +  + 0.5 * $DPC;
-
-$a2p_scalebar_left = $a2p_mapOffset_left  + $a2p_map_width/4 ;
-$a2p_scalebar_bottom = $a2p_mapOffset_bottom + 0.5 * $DPC;
-
-$a2l_scalebar_left = $a2l_mapOffset_left  + $a2l_map_width/4 ;
-$a2l_scalebar_bottom = $a2l_mapOffset_bottom +  + 0.5 * $DPC;
-
-$a1p_scalebar_left = $a1p_mapOffset_left  + $a1p_map_width/4 ;
-$a1p_scalebar_bottom = $a1p_mapOffset_bottom + 0.5 * $DPC;
-
-$a1l_scalebar_left = $a1l_mapOffset_left  + $a1l_map_width/4 ;
-$a1l_scalebar_bottom = $a1l_mapOffset_bottom +  + 0.5 * $DPC;
-
-$a0p_scalebar_left = $a0p_mapOffset_left  + $a0p_map_width/4 ;
-$a0p_scalebar_bottom = $a0p_mapOffset_bottom + 0.5 * $DPC;
-
-$a0l_scalebar_left = $a0l_mapOffset_left  + $a0l_map_width/4 ;
-$a0l_scalebar_bottom = $a0l_mapOffset_bottom +  + 0.5 * $DPC;
-
-$scalebar_width = 3 * $DPC;
-$scalebar_height = 0.18 * $DPC;
- 
-
-?>
+
+$label_button = _mb("print");
+
+/*
+* default
+* url string matching and replacement
+*/
+$matching = false;
+$pattern =  "/192\.168\.2\.113/";
+$replacement = "192.168.2.5";
+
+/*
+* high quality printing 288dpi
+* highquality mapfiles will be supplemented with "_4"
+* example: germany.map -> germany_4.map
+*/
+
+
+$highquality = true;
+$highqualitymapfiles = array(
+	"/data/umn/germany/germany_demo.map",
+	"/data/umn/mapbender_user/mapbender_user.map"
+);
+
+# Dots per cm (72 dpi):
+# 28.346456692913385826771653543307 
+$DPC = 28.35;
+
+# available formats:
+$a4 = true;
+$a3 = true;
+$a2 = true;
+$a1 = false;
+$a0 = false;
+
+# dimensions of the map:
+
+# A4 portrait
+$a4p_mapOffset_left = 3.3 * $DPC;
+$a4p_mapOffset_bottom = 3 * $DPC;
+$a4p_map_width = 15.7 * $DPC; 
+$a4p_map_height = 22 * $DPC; 
+$a4p_page_width = 21 * $DPC;
+$a4p_page_height = 29.7 * $DPC;
+$a4p_header_height = 2.6 * $DPC;
+$a4p_footer_height = 1.12 * $DPC;
+        
+# A4 landscape
+$a4l_mapOffset_left = 2.3 * $DPC;
+$a4l_mapOffset_bottom = 1.8 * $DPC;
+$a4l_map_width = 25.2 * $DPC;
+$a4l_map_height = 16.4 * $DPC; 
+$a4l_page_width = 29.7 * $DPC;
+$a4l_page_height = 21 * $DPC;   
+$a4l_header_width = 8.5 * $DPC;
+$a4l_header_height = 6 * $DPC;
+        
+# A3 protrait
+$a3p_mapOffset_left = 3.3 * $DPC;
+$a3p_mapOffset_bottom = 3 * $DPC;
+$a3p_map_width = 24.1 * $DPC;
+$a3p_map_height = 36.7 * $DPC;
+$a3p_page_width = 29.7 * $DPC;
+$a3p_page_height = 42 * $DPC;
+$a3p_header_width =  8.5 * $DPC;
+$a3p_header_height = 6 * $DPC;
+
+# A3 landscape        
+$a3l_mapOffset_left = 2.3 * $DPC;
+$a3l_mapOffset_bottom = 1.8 * $DPC;
+$a3l_map_width = 37.4 * $DPC;
+$a3l_map_height = 25.4 * $DPC; 
+$a3l_page_width = 42 * $DPC;
+$a3l_page_height = 29.7 * $DPC;
+$a3l_header_width =  8.5 * $DPC;
+$a3l_header_height = 6 * $DPC;
+
+# a2 protrait
+$a2p_mapOffset_left = 3.2 * $DPC;
+$a2p_mapOffset_bottom = 2.3 * $DPC;
+$a2p_map_width = 37.3 * $DPC;
+$a2p_map_height = 54.8 * $DPC;
+$a2p_page_width = 42 * $DPC;
+$a2p_page_height = 59.4 * $DPC;
+$a2p_header_width =  8.5 * $DPC;
+$a2p_header_height = 6 * $DPC;
+
+# a2 landscape        
+$a2l_mapOffset_left = 3.2 * $DPC;
+$a2l_mapOffset_bottom = 2.3 * $DPC;
+$a2l_map_width = 54.1 * $DPC;
+$a2l_map_height = 37.3 * $DPC; 
+$a2l_page_width = 59.4 * $DPC;
+$a2l_page_height = 42 * $DPC;
+$a2l_header_width =  8.5 * $DPC;
+$a2l_header_height = 6 * $DPC;
+
+# a1 portrait
+$a1p_mapOffset_left = 3.2 * $DPC;
+$a1p_mapOffset_bottom = 2.3 * $DPC;
+$a1p_map_width = 54.5 * $DPC;
+$a1p_map_height = 79.5 * $DPC;
+$a1p_page_width = 59.4 * $DPC;
+$a1p_page_height = 84 * $DPC;
+$a1p_header_width =  8.5 * $DPC;
+$a1p_header_height = 6 * $DPC;
+
+# a1 landscape        
+$a1l_mapOffset_left = 3.2 * $DPC;
+$a1l_mapOffset_bottom = 2.3 * $DPC;
+$a1l_map_width = 79.5 * $DPC;
+$a1l_map_height = 55.5 * $DPC; 
+$a1l_page_width = 84 * $DPC;
+$a1l_page_height = 59.4 * $DPC;
+$a1l_header_width =  8.5 * $DPC;
+$a1l_header_height = 6 * $DPC;
+
+# a0 portrait
+$a0p_mapOffset_left = 3.2 * $DPC;
+$a0p_mapOffset_bottom = 2.3 * $DPC;
+$a0p_map_width = 79 * $DPC;
+$a0p_map_height = 115 * $DPC;
+$a0p_page_width = 84 * $DPC;
+$a0p_page_height = 118.8 * $DPC;
+$a0p_header_width =  8.5 * $DPC;
+$a0p_header_height = 6 * $DPC;
+
+# a0 landscape        
+$a0l_mapOffset_left = 3.2 * $DPC;
+$a0l_mapOffset_bottom = 2.3 * $DPC;
+$a0l_map_width = 113 * $DPC;
+$a0l_map_height = 80.5 * $DPC; 
+$a0l_page_width = 118.8 * $DPC;
+$a0l_page_height = 84 * $DPC;
+$a0l_header_width =  8.5 * $DPC;
+$a0l_header_height = 6 * $DPC;
+
+/*
+* Overview
+*/
+$overview = true;
+$a4p_overviewOffset_left = $a4p_mapOffset_left;
+$a4p_overviewOffset_bottom = $a4p_mapOffset_bottom;
+
+$a4l_overviewOffset_left = $a4l_mapOffset_left;
+$a4l_overviewOffset_bottom = $a4l_mapOffset_bottom;
+
+$a3p_overviewOffset_left = $a3p_mapOffset_left;
+$a3p_overviewOffset_bottom = $a3p_mapOffset_bottom;
+
+$a3l_overviewOffset_left = $a3l_mapOffset_left;
+$a3l_overviewOffset_bottom = $a3l_mapOffset_bottom;
+
+$a2p_overviewOffset_left = $a2p_mapOffset_left;
+$a2p_overviewOffset_bottom = $a2p_mapOffset_bottom;
+
+$a2l_overviewOffset_left = $a2l_mapOffset_left;
+$a2l_overviewOffset_bottom = $a2l_mapOffset_bottom;
+
+$a1p_overviewOffset_left = $a1p_mapOffset_left;
+$a1p_overviewOffset_bottom = $a1p_mapOffset_bottom;
+
+$a1l_overviewOffset_left = $a1l_mapOffset_left;
+$a1l_overviewOffset_bottom = $a1l_mapOffset_bottom;
+
+$a0p_overviewOffset_left = $a0p_mapOffset_left;
+$a0p_overviewOffset_bottom = $a0p_mapOffset_bottom;
+
+$a0l_overviewOffset_left = $a0l_mapOffset_left;
+$a0l_overviewOffset_bottom = $a0l_mapOffset_bottom;
+
+
+
+/*
+* Northarrow
+*/
+$northarrow = true;
+$northarrowImage = "./img/northarrow.png";
+
+$a4p_northarrow_left = $a4p_mapOffset_left + 160;
+$a4p_northarrow_bottom = $a4p_mapOffset_bottom +2 ;
+
+$a4l_northarrow_left = $a4l_mapOffset_left + 5;
+$a4l_northarrow_bottom = $a4l_mapOffset_bottom + $a4l_map_height - 40;
+
+$a3p_northarrow_left = $a3p_mapOffset_left +5;
+$a3p_northarrow_bottom = $a3p_mapOffset_bottom + $a3p_map_height - 80;
+
+$a3l_northarrow_left = $a3l_mapOffset_left + 5;
+$a3l_northarrow_bottom = $a3l_mapOffset_bottom + $a3l_map_height - 40;
+
+$a2p_northarrow_left = $a2p_mapOffset_left +5;
+$a2p_northarrow_bottom = $a2p_mapOffset_bottom + $a2p_map_height - 80;
+
+$a2l_northarrow_left = $a2l_mapOffset_left + 5;
+$a2l_northarrow_bottom = $a2l_mapOffset_bottom + $a2l_map_height - 80;
+
+$a1p_northarrow_left = $a1p_mapOffset_left +5;
+$a1p_northarrow_bottom = $a1p_mapOffset_bottom + $a1p_map_height - 80;
+
+$a1l_northarrow_left = $a1l_mapOffset_left + 5;
+$a1l_northarrow_bottom = $a1l_mapOffset_bottom + $a1l_map_height - 160;
+
+$a0p_northarrow_left = $a0p_mapOffset_left +5;
+$a0p_northarrow_bottom = $a0p_mapOffset_bottom + $a0p_map_height - 80;
+
+$a0l_northarrow_left = $a0l_mapOffset_left + 5;
+$a0l_northarrow_bottom = $a0l_mapOffset_bottom + $a0l_map_height - 160;
+
+$northarrowImage_width = 15; 
+$northarrowImage_height = 35; 
+
+/*
+* special image for the map-page
+*/
+$special = true;
+$specialImage = "../img/mapbender_oo.png";
+
+$a4p_special_left = $a4p_mapOffset_left + $a4p_map_width - 50 ;
+$a4p_special_bottom = $a4p_mapOffset_bottom + $a4p_map_height + 80; 
+
+$a4l_special_left = $a4l_mapOffset_left + $a4l_map_width - $a4l_header_width + 0.8 * $DPC + 10 ;
+$a4l_special_bottom = $a4l_mapOffset_bottom + 54; 
+
+$a3p_special_left = $a3p_mapOffset_left + $a3p_map_width - $a3p_header_width ;
+$a3p_special_bottom = $a3p_mapOffset_bottom + 30; 
+
+$a3l_special_left = $a3l_mapOffset_left + $a3l_map_width - $a3l_header_width + 0.8 * $DPC + 10;
+$a3l_special_bottom = $a3l_mapOffset_bottom + 60; 
+
+$a2p_special_left = $a2p_mapOffset_left + $a2p_map_width - $a2p_header_width + 0.1 *$DPC ;
+$a2p_special_bottom = $a2p_mapOffset_bottom + 110; 
+
+$a2l_special_left = $a2l_mapOffset_left + $a2l_map_width - $a2l_header_width + 0.2 * $DPC ;
+$a2l_special_bottom = $a2l_mapOffset_bottom + 110; 
+
+$a1p_special_left = $a1p_mapOffset_left + $a1p_map_width - $a1p_header_width + 0.1 *$DPC ;
+$a1p_special_bottom = $a1p_mapOffset_bottom + 110; 
+
+$a1l_special_left = $a1l_mapOffset_left + $a1l_map_width - $a1l_header_width + 0.2 * $DPC ;
+$a1l_special_bottom = $a1l_mapOffset_bottom + 110; 
+
+$a0p_special_left = $a0p_mapOffset_left + $a0p_map_width - $a0p_header_width + 0.1 *$DPC ;
+$a0p_special_bottom = $a0p_mapOffset_bottom + 110; 
+
+$a0l_special_left = $a0l_mapOffset_left + $a0l_map_width - $a0l_header_width + 0.2 * $DPC ;
+$a0l_special_bottom = $a0l_mapOffset_bottom + 110; 
+
+$specialImage_width = 65; 
+$specialImage_height = 15;  
+
+
+/*
+* dynamic scalebar
+*/
+$scalebar = true;
+$units = "Meter";
+
+$a4p_scalebar_left = $a4p_mapOffset_left + 2 * $a4p_map_width/3;
+$a4p_scalebar_bottom = $a4p_mapOffset_bottom  + 0.5 * $DPC;
+
+$a4l_scalebar_left = $a4l_mapOffset_left + $a4l_map_width/4 ;
+$a4l_scalebar_bottom = $a4l_mapOffset_bottom +  + 0.5 * $DPC;
+
+$a3p_scalebar_left = $a3p_mapOffset_left  + $a3p_map_width/4 ;
+$a3p_scalebar_bottom = $a3p_mapOffset_bottom + 0.5 * $DPC;
+
+$a3l_scalebar_left = $a3l_mapOffset_left  + $a3l_map_width/4 ;
+$a3l_scalebar_bottom = $a3l_mapOffset_bottom +  + 0.5 * $DPC;
+
+$a2p_scalebar_left = $a2p_mapOffset_left  + $a2p_map_width/4 ;
+$a2p_scalebar_bottom = $a2p_mapOffset_bottom + 0.5 * $DPC;
+
+$a2l_scalebar_left = $a2l_mapOffset_left  + $a2l_map_width/4 ;
+$a2l_scalebar_bottom = $a2l_mapOffset_bottom +  + 0.5 * $DPC;
+
+$a1p_scalebar_left = $a1p_mapOffset_left  + $a1p_map_width/4 ;
+$a1p_scalebar_bottom = $a1p_mapOffset_bottom + 0.5 * $DPC;
+
+$a1l_scalebar_left = $a1l_mapOffset_left  + $a1l_map_width/4 ;
+$a1l_scalebar_bottom = $a1l_mapOffset_bottom +  + 0.5 * $DPC;
+
+$a0p_scalebar_left = $a0p_mapOffset_left  + $a0p_map_width/4 ;
+$a0p_scalebar_bottom = $a0p_mapOffset_bottom + 0.5 * $DPC;
+
+$a0l_scalebar_left = $a0l_mapOffset_left  + $a0l_map_width/4 ;
+$a0l_scalebar_bottom = $a0l_mapOffset_bottom +  + 0.5 * $DPC;
+
+$scalebar_width = 3 * $DPC;
+$scalebar_height = 0.18 * $DPC;
+ 
+
+?>

Modified: branches/2.5/http/print/printPDF_b.conf
===================================================================
--- branches/2.5/http/print/printPDF_b.conf	2008-08-11 08:19:21 UTC (rev 2763)
+++ branches/2.5/http/print/printPDF_b.conf	2008-08-11 08:21:14 UTC (rev 2764)
@@ -1,388 +1,387 @@
-<?php
-
-include_once(dirname(__FILE__)."/../../core/globalSettings.php");
-# filename for temporary imagefiles
-$filename = TMPDIR."/map_".substr(md5(uniqid(rand())),0,7).".png";
-
-/*
-* DOWNLOAD
-*/
-$download = true;
-$downloadFile = TMPDIR."/map_".substr(md5(uniqid(rand())),0,7).".pdf";
-$downloadText = "Download: Karte als PDF...";
-
-/*
-*run print as iframe or window
-*/
-$type = 'window';
-
-
-
-/*
-* Legend
-*/
-$legend=true;
-$label_legend = 'Print legend';
-$legendFilename = TMPDIR."/legend_".substr(md5(uniqid(rand())),0,7).".png";
-$legendFilenameUserPolygon = TMPDIR."/legend_".substr(md5(uniqid(rand())),0,7).".png";
-$legendText = "Legende";
-$legendFooter = "powered by Mapbender";
-$legendImage = "./img/mapbender_logo.png";
-$legendImage_width = 90;
-$legendImage_height = 13;
-
-
-# log requests, class 'class_log.php' required
-$log = false;
-
-# delete images:
-$unlink = true;
-
-# labeling
-if(CHARSET=="UTF-8"){ 
-	$new_comment1 = utf8_decode($_REQUEST["comment1"]);
-	$new_comment2 = utf8_decode($_REQUEST["comment2"]);
-}
-else{
-	$new_comment1 = $_REQUEST["comment1"];
-	$new_comment2 = $_REQUEST["comment2"];
-}
-
-$text1 = "Druckansicht";
-$text2 = "- Mapbender -";
-$text3 = "";
-$text4 = "Ma�stab 1 : " . $_REQUEST["map_scale"];
-$text5 = "Datum: " . date("d.m.Y",strtotime("now"));;
-
-$text6 = "Notizen:";
-$text7 = "";
-$text8 = $new_comment1;
-$text9 = $new_comment2;
-$text10 = "";
-
-
-$text11 = "Der Auszug ist maschinell erzeugt, er ist ohne Unterschrift g�ltig.";
-$text12 = "Dieser Auszug ist gesetzlich gesch�tzt (� 3 Abs. 1 VermKatG NW). Vervielf�ltigungen, Umarbeitungen, Ver�ffentlichungen oder die Weitergabe an Dritte nur mit Zustimmung des";
-$text13 = "Herausgebers, ausgenommen Vervielf�ltigungen und Umarbeitungen zur innerdienstlichen Verwendung bei Beh�rden oder zum eigenen Gebrauch.";
-
-$text14 = "Dieser Auszug ist gesetzlich gesch�tzt (� 3 Abs. 1 VermKatG NW). Vervielf�ltigungen,";
-$text15 = "Umarbeitungen, Ver�ffentlichungen oder die Weitergabe an Dritte nur mit Zustimmung";
-$text16 = "des Herausgebers, ausgenommen Vervielf�ltigungen und Umarbeitungen zur inner-";
-$text17 = "dienstlichen Verwendung bei Beh�rden oder zum eigenen Gebrauch.";
-
-/*
-* Labeling for buttons, textfields ...
-*/
-
-$label_format = "Format";
-$label_format_a4 = "A4";
-$label_format_a3 = "A3";
-$label_format_a2 = "A2";
-$label_format_a1 = "A1";
-$label_format_a0 = "A0";
-
-$label_orientation = "Orientation";
-$label_portrait = "Portrait";
-$label_landscape = "Landscape";
+<?php
 
-$label_quality = "Quality";
-$label_72dpi = "72 dpi";
-$label_288dpi = "288 dpi";
-
+include_once(dirname(__FILE__)."/../../core/globalSettings.php");
+# filename for temporary imagefiles
+$filename = TMPDIR."/map_".substr(md5(uniqid(rand())),0,7).".png";
+
+/*
+* DOWNLOAD
+*/
+$download = true;
+$downloadFile = TMPDIR."/map_".substr(md5(uniqid(rand())),0,7).".pdf";
+$downloadText = _mb("Download: Map as PDF...");
+
+/*
+*run print as iframe or window
+*/
+$type = 'window';
+
+
+
+/*
+* Legend
+*/
+$legend=true;
+$label_legend = _mb('Print legend');
+$legendFilename = TMPDIR."/legend_".substr(md5(uniqid(rand())),0,7).".png";
+$legendFilenameUserPolygon = TMPDIR."/legend_".substr(md5(uniqid(rand())),0,7).".png";
+$legendText = _mb("Legend");
+$legendFooter = _mb("powered by Mapbender");
+$legendImage = "./img/mapbender_logo.png";
+$legendImage_width = 90;
+$legendImage_height = 13;
+
+
+# log requests, class 'class_log.php' required
+$log = false;
+
+# delete images:
+$unlink = true;
+
+# labeling
+if(CHARSET=="UTF-8"){ 
+	$new_comment1 = utf8_decode($_REQUEST["comment1"]);
+	$new_comment2 = utf8_decode($_REQUEST["comment2"]);
+}
+else{
+	$new_comment1 = $_REQUEST["comment1"];
+	$new_comment2 = $_REQUEST["comment2"];
+}
+
+$text1 = _mb("Print preview");
+$text2 = "- Mapbender -";
+$text3 = "";
+$text4 = _mb("Scale 1:"). " ".$_REQUEST["map_scale"];
+$text5 = _mb("Date:") . " ".date("d.m.Y",strtotime("now"));
+
+$text6 = _mb("Notes:");
+$text7 = "";
+$text8 = $new_comment1;
+$text9 = $new_comment2;
+$text10 = "";
+
+
+$text11 = _mb("This copy has been automatically generated and is thus not valid without signature.");
+$text12 = _mb("This copy is protected by law (Par. 3 Abs. 1 VermKatG NW). It can be duplicaedted, modified, published or be passed to third parties only in agreement with");
+$text13 = _mb("the publisher, except duplicates and modifications aimed at internal use of government agencies or private use.");
+
+$text14 = _mb("This copy is protected,");
+$text15 = _mb("ask me!!!!");
+$text16 = _mb("or the publisher");
+$text17 = _mb("or use is internally.");
+
+/*
+* Labeling for buttons, textfields ...
+*/
+
+$label_format = _mb("Format");
+$label_format_a4 = "A4";
+$label_format_a3 = "A3";
+$label_format_a2 = "A2";
+$label_format_a1 = "A1";
+$label_format_a0 = "A0";
+
+$label_orientation = _mb("Orientation");
+$label_portrait = _mb("portrait");
+$label_landscape = _mb("landscape");
+
+$label_72dpi = sprintf(_mb("Quality: %d dpi"), 72);
+$label_288dpi = sprintf(_mb("Quality: %d dpi"), 288);
+
 $label_comment1 = "Comment 1";
 $label_comment2 = "Comment 2";
 $comment1_length = 30;
 $comment2_length = 30;
-
-$label_button = 'Print';
-
-/*
-* default
-* url string matching and replacement
-*/
-$matching = false;
-$pattern =  "/192\.168\.2\.113/";
-$replacement = "192.168.2.5";
-
-/*
-* high quality printing 288dpi
-* highquality mapfiles will be supplemented with "_4"
-* example: germany.map -> germany_4.map
-*/
-
-
-$highquality = true;
-$highqualitymapfiles = array(
-	"/data/umn/germany/germany_demo.map",
-	"/data/umn/mapbender_user/mapbender_user.map"
-);
-
-# Dots per cm (72 dpi):
-# 28.346456692913385826771653543307 
-$DPC = 28.35;
-
-# available formats:
-$a4 = true;
-$a3 = true;
-$a2 = true;
-$a1 = true;
-$a0 = true;
-
-# dimensions of the map:
-
-# A4 portrait
-$a4p_mapOffset_left = 3.3 * $DPC;
-$a4p_mapOffset_bottom = 3 * $DPC;
-$a4p_map_width = 15.7 * $DPC; 
-$a4p_map_height = 22 * $DPC; 
-$a4p_page_width = 21 * $DPC;
-$a4p_page_height = 29.7 * $DPC;
-$a4p_header_height = 2.6 * $DPC;
-$a4p_footer_height = 1.12 * $DPC;
-        
-# A4 landscape
-$a4l_mapOffset_left = 2.3 * $DPC;
-$a4l_mapOffset_bottom = 1.8 * $DPC;
-$a4l_map_width = 25.2 * $DPC;
-$a4l_map_height = 16.4 * $DPC; 
-$a4l_page_width = 29.7 * $DPC;
-$a4l_page_height = 21 * $DPC;   
-$a4l_header_width = 8.5 * $DPC;
-$a4l_header_height = 6 * $DPC;
-        
-# A3 protrait
-$a3p_mapOffset_left = 3.3 * $DPC;
-$a3p_mapOffset_bottom = 3 * $DPC;
-$a3p_map_width = 24.1 * $DPC;
-$a3p_map_height = 36.7 * $DPC;
-$a3p_page_width = 29.7 * $DPC;
-$a3p_page_height = 42 * $DPC;
-$a3p_header_width =  8.5 * $DPC;
-$a3p_header_height = 6 * $DPC;
-
-# A3 landscape        
-$a3l_mapOffset_left = 2.3 * $DPC;
-$a3l_mapOffset_bottom = 1.8 * $DPC;
-$a3l_map_width = 37.4 * $DPC;
-$a3l_map_height = 25.4 * $DPC; 
-$a3l_page_width = 42 * $DPC;
-$a3l_page_height = 29.7 * $DPC;
-$a3l_header_width =  8.5 * $DPC;
-$a3l_header_height = 6 * $DPC;
-
-# a2 protrait
-$a2p_mapOffset_left = 3.2 * $DPC;
-$a2p_mapOffset_bottom = 2.3 * $DPC;
-$a2p_map_width = 37.3 * $DPC;
-$a2p_map_height = 54.8 * $DPC;
-$a2p_page_width = 42 * $DPC;
-$a2p_page_height = 59.4 * $DPC;
-$a2p_header_width =  8.5 * $DPC;
-$a2p_header_height = 6 * $DPC;
-
-# a2 landscape        
-$a2l_mapOffset_left = 3.2 * $DPC;
-$a2l_mapOffset_bottom = 2.3 * $DPC;
-$a2l_map_width = 54.1 * $DPC;
-$a2l_map_height = 37.3 * $DPC; 
-$a2l_page_width = 59.4 * $DPC;
-$a2l_page_height = 42 * $DPC;
-$a2l_header_width =  8.5 * $DPC;
-$a2l_header_height = 6 * $DPC;
-
-# a1 portrait
-$a1p_mapOffset_left = 3.2 * $DPC;
-$a1p_mapOffset_bottom = 2.3 * $DPC;
-$a1p_map_width = 54.5 * $DPC;
-$a1p_map_height = 79.5 * $DPC;
-$a1p_page_width = 59.4 * $DPC;
-$a1p_page_height = 84 * $DPC;
-$a1p_header_width =  8.5 * $DPC;
-$a1p_header_height = 6 * $DPC;
-
-# a1 landscape        
-$a1l_mapOffset_left = 3.2 * $DPC;
-$a1l_mapOffset_bottom = 2.3 * $DPC;
-$a1l_map_width = 79.5 * $DPC;
-$a1l_map_height = 55.5 * $DPC; 
-$a1l_page_width = 84 * $DPC;
-$a1l_page_height = 59.4 * $DPC;
-$a1l_header_width =  8.5 * $DPC;
-$a1l_header_height = 6 * $DPC;
-
-# a0 portrait
-$a0p_mapOffset_left = 3.2 * $DPC;
-$a0p_mapOffset_bottom = 2.3 * $DPC;
-$a0p_map_width = 79 * $DPC;
-$a0p_map_height = 115 * $DPC;
-$a0p_page_width = 84 * $DPC;
-$a0p_page_height = 118.8 * $DPC;
-$a0p_header_width =  8.5 * $DPC;
-$a0p_header_height = 6 * $DPC;
-
-# a0 landscape        
-$a0l_mapOffset_left = 3.2 * $DPC;
-$a0l_mapOffset_bottom = 2.3 * $DPC;
-$a0l_map_width = 113 * $DPC;
-$a0l_map_height = 80.5 * $DPC; 
-$a0l_page_width = 118.8 * $DPC;
-$a0l_page_height = 84 * $DPC;
-$a0l_header_width =  8.5 * $DPC;
-$a0l_header_height = 6 * $DPC;
-
-/*
-* Overview
-*/
-$overview = true;
-$a4p_overviewOffset_left = $a4p_mapOffset_left;
-$a4p_overviewOffset_bottom = $a4p_mapOffset_bottom;
-
-$a4l_overviewOffset_left = $a4l_mapOffset_left;
-$a4l_overviewOffset_bottom = $a4l_mapOffset_bottom;
-
-$a3p_overviewOffset_left = $a3p_mapOffset_left;
-$a3p_overviewOffset_bottom = $a3p_mapOffset_bottom;
-
-$a3l_overviewOffset_left = $a3l_mapOffset_left;
-$a3l_overviewOffset_bottom = $a3l_mapOffset_bottom;
-
-$a2p_overviewOffset_left = $a2p_mapOffset_left;
-$a2p_overviewOffset_bottom = $a2p_mapOffset_bottom;
-
-$a2l_overviewOffset_left = $a2l_mapOffset_left;
-$a2l_overviewOffset_bottom = $a2l_mapOffset_bottom;
-
-$a1p_overviewOffset_left = $a1p_mapOffset_left;
-$a1p_overviewOffset_bottom = $a1p_mapOffset_bottom;
-
-$a1l_overviewOffset_left = $a1l_mapOffset_left;
-$a1l_overviewOffset_bottom = $a1l_mapOffset_bottom;
-
-$a0p_overviewOffset_left = $a0p_mapOffset_left;
-$a0p_overviewOffset_bottom = $a0p_mapOffset_bottom;
-
-$a0l_overviewOffset_left = $a0l_mapOffset_left;
-$a0l_overviewOffset_bottom = $a0l_mapOffset_bottom;
-
-
-
-/*
-* Northarrow
-*/
-$northarrow = true;
-$northarrowImage = "./img/northarrow.png";
-
-$a4p_northarrow_left = $a4p_mapOffset_left + 160;
-$a4p_northarrow_bottom = $a4p_mapOffset_bottom +2 ;
-
-$a4l_northarrow_left = $a4l_mapOffset_left + 5;
-$a4l_northarrow_bottom = $a4l_mapOffset_bottom + $a4l_map_height - 40;
-
-$a3p_northarrow_left = $a3p_mapOffset_left +5;
-$a3p_northarrow_bottom = $a3p_mapOffset_bottom + $a3p_map_height - 80;
-
-$a3l_northarrow_left = $a3l_mapOffset_left + 5;
-$a3l_northarrow_bottom = $a3l_mapOffset_bottom + $a3l_map_height - 40;
-
-$a2p_northarrow_left = $a2p_mapOffset_left +5;
-$a2p_northarrow_bottom = $a2p_mapOffset_bottom + $a2p_map_height - 80;
-
-$a2l_northarrow_left = $a2l_mapOffset_left + 5;
-$a2l_northarrow_bottom = $a2l_mapOffset_bottom + $a2l_map_height - 80;
-
-$a1p_northarrow_left = $a1p_mapOffset_left +5;
-$a1p_northarrow_bottom = $a1p_mapOffset_bottom + $a1p_map_height - 80;
-
-$a1l_northarrow_left = $a1l_mapOffset_left + 5;
-$a1l_northarrow_bottom = $a1l_mapOffset_bottom + $a1l_map_height - 160;
-
-$a0p_northarrow_left = $a0p_mapOffset_left +5;
-$a0p_northarrow_bottom = $a0p_mapOffset_bottom + $a0p_map_height - 80;
-
-$a0l_northarrow_left = $a0l_mapOffset_left + 5;
-$a0l_northarrow_bottom = $a0l_mapOffset_bottom + $a0l_map_height - 160;
-
-$northarrowImage_width = 15; 
-$northarrowImage_height = 35; 
-
-/*
-* special image for the map-page
-*/
-$special = true;
-$specialImage = "../img/mapbender_oo.png";
-
-$a4p_special_left = $a4p_mapOffset_left + $a4p_map_width - 50 ;
-$a4p_special_bottom = $a4p_mapOffset_bottom + $a4p_map_height + 80; 
-
-$a4l_special_left = $a4l_mapOffset_left + $a4l_map_width - $a4l_header_width + 0.8 * $DPC + 10 ;
-$a4l_special_bottom = $a4l_mapOffset_bottom + 54; 
-
-$a3p_special_left = $a3p_mapOffset_left + $a3p_map_width - $a3p_header_width ;
-$a3p_special_bottom = $a3p_mapOffset_bottom + 30; 
-
-$a3l_special_left = $a3l_mapOffset_left + $a3l_map_width - $a3l_header_width + 0.8 * $DPC + 10;
-$a3l_special_bottom = $a3l_mapOffset_bottom + 60; 
-
-$a2p_special_left = $a2p_mapOffset_left + $a2p_map_width - $a2p_header_width + 0.1 *$DPC ;
-$a2p_special_bottom = $a2p_mapOffset_bottom + 110; 
-
-$a2l_special_left = $a2l_mapOffset_left + $a2l_map_width - $a2l_header_width + 0.2 * $DPC ;
-$a2l_special_bottom = $a2l_mapOffset_bottom + 110; 
-
-$a1p_special_left = $a1p_mapOffset_left + $a1p_map_width - $a1p_header_width + 0.1 *$DPC ;
-$a1p_special_bottom = $a1p_mapOffset_bottom + 110; 
-
-$a1l_special_left = $a1l_mapOffset_left + $a1l_map_width - $a1l_header_width + 0.2 * $DPC ;
-$a1l_special_bottom = $a1l_mapOffset_bottom + 110; 
-
-$a0p_special_left = $a0p_mapOffset_left + $a0p_map_width - $a0p_header_width + 0.1 *$DPC ;
-$a0p_special_bottom = $a0p_mapOffset_bottom + 110; 
-
-$a0l_special_left = $a0l_mapOffset_left + $a0l_map_width - $a0l_header_width + 0.2 * $DPC ;
-$a0l_special_bottom = $a0l_mapOffset_bottom + 110; 
-
-$specialImage_width = 65; 
-$specialImage_height = 15;  
-
-
-/*
-* dynamic scalebar
-*/
-$scalebar = true;
-$units = "Meter";
-
-$a4p_scalebar_left = $a4p_mapOffset_left + 2 * $a4p_map_width/3;
-$a4p_scalebar_bottom = $a4p_mapOffset_bottom  + 0.5 * $DPC;
-
-$a4l_scalebar_left = $a4l_mapOffset_left + $a4l_map_width/4 ;
-$a4l_scalebar_bottom = $a4l_mapOffset_bottom +  + 0.5 * $DPC;
-
-$a3p_scalebar_left = $a3p_mapOffset_left  + $a3p_map_width/4 ;
-$a3p_scalebar_bottom = $a3p_mapOffset_bottom + 0.5 * $DPC;
-
-$a3l_scalebar_left = $a3l_mapOffset_left  + $a3l_map_width/4 ;
-$a3l_scalebar_bottom = $a3l_mapOffset_bottom +  + 0.5 * $DPC;
-
-$a2p_scalebar_left = $a2p_mapOffset_left  + $a2p_map_width/4 ;
-$a2p_scalebar_bottom = $a2p_mapOffset_bottom + 0.5 * $DPC;
-
-$a2l_scalebar_left = $a2l_mapOffset_left  + $a2l_map_width/4 ;
-$a2l_scalebar_bottom = $a2l_mapOffset_bottom +  + 0.5 * $DPC;
-
-$a1p_scalebar_left = $a1p_mapOffset_left  + $a1p_map_width/4 ;
-$a1p_scalebar_bottom = $a1p_mapOffset_bottom + 0.5 * $DPC;
-
-$a1l_scalebar_left = $a1l_mapOffset_left  + $a1l_map_width/4 ;
-$a1l_scalebar_bottom = $a1l_mapOffset_bottom +  + 0.5 * $DPC;
-
-$a0p_scalebar_left = $a0p_mapOffset_left  + $a0p_map_width/4 ;
-$a0p_scalebar_bottom = $a0p_mapOffset_bottom + 0.5 * $DPC;
-
-$a0l_scalebar_left = $a0l_mapOffset_left  + $a0l_map_width/4 ;
-$a0l_scalebar_bottom = $a0l_mapOffset_bottom +  + 0.5 * $DPC;
-
-$scalebar_width = 3 * $DPC;
-$scalebar_height = 0.18 * $DPC;
- 
-
-?>
+
+$label_button = _mb("print");
+
+/*
+* default
+* url string matching and replacement
+*/
+$matching = false;
+$pattern =  "/192\.168\.2\.113/";
+$replacement = "192.168.2.5";
+
+/*
+* high quality printing 288dpi
+* highquality mapfiles will be supplemented with "_4"
+* example: germany.map -> germany_4.map
+*/
+
+
+$highquality = true;
+$highqualitymapfiles = array(
+	"/data/umn/germany/germany_demo.map",
+	"/data/umn/mapbender_user/mapbender_user.map"
+);
+
+# Dots per cm (72 dpi):
+# 28.346456692913385826771653543307 
+$DPC = 28.35;
+
+# available formats:
+$a4 = true;
+$a3 = true;
+$a2 = true;
+$a1 = false;
+$a0 = false;
+
+# dimensions of the map:
+
+# A4 portrait
+$a4p_mapOffset_left = 3.3 * $DPC;
+$a4p_mapOffset_bottom = 3 * $DPC;
+$a4p_map_width = 15.7 * $DPC; 
+$a4p_map_height = 22 * $DPC; 
+$a4p_page_width = 21 * $DPC;
+$a4p_page_height = 29.7 * $DPC;
+$a4p_header_height = 2.6 * $DPC;
+$a4p_footer_height = 1.12 * $DPC;
+        
+# A4 landscape
+$a4l_mapOffset_left = 2.3 * $DPC;
+$a4l_mapOffset_bottom = 1.8 * $DPC;
+$a4l_map_width = 25.2 * $DPC;
+$a4l_map_height = 16.4 * $DPC; 
+$a4l_page_width = 29.7 * $DPC;
+$a4l_page_height = 21 * $DPC;   
+$a4l_header_width = 8.5 * $DPC;
+$a4l_header_height = 6 * $DPC;
+        
+# A3 protrait
+$a3p_mapOffset_left = 3.3 * $DPC;
+$a3p_mapOffset_bottom = 3 * $DPC;
+$a3p_map_width = 24.1 * $DPC;
+$a3p_map_height = 36.7 * $DPC;
+$a3p_page_width = 29.7 * $DPC;
+$a3p_page_height = 42 * $DPC;
+$a3p_header_width =  8.5 * $DPC;
+$a3p_header_height = 6 * $DPC;
+
+# A3 landscape        
+$a3l_mapOffset_left = 2.3 * $DPC;
+$a3l_mapOffset_bottom = 1.8 * $DPC;
+$a3l_map_width = 37.4 * $DPC;
+$a3l_map_height = 25.4 * $DPC; 
+$a3l_page_width = 42 * $DPC;
+$a3l_page_height = 29.7 * $DPC;
+$a3l_header_width =  8.5 * $DPC;
+$a3l_header_height = 6 * $DPC;
+
+# a2 protrait
+$a2p_mapOffset_left = 3.2 * $DPC;
+$a2p_mapOffset_bottom = 2.3 * $DPC;
+$a2p_map_width = 37.3 * $DPC;
+$a2p_map_height = 54.8 * $DPC;
+$a2p_page_width = 42 * $DPC;
+$a2p_page_height = 59.4 * $DPC;
+$a2p_header_width =  8.5 * $DPC;
+$a2p_header_height = 6 * $DPC;
+
+# a2 landscape        
+$a2l_mapOffset_left = 3.2 * $DPC;
+$a2l_mapOffset_bottom = 2.3 * $DPC;
+$a2l_map_width = 54.1 * $DPC;
+$a2l_map_height = 37.3 * $DPC; 
+$a2l_page_width = 59.4 * $DPC;
+$a2l_page_height = 42 * $DPC;
+$a2l_header_width =  8.5 * $DPC;
+$a2l_header_height = 6 * $DPC;
+
+# a1 portrait
+$a1p_mapOffset_left = 3.2 * $DPC;
+$a1p_mapOffset_bottom = 2.3 * $DPC;
+$a1p_map_width = 54.5 * $DPC;
+$a1p_map_height = 79.5 * $DPC;
+$a1p_page_width = 59.4 * $DPC;
+$a1p_page_height = 84 * $DPC;
+$a1p_header_width =  8.5 * $DPC;
+$a1p_header_height = 6 * $DPC;
+
+# a1 landscape        
+$a1l_mapOffset_left = 3.2 * $DPC;
+$a1l_mapOffset_bottom = 2.3 * $DPC;
+$a1l_map_width = 79.5 * $DPC;
+$a1l_map_height = 55.5 * $DPC; 
+$a1l_page_width = 84 * $DPC;
+$a1l_page_height = 59.4 * $DPC;
+$a1l_header_width =  8.5 * $DPC;
+$a1l_header_height = 6 * $DPC;
+
+# a0 portrait
+$a0p_mapOffset_left = 3.2 * $DPC;
+$a0p_mapOffset_bottom = 2.3 * $DPC;
+$a0p_map_width = 79 * $DPC;
+$a0p_map_height = 115 * $DPC;
+$a0p_page_width = 84 * $DPC;
+$a0p_page_height = 118.8 * $DPC;
+$a0p_header_width =  8.5 * $DPC;
+$a0p_header_height = 6 * $DPC;
+
+# a0 landscape        
+$a0l_mapOffset_left = 3.2 * $DPC;
+$a0l_mapOffset_bottom = 2.3 * $DPC;
+$a0l_map_width = 113 * $DPC;
+$a0l_map_height = 80.5 * $DPC; 
+$a0l_page_width = 118.8 * $DPC;
+$a0l_page_height = 84 * $DPC;
+$a0l_header_width =  8.5 * $DPC;
+$a0l_header_height = 6 * $DPC;
+
+/*
+* Overview
+*/
+$overview = true;
+$a4p_overviewOffset_left = $a4p_mapOffset_left;
+$a4p_overviewOffset_bottom = $a4p_mapOffset_bottom;
+
+$a4l_overviewOffset_left = $a4l_mapOffset_left;
+$a4l_overviewOffset_bottom = $a4l_mapOffset_bottom;
+
+$a3p_overviewOffset_left = $a3p_mapOffset_left;
+$a3p_overviewOffset_bottom = $a3p_mapOffset_bottom;
+
+$a3l_overviewOffset_left = $a3l_mapOffset_left;
+$a3l_overviewOffset_bottom = $a3l_mapOffset_bottom;
+
+$a2p_overviewOffset_left = $a2p_mapOffset_left;
+$a2p_overviewOffset_bottom = $a2p_mapOffset_bottom;
+
+$a2l_overviewOffset_left = $a2l_mapOffset_left;
+$a2l_overviewOffset_bottom = $a2l_mapOffset_bottom;
+
+$a1p_overviewOffset_left = $a1p_mapOffset_left;
+$a1p_overviewOffset_bottom = $a1p_mapOffset_bottom;
+
+$a1l_overviewOffset_left = $a1l_mapOffset_left;
+$a1l_overviewOffset_bottom = $a1l_mapOffset_bottom;
+
+$a0p_overviewOffset_left = $a0p_mapOffset_left;
+$a0p_overviewOffset_bottom = $a0p_mapOffset_bottom;
+
+$a0l_overviewOffset_left = $a0l_mapOffset_left;
+$a0l_overviewOffset_bottom = $a0l_mapOffset_bottom;
+
+
+
+/*
+* Northarrow
+*/
+$northarrow = true;
+$northarrowImage = "./img/northarrow.png";
+
+$a4p_northarrow_left = $a4p_mapOffset_left + 160;
+$a4p_northarrow_bottom = $a4p_mapOffset_bottom +2 ;
+
+$a4l_northarrow_left = $a4l_mapOffset_left + 5;
+$a4l_northarrow_bottom = $a4l_mapOffset_bottom + $a4l_map_height - 40;
+
+$a3p_northarrow_left = $a3p_mapOffset_left +5;
+$a3p_northarrow_bottom = $a3p_mapOffset_bottom + $a3p_map_height - 80;
+
+$a3l_northarrow_left = $a3l_mapOffset_left + 5;
+$a3l_northarrow_bottom = $a3l_mapOffset_bottom + $a3l_map_height - 40;
+
+$a2p_northarrow_left = $a2p_mapOffset_left +5;
+$a2p_northarrow_bottom = $a2p_mapOffset_bottom + $a2p_map_height - 80;
+
+$a2l_northarrow_left = $a2l_mapOffset_left + 5;
+$a2l_northarrow_bottom = $a2l_mapOffset_bottom + $a2l_map_height - 80;
+
+$a1p_northarrow_left = $a1p_mapOffset_left +5;
+$a1p_northarrow_bottom = $a1p_mapOffset_bottom + $a1p_map_height - 80;
+
+$a1l_northarrow_left = $a1l_mapOffset_left + 5;
+$a1l_northarrow_bottom = $a1l_mapOffset_bottom + $a1l_map_height - 160;
+
+$a0p_northarrow_left = $a0p_mapOffset_left +5;
+$a0p_northarrow_bottom = $a0p_mapOffset_bottom + $a0p_map_height - 80;
+
+$a0l_northarrow_left = $a0l_mapOffset_left + 5;
+$a0l_northarrow_bottom = $a0l_mapOffset_bottom + $a0l_map_height - 160;
+
+$northarrowImage_width = 15; 
+$northarrowImage_height = 35; 
+
+/*
+* special image for the map-page
+*/
+$special = true;
+$specialImage = "../img/mapbender_oo.png";
+
+$a4p_special_left = $a4p_mapOffset_left + $a4p_map_width - 50 ;
+$a4p_special_bottom = $a4p_mapOffset_bottom + $a4p_map_height + 80; 
+
+$a4l_special_left = $a4l_mapOffset_left + $a4l_map_width - $a4l_header_width + 0.8 * $DPC + 10 ;
+$a4l_special_bottom = $a4l_mapOffset_bottom + 54; 
+
+$a3p_special_left = $a3p_mapOffset_left + $a3p_map_width - $a3p_header_width ;
+$a3p_special_bottom = $a3p_mapOffset_bottom + 30; 
+
+$a3l_special_left = $a3l_mapOffset_left + $a3l_map_width - $a3l_header_width + 0.8 * $DPC + 10;
+$a3l_special_bottom = $a3l_mapOffset_bottom + 60; 
+
+$a2p_special_left = $a2p_mapOffset_left + $a2p_map_width - $a2p_header_width + 0.1 *$DPC ;
+$a2p_special_bottom = $a2p_mapOffset_bottom + 110; 
+
+$a2l_special_left = $a2l_mapOffset_left + $a2l_map_width - $a2l_header_width + 0.2 * $DPC ;
+$a2l_special_bottom = $a2l_mapOffset_bottom + 110; 
+
+$a1p_special_left = $a1p_mapOffset_left + $a1p_map_width - $a1p_header_width + 0.1 *$DPC ;
+$a1p_special_bottom = $a1p_mapOffset_bottom + 110; 
+
+$a1l_special_left = $a1l_mapOffset_left + $a1l_map_width - $a1l_header_width + 0.2 * $DPC ;
+$a1l_special_bottom = $a1l_mapOffset_bottom + 110; 
+
+$a0p_special_left = $a0p_mapOffset_left + $a0p_map_width - $a0p_header_width + 0.1 *$DPC ;
+$a0p_special_bottom = $a0p_mapOffset_bottom + 110; 
+
+$a0l_special_left = $a0l_mapOffset_left + $a0l_map_width - $a0l_header_width + 0.2 * $DPC ;
+$a0l_special_bottom = $a0l_mapOffset_bottom + 110; 
+
+$specialImage_width = 65; 
+$specialImage_height = 15;  
+
+
+/*
+* dynamic scalebar
+*/
+$scalebar = true;
+$units = "Meter";
+
+$a4p_scalebar_left = $a4p_mapOffset_left + 2 * $a4p_map_width/3;
+$a4p_scalebar_bottom = $a4p_mapOffset_bottom  + 0.5 * $DPC;
+
+$a4l_scalebar_left = $a4l_mapOffset_left + $a4l_map_width/4 ;
+$a4l_scalebar_bottom = $a4l_mapOffset_bottom +  + 0.5 * $DPC;
+
+$a3p_scalebar_left = $a3p_mapOffset_left  + $a3p_map_width/4 ;
+$a3p_scalebar_bottom = $a3p_mapOffset_bottom + 0.5 * $DPC;
+
+$a3l_scalebar_left = $a3l_mapOffset_left  + $a3l_map_width/4 ;
+$a3l_scalebar_bottom = $a3l_mapOffset_bottom +  + 0.5 * $DPC;
+
+$a2p_scalebar_left = $a2p_mapOffset_left  + $a2p_map_width/4 ;
+$a2p_scalebar_bottom = $a2p_mapOffset_bottom + 0.5 * $DPC;
+
+$a2l_scalebar_left = $a2l_mapOffset_left  + $a2l_map_width/4 ;
+$a2l_scalebar_bottom = $a2l_mapOffset_bottom +  + 0.5 * $DPC;
+
+$a1p_scalebar_left = $a1p_mapOffset_left  + $a1p_map_width/4 ;
+$a1p_scalebar_bottom = $a1p_mapOffset_bottom + 0.5 * $DPC;
+
+$a1l_scalebar_left = $a1l_mapOffset_left  + $a1l_map_width/4 ;
+$a1l_scalebar_bottom = $a1l_mapOffset_bottom +  + 0.5 * $DPC;
+
+$a0p_scalebar_left = $a0p_mapOffset_left  + $a0p_map_width/4 ;
+$a0p_scalebar_bottom = $a0p_mapOffset_bottom + 0.5 * $DPC;
+
+$a0l_scalebar_left = $a0l_mapOffset_left  + $a0l_map_width/4 ;
+$a0l_scalebar_bottom = $a0l_mapOffset_bottom +  + 0.5 * $DPC;
+
+$scalebar_width = 3 * $DPC;
+$scalebar_height = 0.18 * $DPC;
+ 
+
+?>



More information about the Mapbender_commits mailing list