function login() {
	document.getElementById('loginbg').style.display = "block";
	document.getElementById('loginform').style.display = "block";
}

function hidelogin() {
	document.getElementById('loginbg').style.display = "none";
	document.getElementById('loginform').style.display = "none";
}

function replaceHeadlines(s, f) {
	for (var i=0; i<document.getElementsByTagName(s).length; i++) {
		obj = document.getElementsByTagName(s)[i];
		txt = obj.innerHTML;
		if (txt.substr(0,4) != "<img" && txt.substr(0,4) != "<IMG") {
			txt = txt.split("&").join("QQamp;");
			txt = txt.split("<").join("QQlt;");
			txt = txt.split(">").join("QQgt;");
			txt = txt.split('"').join("QQquot;");
			width = obj.offsetWidth;
			if (s == "H1") {
				height = 40;
			} else if (s == "H2") {
				height = 30;
			} else if (s == "H3") {
				height = 24;
			}
			if (navigator.appVersion.indexOf("MSIE") != -1) {
				str  = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'">';
				str += '<param name="movie" value="flash/hl.swf?" />';
				str += '<param name="quality" value="high" />';
				str += '<param name="wmode" value="transparent" />';
				str += '<param name="flashvars" value="s='+s+'&txt='+txt+'&w='+width+'&h='+height+'" />';
				str += '</object>';
			} else {
				str  = '<embed src="flash/hl.swf" flashvars="s='+s+'&txt='+txt+'&w='+width+'&h='+height+'" wmode="transparent" quality="high" width="'+width+'" height="'+height+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
			}
			obj.innerHTML = str;
		}
	}
}

function listapo() {
	val = document.getElementById('stadt').value;
	while (document.getElementById('apotheke').options.length > 0) {
		document.getElementById('apotheke').remove(0);
	}
	document.getElementById('apotheke').options[0] = new Option("BITTE AUSWÄHLEN", "null");
	for (var i=0; i<apo[val].length; i++) {
		txt = apo[val][i][1];
		txt = txt.split("&#39;").join("'");
		document.getElementById('apotheke').options[i+1] = new Option(txt, apo[val][i][0]);
		if (apotheke == apo[val][i][0]) {
			document.getElementById('apotheke').selectedIndex = i+1;
			apotheke = "";
		}
	}
}

function checkapo() {
	if (document.getElementById('apotheke').value != "null") {
		document.getElementById('formular').style.visibility = "visible";
	}
}

window.onload = function() {
	//replaceHeadlines("H1");
	//replaceHeadlines("H2");
	//replaceHeadlines("H3");
	
	if (document.getElementsByName('vname').length > 0) {
		document.getElementsByName('vname')[0].focus();
	} else if (document.getElementsByName('plz').length > 0) {
		document.getElementsByName('plz')[0].focus();
	} else if (document.getElementsByName('login').length > 0) {
		document.getElementsByName('login')[0].focus();
	}
	if (document.getElementById('apotheke') != null) {
		listapo();
		if (submit == "1") {
			document.getElementById('formular').style.visibility = "visible";
		}
	}
	/*
	if (document.getElementById('loginbg').style.filter != undefined) {
		document.getElementById('loginbg').style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='imgs/login.png', sizingMethod='scale')";
	} else {
		document.getElementById('loginbg').style.backgroundImage = "url(imgs/login.png)";
	}
	var x = (document.documentElement.clientWidth-260)/2;
	var y = (document.documentElement.clientHeight-220)/3;
	document.getElementById('loginbg').style.left = x+'px';
	document.getElementById('loginbg').style.top = y+'px';
	document.getElementById('loginform').style.left = x+'px';
	document.getElementById('loginform').style.top = y+'px';
	*/
}
