// JavaScript Document

var aDivState = new Array();
var aLocationCityState = new Array();

function DanubiusOpenDiv(iIndex, oAhref) {

	if(iIndex==1) {
		oDiv = document.getElementById("danubius_searcher_" + iIndex);
		if(oDiv.style.display=="block") {
			if(DanubiusOpenLocationCity_CheckIfAnyOpen()) {
				DanubiusOpenLocationCity_CloseAll();
				return false;
			}
		}
	}

	for(var i=1; i<=3; i++) {
		oDiv = document.getElementById("danubius_searcher_" + i);
		if(oDiv) {
			if(i==iIndex) {
				if(aDivState[i] && aDivState[i]==1) {
					oDiv.style.display = "none";
					aDivState[i] = 0;
				}
				else {
					oDiv.style.display = "block";
					aDivState[i] = 1;
				}
			}
			else {
				oDiv.style.display = "none";
				aDivState[i] = 0;
			}
		}
	}
	DanubiusOpenLocationCity_CloseAll();
	if(oAhref) oAhref.blur();
	
	return false;
}

function DanubiusOpenLocationCity(iCityID, oAhref) {
	var a = document.getElementsByTagName("DIV");
	if(a && a.length) for(var i=0; i<=a.length-1; i++) {
		if(a[i].id && a[i].id.search(/^danubius\_locationcity\_[0-9]+/)!=-1) {
			x = a[i].id.split("_");
			id = x[2];
			if(id==iCityID) {
				if(aLocationCityState[id] && aLocationCityState[id]==1) {
					a[i].style.display = "none";
					aLocationCityState[id] = 0;
				}
				else {
					a[i].style.display = "block";
					aLocationCityState[id] = 1;
				}
			}
			else {
				a[i].style.display = "none";
				aLocationCityState[id] = 0;
			}
		}
	}
	if(oAhref) oAhref.blur();
	
	return false;
}

function DanubiusOpenLocationCity_CloseAll() {
	var a = document.getElementsByTagName("DIV");
	if(a && a.length) for(var i=0; i<=a.length-1; i++) {
		if(a[i].id && a[i].id.search(/^danubius\_locationcity\_[0-9]+/)!=-1) {
			x = a[i].id.split("_");
			id = x[2];
			a[i].style.display = "none";
			aLocationCityState[id] = 0;
		}
	}
}
function DanubiusOpenLocationCity_CheckIfAnyOpen() {
	var a = document.getElementsByTagName("DIV");
	if(a && a.length) for(var i=0; i<=a.length-1; i++) {
		if(a[i].id && a[i].id.search(/^danubius\_locationcity\_[0-9]+/)!=-1) {
			if(a[i].style.display=="block") return true;
		}
	}
	else return false;
}
