var baseHref = document.getElementsByTagName('base')[0] ? document.getElementsByTagName('base')[0].href : ''; 
var myInterval = null;

function openLangs() {
	document.getElementById('language_dropdown').style.display = 'block';
	document.getElementById('language_dropdown').onmouseover = setMouse;
}
function setMouse() {
	document.getElementById('language_dropdown').onmouseout = intervalClose;
	if(myInterval != null) clearInterval(myInterval); 
}
function intervalClose() {
	myInterval = window.setInterval('closeLangs()', 1000);
}
function closeLangs() {
	document.getElementById('language_dropdown').style.display = 'none';
	clearInterval(myInterval); 
}
function openpano(pano){
	var args = openpano.arguments;
	var lang  = typeof(args[1]) == "undefined" ? 'de' : args[1];
	lang = '&lang=' + lang;
	var popup = window.open(baseHref + 'fileadmin/panoramas/panorama.php?pano=' + pano + lang,'win','width=450,height=440');
	popup.focus();
}
function openpano360(pano){
	var args = openpano360.arguments;
	var lang  = typeof(args[1]) == "undefined" ? 'de' : args[1];
	lang = '&lang=' + lang;
	var popup = window.open(baseHref + 'fileadmin/panoramas/panorama360.php?pano=' + pano + lang,'win','width=800,height=540');
	popup.focus();
}
function popupopen () {
	var args = popupopen.arguments;
	var name   = typeof(args[0]) == "undefined" ? "images/spacer.gif" : args[0];
	var width  = typeof(args[1]) == "undefined" ? 100 : args[1];
	var height = typeof(args[2]) == "undefined" ? 100 : args[2];
	var title  = typeof(args[3]) == "undefined" || args[3] == ''  ? "Details" : args[3];
	var wname  = typeof(args[4]) == "undefined" || args[4] == '' ? "win" : args[4];
	if (!leftpos || !toppos) {
		var leftpos = (screen.height - height)/2;
		var toppos  = (screen.width - width)/2;
	}
	win = window.open("","" + wname + "","width=" + width + ",height=" + height + ",left=" + toppos + ",top=" + leftpos);
	win.resizeTo(width, height+80);
	win.document.open();
	win.document.write('<html><head><title>' + title + '</title><meta http-equiv="imagetoolbar" content="no" /></head>');
	win.document.write('<body style="margin:0;" onblur="self.close();">'); 
	var alt = (title != "Details") ? title : "";
	win.document.write('<img src="' + baseHref + name + '" width="' + width + '" height="' + height + '" alt="' + alt + '" />');
	win.document.write('</body></html>');
	win.document.close();
	win.focus();
}
