// Allgemeine Setzungen:
// ------------------------------------------------------------------

var z = 1;
var x = 0;
var y = 0;
var h = 0;
var a = 0;

// Funktion zum Aufruf der Hilfeseite:
// -------------------------------------------------------------------------------------------------------------------------------------
function ShowHelp(){
	wi = window.open("help.htm","Fenster1", "width=600 height=550,screenX=0,screenY=0");
}

// Funktion zum disablen der Schaltflächen:
// --------------------------------------------------------------------------------------------------------------------------------------

function SetDisabled(theVar, z){


	if ( theVar == 0 ) {
		a = 0;
		parent.theControl.document.images['Attribut'].src = "images/bd_info.gif";
		parent.theControl.document.ControlForm.Att.value = 0;
		h=0;
		parent.theControl.document.images['Hotlink'].src = "images/bd_hot.gif";
		parent.theControl.document.ControlForm.Hot.value = 0;
		theVar = 'X'};
	if ( theVar == 1 ) {
		a = 0;
		parent.theControl.document.images['Attribut'].src = "images/bd_info.gif";
		parent.theControl.document.ControlForm.Att.value = 0;
		h=1;
		parent.theControl.document.images['Hotlink'].src = "images/ba_hot.gif";
		parent.theControl.document.ControlForm.Hot.value = 1;
		theVar = 'X'};
	if ( theVar == 2 ) {
		a = 1;
		parent.theControl.document.images['Attribut'].src = "images/ba_info.gif";
		parent.theControl.document.ControlForm.Att.value = 1;
		h=0;
		parent.theControl.document.images['Hotlink'].src = "images/bd_hot.gif";
		parent.theControl.document.ControlForm.Hot.value = 0;
		theVar = 'X'};
	if ( theVar == 3 ) {
		a = 1;
		parent.theControl.document.images['Attribut'].src = "images/ba_info.gif";
		parent.theControl.document.ControlForm.Att.value = 1;
		h=0;
		parent.theControl.document.images['Hotlink'].src = "images/bi_hot.gif";
		parent.theControl.document.ControlForm.Hot.value = 0;
		theVar = 'X'};


	if ( z < parseInt(parent.theControl.document.theForm.Zooms.value) )   {parent.theControl.document.images['ZoomIn'].src = "images/bi_zoomin.gif"};
	if ( z == parseInt(parent.theControl.document.theForm.Zooms.value) ) {parent.theControl.document.images['ZoomIn'].src = "images/bd_zoomin.gif"};
	if ( z == 1 ) {parent.theControl.document.images['ZoomOut'].src = "images/bd_zoomout.gif"};
	if ( z > 1 )   {parent.theControl.document.images['ZoomOut'].src = "images/bi_zoomout.gif"};
}

// Funktion für den Bildwechsel der Schaltflächen:
// -----------------------------------------------------------------------------------------------------------------------------------

function ChangeImage(theVar){

   if (theVar == 'Suche') {		
		parent.theControl.document.images['Hotlink'].src = "images/bd_hot.gif";
		parent.theControl.document.images['Attribut'].src = "images/bd_info.gif";
		parent.theControl.document.images['ZoomOut'].src = "images/bi_zoomout.gif";
		parent.theControl.document.images['ZoomIn'].src = "images/bd_zoomin.gif";

   }

	
   Suche=parent.theControl.document.theForm.dieSuche.value;
   //if (Suche=='Z') {

	z = parseInt(parent.theControl.document.theForm.CurrentZ.value);

	if (z == 1)		{ bd = parseInt(parent.theControl.document.theForm.Zoom1i.value);
	} else if (z == 2)	{ bd = parseInt(parent.theControl.document.theForm.Zoom2i.value);
	} else if (z == 3)	{bd = parseInt(parent.theControl.document.theForm.Zoom3i.value);
	} else if (z == 4)	{bd = parseInt(parent.theControl.document.theForm.Zoom4i.value);
	} else if (z == 5)	{bd = parseInt(parent.theControl.document.theForm.Zoom5i.value);
	} else		{bd = parseInt(parent.theControl.document.theForm.Zoom1i.value) };

	if ( a == 0 && theVar == 'A') {
		if ( bd == 2 || bd == 3 ) {
			a = 1;
			document.images['Attribut'].src = "images/ba_info.gif";
			document.ControlForm.Att.value = 1;
			h = 0;
			if ( bd == 3 ) {
				document.images['Hotlink'].src = "images/bi_hot.gif";
				document.ControlForm.Hot.value = 0;
			}
			theVar = 'X';
		}
	}
	
	if ( a == 1 && theVar == 'A') {		
		if ( bd == 2 || bd == 3 ) {
			a = 0;
			document.images['Attribut'].src = "images/bi_info.gif";
			document.ControlForm.Att.value = 0;
			theVar = 'X';
		}
	}

	if ( h == 0 && theVar == 'H') {
		if ( bd == 1 || bd == 3 ) {
			h = 1;
			document.images['Hotlink'].src = "images/ba_hot.gif",
			document.ControlForm.Hot.value = 1;
			a = 0;
			if ( bd == 3 ) {
				document.images['Attribut'].src = "images/bi_info.gif";
				document.ControlForm.Att.value = 0;
			}
			theVar = 'X';
		}
	}

	if ( h == 1 && theVar == 'H') {		
		if ( bd == 1 || bd == 3 ) {
			h = 0;
			document.images['Hotlink'].src = "images/bi_hot.gif";
			document.ControlForm.Hot.value = 0;
			theVar = 'X';
		}
	}
    //}
}		


// Bestimmen der Werte für xin und yin::
// ------------------------------------------------------------------

function GetValues(){

if (z == 1)		{ xin = parent.theControl.document.theForm.Zoom1x.value; yin = parent.theControl.document.theForm.Zoom1y.value;
} else if (z == 2)	{ xin = parent.theControl.document.theForm.Zoom2x.value; yin = parent.theControl.document.theForm.Zoom2y.value;
} else if (z == 3)	{ xin = parent.theControl.document.theForm.Zoom3x.value; yin = parent.theControl.document.theForm.Zoom3y.value;
} else if (z == 4)	{ xin = parent.theControl.document.theForm.Zoom4x.value; yin = parent.theControl.document.theForm.Zoom4y.value;
} else if (z == 5)	{ xin = parent.theControl.document.theForm.Zoom5x.value; yin = parent.theControl.document.theForm.Zoom5y.value;
} else		{ xin = parent.theControl.document.theForm.Zoom1x.value; yin = parent.theControl.document.theForm.Zoom1y.value};
}


// Funktion zum Wechsel des Kartenausschnitts:
// ------------------------------------------------------------------

function ChangeMap(theVar){

   Suche = parent.theControl.document.theForm.dieSuche.value;
   weiter = "nein";   
   if (Suche=='Z') {weiter="ja"};
   if (Suche=='S' && theVar=='zoomout') {weiter = "ja"};

   if (weiter=="ja")  
   {
	AttributSel=0;

	GetValues();

	z = parseInt(parent.theControl.document.theForm.CurrentZ.value);
	x = parseInt(parent.theControl.document.theForm.CurrentX.value);
	y = parseInt(parent.theControl.document.theForm.CurrentY.value);

	theNrOfZooms = parseInt(parent.theControl.document.theForm.Zooms.value);

	if (isNaN(x)){x=0}; if (isNaN(y)){y=0}; if (isNaN(theNrOfZooms)){theNrOfZooms=1};

	if (theVar=='zoomin'){
		z = z + 1;
		if ( z <= theNrOfZooms){
			x = x * 2 ; y = y * 2 ;
			if (z  == 2){ x = x + 1; y = y + 1};
		} else {
			z = theNrOfZooms;
		}
		if ( z == 1 ) {bd = parseInt(parent.theControl.document.theForm.Zoom1i.value); SetDisabled(bd, z)};
		if ( z == 2 ) {bd = parseInt(parent.theControl.document.theForm.Zoom2i.value); SetDisabled(bd, z)};
		if ( z == 3 ) {bd = parseInt(parent.theControl.document.theForm.Zoom3i.value); SetDisabled(bd, z ) };
		if ( z == 4 ) {bd = parseInt(parent.theControl.document.theForm.Zoom4i.value); SetDisabled(bd, z ) };
		if ( z == 5 ) {bd = parseInt(parent.theControl.document.theForm.Zoom5i.value); SetDisabled(bd, z ) };

	}else if (theVar=='zoomout'){
		if ( z > 1 ) {
			z = z - 1;
			GetValues();
			if (isNaN(x)){x=0}; if (isNaN(y)){y=0};
			x = parseInt(x  / 2); y = parseInt(y  / 2);
			if (isNaN(x)){x=0}; if (isNaN(y)){y=0};
			if ( z == 1 ) { z = 1};
		}

		if ( x >= xin ) { x = xin-1 };
		if ( y >= yin ) { y = yin-1 };

		if ( z == 1 ) {bd = parseInt(parent.theControl.document.theForm.Zoom1i.value); SetDisabled(bd, z)};
		if ( z == 2 ) {bd = parseInt(parent.theControl.document.theForm.Zoom2i.value); SetDisabled(bd, z)};
		if ( z == 3 ) {bd = parseInt(parent.theControl.document.theForm.Zoom3i.value); SetDisabled(bd, z) };
		if ( z == 4 ) {bd = parseInt(parent.theControl.document.theForm.Zoom3i.value); SetDisabled(bd, z) };
		if ( z == 5 ) {bd = parseInt(parent.theControl.document.theForm.Zoom3i.value); SetDisabled(bd, z) };

		parent.theControl.document.theForm.dieSuche.value='Z';
		parent.theControl.document.images['Left'].src = "images/bi_left.gif";
		parent.theControl.document.images['Right'].src = "images/bi_right.gif";
		parent.theControl.document.images['Up'].src = "images/bi_up.gif";
		parent.theControl.document.images['Down'].src = "images/bi_down.gif";

	}else if (theVar=='up'){
		y = y - 1;
		if ( y < 0 ) { y = 0 };
	}else if (theVar=='down'){
		y = y + 1;
		if (y >= yin-1) {y = yin-1};
	}else if (theVar=='left'){
		x = x - 1;
		if ( x < 0 ) { x = 0 };
	}else if (theVar=='right'){
		x = x + 1;
		if (x >= xin-1) {x = xin-1};
	
// Funktion zur Anzeige eines bestimmten Kartenausschnitts über Städtewahl:
	}else {
		
		AttributSel=1;
		Koordinaten = theVar.split("_");
		x = Koordinaten[0];
		y = Koordinaten[1];
		
		

	}
	
	parent.theControl.document.theForm.CurrentZ.value=z;
	parent.theControl.document.theForm.CurrentX.value=x;
	parent.theControl.document.theForm.CurrentY.value=y;

	theDocumentName = 'maps/' + z  + x + '_' + y + '.htm';

	parent.theMap.location.href=theDocumentName;

	if(AttributSel==1){
		if (document.all){
		}
		else {
		MoveExtentValue(x,y);
		}
//		ShowLage();
		}
	else {
//		LageInvisible();
	}
	MoveExtentValue(x,y);

    }
}


// Funktion zur Anzeige des Tooltip-Textes:
// ------------------------------------------------------------------

function DrawTextBox(theVar,x,y,state) {

	if (state==0) 	{state='hidden';
	} else 		{state='visible'};

	if (document.all)
	{     
	if ( x > (parseInt(document.all['theMapImage'].style.width) - 100)) { x = x - 100 }
	document.all['Beschriftung'].style.visibility=state;
	document.all['Beschriftung'].style.left=parseInt(document.all['theMapImage'].style.left) + x;
	document.all['Beschriftung'].style.top=parseInt(document.all['theMapImage'].style.top) + y;
	document.all['Beschriftung'].innerHTML=theVar;
	}
	else
	{	

		if (document.getElementById)
		{
		theLay = document.getElementById('Beschriftung').style;
		theMapImg = document.getElementById('theMapImage').style;
		document.getElementById('Beschriftung').innerHTML=theVar;
		}
		else
		{
		theLay = document.layers['Beschriftung'];
		theMapImg = document.layers['theMapImage'];
		theLay.document.write(theVar);
		theLay.document.close();
		}

 		theLay.visibility=state;
		theLay.left=x;
		theLay.top=y;
		theLay.bgColor='#FFF8DC';
		theLay.fontSize='small';
	}
}


// Funktion zum Verschieben der Extent-Box in Übersichtskarte per Mausklick:
// ------------------------------------------------------------------------------------------------------

function MoveExtent(x,y) {

   Suche = parent.theControl.document.theForm.dieSuche.value;
   if (Suche=='Z') {

	z = parseInt(parent.theControl.document.theForm.CurrentZ.value);

	//LageInvisible();
	GetValues();

	if ( z == 1 ) {
		xx = parseInt(parent.theControl.document.theForm.BildX.value / xin);
		yy = parseInt(parent.theControl.document.theForm.BildY.value / yin);
		theXDiff = (parseInt(parent.theControl.document.theForm.BildX.value) - (xx * xin)) / xin ;
		theYDiff = (parseInt(parent.theControl.document.theForm.BildY.value) - (yy * yin)) / yin;
	} else {
		bx = parseInt(parent.theControl.document.theForm.BildX.value) + (parent.theControl.document.theForm.BildX.value / ( xin - 1));
		xx = parseInt( (bx / xin) + 0.5 );
		by = parseInt(parent.theControl.document.theForm.BildY.value) + (parent.theControl.document.theForm.BildY.value / ( yin - 1));
		yy = parseInt( (by / yin) + 0.5 );
		theXDiff = (bx - (xx * xin)) / xin;
		theYDiff = (by - (yy * yin)) / yin;
	}

	if (document.all){
		x=x-parseInt(document.all['theMapImage'].style.left);
		y=y-parseInt(document.all['theMapImage'].style.top);
	} else 
	{
		if (document.getElementById)
		{
		x=x-parseInt(document.getElementById('theMapImage').style.left);
		y=y-parseInt(document.getElementById('theMapImage').style.top);
		}
		else
		{
		x=x-parseInt(document.layers['theMapImage'].left);
		y=y-parseInt(document.layers['theMapImage'].top);
		}
	}

	if (z == 1) {
		xClick=parseInt(x / xx); yClick=parseInt(y / yy);
	} else {	
		if ( x > parseInt(parent.theControl.document.theForm.BildX.value)-( xx / 2 )) { xClick  = xin-1;
		} else { xClick=parseInt( x / (parseInt(parent.theControl.document.theForm.BildX.value) / xin) ) };
		if ( y > parseInt(parent.theControl.document.theForm.BildY.value)-( yy / 2 )) { yClick = yin-1;
		} else { yClick=parseInt( y / (parseInt(parent.theControl.document.theForm.BildY.value) / yin) ) };
	}
	if (isNaN(xClick)){xClick=0}; if (isNaN(yClick)){yClick=0};
	if (xClick > xin) {xClick=xin}; if (yClick > yin) {yClick=yin};

	xNum = parseInt(xClick); yNum = parseInt(yClick);
	
	if (isNaN(xNum)){xNum=0}; if (isNaN(yNum)){yNum=0};

	x = xClick;	y = yClick;

	xCorrect = parseInt(x * theXDiff); yCorrect = parseInt(y * theYDiff);

	if (isNaN(xCorrect)){xCorrect=0}; if (isNaN(yCorrect)){yCorrect=0};

	if (z == 1)	{ x = x  * xx; y = y * yy;
	} else 	{ x = ( x * xx ) - parseInt( xx / 2 );	y = ( y * yy ) - parseInt( yy / 2 )};

	if ( theXDiff == 1 ) 		{ x = x;
	} else if ( theXDiff < 1 ) 	{ x = x + xCorrect;
	} else if ( theXDiff > 1 ) 	{ x = x - xCorrect};

	if ( theYDiff == 1 ) 		{ y = y;
	} else if ( theYDiff < 1 ) 	{ y = y + yCorrect;
	} else if ( theYDiff > 1 ) 	{ y = y - yCorrect};

	if (document.all)
	{
	document.theExtentImage.width=xx+2;
     	document.theExtentImage.height=yy+2;
	if ( xx >= 30 ) {document.theExtentImage.src="../images/1px.gif"};
	if ( xx < 30 && xx >= 20 ) {document.theExtentImage.src="../images/2px.gif"};
	if ( xx < 20 && xx >= 10 ) {document.theExtentImage.src="../images/3px.gif"};
	if ( xx < 10 ) {document.theExtentImage.src="../images/4px.gif"};
	derExtent=document.all['theExtent'].style;
	derExtent.width = xx+2;
	derExtent.height = yy+2;
	derExtent.top=y+parseInt(document.all['theMapImage'].style.top);
	derExtent.left=x+parseInt(document.all['theMapImage'].style.left);
 	derExtent.visibility='visible';
	}
	else
	{
		if (document.getElementById)
		{
		derExt=document.getElementById('theExtent');
		theMapImg=document.getElementById('theMapImage');
		if ( xx >= 30) {derExt.innerHTML="<img src='../images/1px.gif' width=" + (xx+2) + " height=" + (yy+2) + ">"};	
		if ( xx < 30 && xx >= 20) {derExt.innerHTML="<img src='../images/2px.gif' width=" + (xx+2) + " height=" + (yy+2) + ">"};	
		if ( xx < 20 && xx >= 10) {derExt.innerHTML="<img src='../images/3px.gif' width=" + (xx+2) + " height=" + (yy+2) + ">"};	
		if ( xx < 10 ) {derExt.innerHTML="<img src='../images/4px.gif' width=" + (xx+2) + " height=" + (yy+2) + ">"};	
		derExtent=derExt.style;
		
		}
		else
		{
		derExtent=document.layers['theExtent'];
		theMapImg=document.layers['theMapImage'];
		if ( xx >= 30 ) {derExtent.document.write("<img src='../images/1px.gif' width=" + (xx+2) + " height=" + (yy+2) + ">")};	
		if ( xx < 30 && xx >= 20) {derExtent.document.write("<img src='../images/2px.gif' width=" + (xx+2) + " height=" + (yy+2) + ">")};	
		if ( xx < 20 && xx >= 10) {derExtent.document.write("<img src='../images/3px.gif' width=" + (xx+2) + " height=" + (yy+2) + ">")};	
		if ( xx < 10 ) {derExtent.document.write("<img src='../images/4px.gif' width=" + (xx+2) + " height=" + (yy+2) + ">")};
		derExtent.document.close();
		}	

		derExtent.width=xx+2;
		derExtent.height=yy+2;
		derExtent.top=y+15;
		derExtent.left=x+15;
 		derExtent.visibility='visible';
	}

	parent.theControl.document.theForm.CurrentX.value=xNum;
	parent.theControl.document.theForm.CurrentY.value=yNum;
	theDocumentName =  z + '' + xNum + '_' + yNum + '.htm';
	parent.theMap.location.href=theDocumentName;
   }
}

// Funktion zum Verschieben der Extent-Box in Übersichtskarte über Richtungstasten:
// -----------------------------------------------------------------------------------------------------------------

function MoveExtentValue(x,y) {

	z = parseInt(parent.theControl.document.theForm.CurrentZ.value);

	if (z == 1){
		xin = parent.theControl.document.theForm.Zoom1x.value;
 		yin = parent.theControl.document.theForm.Zoom1y.value;
		bd = parseInt(parent.theControl.document.theForm.Zoom1i.value);
	}else if (z == 2){
		xin = parent.theControl.document.theForm.Zoom2x.value;
 		yin = parent.theControl.document.theForm.Zoom2y.value;
		bd = parseInt(parent.theControl.document.theForm.Zoom2i.value);
	}else if (z == 3){
		xin = parent.theControl.document.theForm.Zoom3x.value;
 		yin = parent.theControl.document.theForm.Zoom3y.value;
		bd = parseInt(parent.theControl.document.theForm.Zoom3i.value);
	}else if (z == 4){
		xin = parent.theControl.document.theForm.Zoom4x.value;
 		yin = parent.theControl.document.theForm.Zoom4y.value;
		bd = parseInt(parent.theControl.document.theForm.Zoom4i.value);
	}else if (z == 5){
		xin = parent.theControl.document.theForm.Zoom5x.value;
 		yin = parent.theControl.document.theForm.Zoom5y.value;
		bd = parseInt(parent.theControl.document.theForm.Zoom5i.value);
	}else{
		xin = parent.theControl.document.theForm.Zoom1x.value;
 		yin = parent.theControl.document.theForm.Zoom1y.value;
		bd = parseInt(parent.theControl.document.theForm.Zoom1i.value);
	}

	if ( z == 1 ) {
		xx = parseInt(parent.theControl.document.theForm.BildX.value / xin);
		yy = parseInt(parent.theControl.document.theForm.BildY.value / yin);
		theXDiff = (parseInt(parent.theControl.document.theForm.BildX.value) - (xx * xin)) / xin ;
		theYDiff = (parseInt(parent.theControl.document.theForm.BildY.value) - (yy * yin)) / yin;
	} else {
		bx = parseInt(parent.theControl.document.theForm.BildX.value) + (parent.theControl.document.theForm.BildX.value / ( xin - 1));
		xx = parseInt( (bx / xin) + 0.5 );
		by = parseInt(parent.theControl.document.theForm.BildY.value) + (parent.theControl.document.theForm.BildY.value / ( yin - 1));
		yy = parseInt( (by / yin) + 0.5 );
		theXDiff = (bx - (xx * xin)) / xin;
		theYDiff = (by - (yy * yin)) / yin;
	}

	xCorrect = parseInt(x * theXDiff); yCorrect = parseInt(y * theYDiff);
	if (isNaN(xCorrect)){xCorrect=0}; if (isNaN(yCorrect)){yCorrect=0};

	if (z == 1)	{ x = x  * xx; y = y * yy;
	} else 	{ x = ( x * xx ) - parseInt( xx / 2 );	y = ( y * yy ) - parseInt( yy / 2 )};

	if ( theXDiff == 1 ) 		{ x = x;
	} else if ( theXDiff < 1 ) 	{ x = x + xCorrect;
	} else if ( theXDiff > 1 ) 	{ x = x - xCorrect};

	if ( theYDiff == 1 ) 		{ y = y;
	} else if ( theYDiff < 1 ) 	{ y = y + yCorrect;
	} else if ( theYDiff > 1 ) 	{ y = y - yCorrect};


	if (document.all)
	{
	parent.theOverview.document.theExtentImage.width=xx+2;
     	parent.theOverview.document.theExtentImage.height=yy+2;
	if ( xx >= 30 ) {parent.theOverview.document.theExtentImage.src="../images/1px.gif"};
	if ( xx < 30 && xx >= 20 ) {parent.theOverview.document.theExtentImage.src="../images/2px.gif"};
	if ( xx < 20 && xx >= 10 ) {parent.theOverview.document.theExtentImage.src="../images/3px.gif"};
	if ( xx < 10 ) {parent.theOverview.document.theExtentImage.src="../images/4px.gif"};
	derExtent=parent.theOverview.document.all['theExtent'].style;
	derExtent.width = xx+2;
	derExtent.height = yy+2;
	derExtent.top=y+parseInt(parent.theOverview.document.all['theMapImage'].style.top);
	derExtent.left=x+parseInt(parent.theOverview.document.all['theMapImage'].style.left);
 	derExtent.visibility='visible';
	}

	else
		{
		if (document.getElementById)
		{
		derExt=parent.theOverview.document.getElementById('theExtent');
		theMapImg=parent.theOverview.document.getElementById('theMapImage');

		if ( xx >= 30) {derExt.innerHTML="<img src='../images/1px.gif' width=" + (xx+2) + " height=" + (yy+2) + ">"};	
		if ( xx < 30 && xx >= 20) {derExt.innerHTML="<img src='../images/2px.gif' width=" + (xx+2) + " height=" + (yy+2) + ">"};	
		if ( xx < 20 && xx >= 10) {derExt.innerHTML="<img src='../images/3px.gif' width=" + (xx+2) + " height=" + (yy+2) + ">"};	
		if ( xx < 10 ) {derExt.innerHTML="<img src='../images/4px.gif' width=" + (xx+2) + " height=" + (yy+2) + ">"};	
		derExtent=derExt.style;

		} 
		else
		{
		derExtent=parent.theOverview.document.layers['theExtent'];
		theMapImg=parent.theOverview.document.layers['theExtent'];
		if ( xx >= 30 ) {derExtent.document.write("<img src='../images/1px.gif' width=" + (xx+2) + " height=" + (yy+2) + ">")};	
		if ( xx < 30 && xx >= 20) {derExtent.document.write("<img src='../images/2px.gif' width=" + (xx+2) + " height=" + (yy+2) + ">")};	
		if ( xx < 20 && xx >= 10) {derExtent.document.write("<img src='../images/3px.gif' width=" + (xx+2) + " height=" + (yy+2) + ">")};	
		if ( xx < 10 ) {derExtent.document.write("<img src='../images/4px.gif' width=" + (xx+2) + " height=" + (yy+2) + ">")};
		derExtent.document.close();
		}		
		
		derExtent.width=xx+2;
		derExtent.height=yy+2;
		derExtent.top=y+15;
		derExtent.left=x+15;
 		derExtent.visibility='visible';
		
	}
}


// Function für Hotlinks: 
// ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
	function GetExt(theHotlink, theAttributs){
		
		if (parseInt(parent.theControl.document.ControlForm.Hot.value) == 1 && theHotlink !='None') {

		if (theHotlink.substr(0,4).toLowerCase() == 'http'){
			F1 = window.open(theHotlink,"_blank");
		} else if (theHotlink.search(/\./)!=-1) {
			F1 = window.open("../hotlink/" + theHotlink,"_blank");
		} else if  (theHotlink.indexOf("@") > 0){
			parent.document.location.href = "mailto:" + theHotlink;
		 } else if (theHotlink.lastIndexOf("htm") > -1){
			F1 = window.open("../hotlink/" + theHotlink,"_blank");

		} else {

			if ( document.all) {
					F1 = open("../hotlink/"+theHotlink+".htm","Fenster1","width=40,height=40,screenX=0,screenY=0,menubar=no,resizable=yes"); 
				} else {
					F1 = open("../hotlink/"+theHotlink+".htm","_blank","menubar=no,resizable=yes"); 	
				}	
			}
		}

		if (parseInt(parent.theControl.document.ControlForm.Att.value) == 1&& theAttributs != 'None' ) {
			confirm(theAttributs);
		}
	}



function LayerVis() {

vismap = parent.theControl.document.theForm.theMapImage.value;




if (document.all)
{     	
parent.theMap.document.all['theMapImage'].style.visibility=vismap;




}
else
{
	if (document.getElementById)
	{
	parent.theMap.document.getElementById('theMapImage').style.visibility=vismap;



	}
	else
	{
	parent.theMap.document.layers['theMapImage'].visibility=vismap;



	}

}
}


function changeLay(theLay) {
  if (parent.theHeader.document.forms[0].elements[theLay-1].checked)
    SetVis = 'visible';
  else
    SetVis = 'hidden';


  if (theLay==1) {
     parent.theControl.document.theForm.theLay1.value=SetVis;
}
  if (theLay==2) {
     parent.theControl.document.theForm.theLay2.value=SetVis;
}
  if (theLay==3) {
     parent.theControl.document.theForm.theLay3.value=SetVis;
}

  LayerVis();

}



function SelectAttribute(laycount)  {

dieObjekte = new Array();
dieLagen = new Array();
dieLagekoord = new Array();

dieObjekte2 = new Array();
dieLagen2 = new Array();
dieLagekoord2 = new Array();

dieObjekte3 = new Array();
dieLagen3 = new Array();
dieLagekoord3 = new Array();

dieObjekte4 = new Array();
dieLagen4 = new Array();
dieLagekoord4 = new Array();

dieObjekte5 = new Array();
dieLagen5 = new Array();
dieLagekoord5 = new Array();


z = parent.theControl.document.theForm.CurrentZ.value;

var objekte = new Array();
var dieKoordinaten = "";
var Lagekoord = "";
var HTMLName = "";

if (laycount==1){
	objekte = dieObjekte;
	dieLagekoord = dieLagekoord;
	lagen = dieLagen;
}
if (laycount==2){
	objekte = dieObjekte2;
	dieLagekoord = dieLagekoord2;
	lagen = dieLagen2;
}


for (i=0;i<parent.theHeader.document.forms[laycount].elements[0].length;++i)
{
     if (parent.theHeader.document.forms[laycount].elements[0].options[i].selected == true) {
		var dasObjekt = parent.theHeader.document.forms[laycount].elements[0].options[i].value
		}
}

for (i=0;i<lagen.length;++i)
{
	var objekteintrag = lagen[i];
 
	if  (objekteintrag==dasObjekt) {
		//dieKoordinaten = dieLagen[i];
		Lagekoord = dieLagekoord[i];
		HTMLName = objekte[i];
	}
}

parent.theControl.document.theForm.ShowLage.value='visible';
parent.theControl.document.theForm.LageKoord.value=Lagekoord;

theDocumentName = 'maps/' + HTMLName + '.htm';
parent.theMap.location.href=theDocumentName;

parent.theControl.document.theForm.dieSuche.value = "S";

bd = parseInt(parent.theControl.document.theForm.Zoom1i.value);
SetDisabled(bd, z);

parent.theControl.document.images['ZoomOut'].src = "images/bi_zoomout.gif";
parent.theControl.document.images['ZoomIn'].src = "images/bd_zoomin.gif";
parent.theControl.document.images['Left'].src = "images/bd_left.gif";
parent.theControl.document.images['Right'].src = "images/bd_right.gif";
parent.theControl.document.images['Up'].src = "images/bd_up.gif";
parent.theControl.document.images['Down'].src = "images/bd_down.gif";

//ChangeMap(dieKoordinaten);


ShowLage();
}



function ShowLage()  {
	state=parent.theControl.document.theForm.ShowLage.value;

	Lagekoord=parent.theControl.document.theForm.LageKoord.value;

	Lagen=Lagekoord.split("_");
	xmin=Lagen[0];
	ymin=Lagen[1];
	xmax=Lagen[2];
	ymax=Lagen[3];

	xdiff=xmax-xmin;
	ydiff=ymax-ymin;
	theMax = xdiff;
	if (ydiff > xdiff)
	{
	theMax=ydiff;
	}

   Suche=parent.theControl.document.theForm.dieSuche.value;
   if (document.all)
	{
	if (Suche=="S")  {
        theDoc=parent.theOverview.document;
	theDoc.theExtentImage.src="../images/obj1.gif";
	theDoc.theExtentImage.width=xmax-xmin;
	theDoc.theExtentImage.width=ymax-ymin;

	dieLage1=theDoc.all['theExtent'].style;
	dieLage1.visibility='visible'  //state;
	dieLage1.left=Number(xmin)+15;
	dieLage1.top=Number(ymin)+15;
	theDoc.theExtentImage.width=xmax-xmin;
	theDoc.theExtentImage.height=ymax-ymin;
	}	
	}
   else

	{
	if (Suche=="S")  {

	theDoc=parent.theOverview.document;

	if (document.getElementById)
	{
	Lag1=theDoc.getElementById('theExtent');
	Lag1.innerHTML="<img src='../images/obj1.gif' width=" + xdiff + " height=" + ydiff + ">";	
	dieLage1=Lag1.style;
	}
	else
	{
	dieLage1=theDoc.layers['theExtent'];
	dieLage1.document.write("<img src='../images/2px.gif' width=" + xdiff + " height=" + ydiff + ">");	
	dieLage1.document.close();
	}

	dieLage1.visibility=state;
	dieLage1.left=Number(xmin)+15;
	dieLage1.top=Number(ymin)+15;
	
	}
   }
}


function ShowPrint() {

	printz = parseInt(parent.theControl.document.theForm.CurrentZ.value);
	printx = parseInt(parent.theControl.document.theForm.CurrentX.value);
	printy = parseInt(parent.theControl.document.theForm.CurrentY.value);
	bildw = parseInt(parent.theControl.document.theForm.BildX.value);
	bildh = parseInt(parent.theControl.document.theForm.BildY.value);

	//alert("Eine Druckvorlage wird erstellt. Bitte benutzen Sie dann zum ausdrucken der Karte die Druckfunktionalität Ihres Browsers.");

	var mapind = parent.theMap.document.MapImage.src.lastIndexOf("maps");
	var theDir = parent.theMap.document.MapImage.src.substring(0,mapind);

	var Win1 = open("","PrintPage");
	Win1.document.writeln('<html><head>');
	Win1.document.writeln('<link rel="stylesheet" type="text/css" href="' + theDir + 'layout.css">');
	Win1.document.writeln('</head>');

	Win1.document.writeln('<body class="print">');
	Win1.document.writeln('<FONT FACE="Arial"><B>');
	Win1.document.writeln('<TABLE class="mapprint">');
	Win1.document.writeln('	<TR>');
	Win1.document.write('		<TD class="print" WIDTH=' + bildw + ' HEIGHT=' + bildh);

	Win1.document.writeln('>');
	Win1.document.writeln('			<IMG SRC="' + parent.theMap.document.MapImage.src + '" HSPACE=0 VSPACE=0 BORDER=0 ALT="">');
	Win1.document.writeln('		</TD>');

	Win1.document.writeln('		<TD class="print">');

	Win1.document.writeln('<TABLE class="legendprint">');

Win1.document.writeln('<table>'); 
// Win1.document.writeln('<tr><td class=legendimageprint></td><td class=legendthemeprint>Green Belt Areas (Label Point)</td></tr>');
// Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/1_1.jpg></td><td class=legendclassprint></td></tr>');
Win1.document.writeln('<tr><td class=legendimageprint></td><td class=legendthemeprint>Green Belt Areas (Point)</td></tr>');
Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/5_1.jpg></td><td class=legendclassprint>Core Area</td></tr>');
Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/5_2.jpg></td><td class=legendclassprint>Cluster of Stepping Stones</td></tr>');
Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/5_3.jpg></td><td class=legendclassprint>Linear Corridor</td></tr>');
Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/5_4.jpg></td><td class=legendclassprint>Satellites of Core Area</td></tr>');
Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/5_5.jpg></td><td class=legendclassprint>Other Protected Sites</td></tr>');
// by lulu Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/4_1.jpg></td><td class=legendclassprint></td></tr>');
// Win1.document.writeln('<tr><td class=legendimageprint></td><td class=legendthemeprint>grbgalneu2</td></tr>');
// Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/5_1.jpg></td><td class=legendclassprint></td></tr>');
// Win1.document.writeln('<tr><td class=legendimageprint></td><td class=legendthemeprint>simkmnrsithrhu</td></tr>');
// Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/6_1.jpg></td><td class=legendclassprint></td></tr>');
// Win1.document.writeln('<tr><td class=legendimageprint></td><td class=legendthemeprint>denoltruatczsk</td></tr>');
// Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/7_1.jpg></td><td class=legendclassprint></td></tr>');
// Win1.document.writeln('<tr><td class=legendimageprint></td><td class=legendthemeprint>Green Belt Areas (Polygon Detail)</td></tr>');
Win1.document.writeln('<tr><td class=legendimageprint></td><td class=legendthemeprint>Green Belt Areas (Polygons)</td></tr>');
Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/8_1.jpg></td><td class=legendclassprint>Core Area</td></tr>');
Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/8_2.jpg></td><td class=legendclassprint>Cluster of Stepping Stones</td></tr>');
Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/8_3.jpg></td><td class=legendclassprint>Linear Corridor</td></tr>');
Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/8_4.jpg></td><td class=legendclassprint>Satellites of Core Areas</td></tr>');
Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/8_5.jpg></td><td class=legendclassprint>Other Protected Sites</td></tr>');
Win1.document.writeln('<tr><td class=legendimageprint></td><td class=legendthemeprint>European Big Cities</td></tr>');
Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/6_1.jpg></td><td class=legendclassprint>5,000,000 and greater</td></tr>');
Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/6_2.jpg></td><td class=legendclassprint>1,000,000 to 5,000,000</td></tr>');
Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/6_3.jpg></td><td class=legendclassprint>500,000 to 1,000,000</td></tr>');
Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/7_1.jpg></td><td class=legendthemeprint>Green Belt</td></tr>');
Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/9_1.jpg></td><td class=legendthemeprint>Green Belt Buffer 25 km</td></tr>');
// by lulu Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/9_1.jpg></td><td class=legendclassprint></td></tr>');
// Win1.document.writeln('<tr><td class=legendimageprint></td><td class=legendthemeprint>overlay</td></tr>');
// Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/10_1.jpg></td><td class=legendclassprint></td></tr>');
// Win1.document.writeln('<tr><td class=legendimageprint></td><td class=legendthemeprint>Countries</td></tr>');
// Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/11_1.jpg></td><td class=legendclassprint></td></tr>');
// Win1.document.writeln('<tr><td class=legendimageprint></td><td class=legendthemeprint>Major Water (Label)</td></tr>');
// Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/12_1.jpg></td><td class=legendclassprint></td></tr>');
Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/13_1.jpg></td><td class=legendthemeprint>Major Water</td></tr>');
// by lulu Win1.document.writeln('<tr><td class=legendimageprint><img src=legend/13_1.jpg></td><td class=legendclassprint></td></tr>');
// Win1.document.writeln('<tr><td class=legendimageprint></td><td class=legendthemeprint>Physical Map</td></tr>');
Win1.document.writeln('</table>');


	Win1.document.writeln('</TABLE>');
	Win1.document.writeln('		</TD></TR></Table>');

	Win1.document.writeln('</body></html>');
	Win1.document.close();
	
	Win1=null;

}


