function openWindow(location, width, height, name, toolbar, scrollbars, status, resizable, otherAttrib)
{
	//openWindow object properties
	this.location=(location != null) ? location:'#';
	this.width=(width != null) ? width:'666';
	this.height=(height != null) ? height:'684';
	this.name=(name != null) ? name:'HypoVereinsbank';
	this.toolbar=(toolbar != null) ? toolbar:'0';
	this.scrollbars=(scrollbars != null) ? scrollbars:'0';
	this.status=(status != null) ? status:'0';
	this.resizable=(resizable != null) ? resizable:'no';
	this.otherAttrib=(otherAttrib != null) ? otherAttrib:'';
	this.screenWidth=screen.width;
	this.screenHeight=screen.height;
	this.leftPos=(this.screenWidth/2)-(this.width/2);
	this.topPos=(this.screenHeight/2)-(this.height/2);

	//open method opens a window in the center of the screen
	this.open=function()
	{
		this.name = window.open(this.location, this.name, 'toolbar='+this.toolbar+',status='+this.status+',scrollbars='+this.scrollbars+',resizable='+this.resizable+','+this.otherAttrib+',left='+this.leftPos+',top='+this.topPos+',height='+this.height+',width='+this.width);
	}
}

function initFilialsuche(sUrl)
{
	var iFilialsucheWidth = 666;
	var iFilialsucheHeight = 684;
	var oWin = new openWindow(sUrl, iFilialsucheWidth, iFilialsucheHeight, 'Filialsuche');
	oWin.open();
}

var tbodyId = 'route-tbody';

function hoverRoute()
{
	if (document.getElementById && document.createTextNode) {
		tbodyroot = document.getElementById(tbodyId);
		for (i=0; i<tbodyroot.childNodes.length; i++) {
			node = tbodyroot.childNodes[i];
			if (node.nodeName == 'TR') {
				node.onmouseover = function()
				{
					this.className += this.className?' hover':'hover';
				}
				node.onmouseout = function()
				{
					this.className = this.className.replace('hover');
				}
				node.onclick = function()
				{
					var sRef = this.getElementsByTagName('a')[0].href;
					window.location = sRef;

				}
			}
		}
	}
}


/**
 *ermittelt die absolute Position eines DIV-Elementes im Browser
 */
		function getPosition(id)
		{
			var obj = document.getElementById(id);
			var pos = {left:0, top:0};

			if(typeof obj.offsetLeft != 'undefined') {

				while (obj) {
					pos.left += obj.offsetLeft;
					pos.top += obj.offsetTop;
					obj = obj.offsetParent;
				}
			} else {
				pos.left = obj.left;
				pos.top = obj.top;
			}
			return pos;
		}


/**
 *berücksichtigt Offsets (für die Pan-Leiste) im Parent-Objekt
 */
function setPositionOfPoi(parentId, myId, xInMap, yInMap, zIndex) {
	var parentDiv = document.getElementById(parentId);
	if(parentDiv) {
		var offX = parentDiv.offsetLeft;
		var offY = parentDiv.offsetTop;
	}

	var poiDiv = document.getElementById(myId);
	if(poiDiv) {

		var left = xInMap + offX;
		var top = yInMap + offY;

		//einblenden, nur wenn innerhalb
		if(left < parseInt(parentDiv.width)
		   && top < parseInt(parentDiv.height)
		   && left > parentDiv.offsetLeft
		   && top > parentDiv.offsetTop) {

				poiDiv.style.left = left + "px";
				poiDiv.style.top = top + "px";
				poiDiv.style.zIndex = zIndex;

				//Backreferenz auf die Objekte
				if(!parentDiv.backRefs) parentDiv.backRefs = [];
				parentDiv.backRefs.push(poiDiv);
		}
	}
}


/**
 *wird beim Event onload aufgerufen
 *erfordert globale Variable mit id "theMap"
 */
function setPoisVisible() {
	if(theMap && theMap.backRefs) {
		for(var i=0; i<theMap.backRefs.length; i++) {

			   theMap.backRefs[i].style.visibility = "visible";

		}
	}
}

/**
 *interface-abhängige Funktion
 *der automatisiert generierter Call wird zerlegt, der GET-Parameter SHP wird ersetzt und
 *ein neuer Parameter ROUTETYP wird angehängt
 */
function getNewRouteMapCall(call, routeTyp) {
	var newCall = "";
	var params = call.split("&");

	for(var i=0; i<params.length; i++) {
		//ein parameter ,z.b. "X=1"
		var param = params[i];

		//ein paar, d.h. array enthält pair[0] = "X", pair[1] = 1
		var pair = param.split("=");

		//bisherige Parameter werden zurückgesetzt, da route neu gerechnet werden soll
		if(pair[0] == "SHP" || pair[0] == "ROUTETYP"
			|| pair[0] == "EXL" || pair[0] == "EXR"
			|| pair[0] == "EXT" || pair[0] == "EXB"
			|| pair[0] == "BLG") {
			continue;
		}

		newCall += (newCall == "") ? "" : "&";
		newCall += pair[0] + "=" + pair[1];
	}

	newCall += "&ROUTETYP=" + routeTyp;
	return newCall;
}



/*
Laden einer Detailkarte für die Wegbeschreibung
alter extent wird durch den neuen ersetzt
*/
function getNewDetailMapCall(call, left, right, top, bottom) {

	var newCall = "";
	var params = call.split("&");

	for(var i=0; i<params.length; i++) {
		//ein parameter ,z.b. "X=1"
		var param = params[i];

		//ein paar, d.h. array enthält pair[0] = "X", pair[1] = 1
		var pair = param.split("=");

		if(pair.length == 0) {
			newCall += param;
			continue;
		}

		//bisherige Parameter werden zurückgesetzt, da route neu gerechnet werden soll
		switch(pair[0]) {
			case "EXL":
				pair[1] = left;
				break;
			case "EXR":
				pair[1] = right;
				break;
			case "EXT":
				pair[1] = top;
				break;
			case "EXB":
				pair[1] = bottom;
				break;
			default:
		}

		newCall += (newCall == "") ? "" : "&";
		newCall += pair[0] + "=" + pair[1];
	}

	return newCall;
}



