var ImgNavboxPfeil = new Array();
ImgNavboxPfeil["tourismus"] = "navi_pfeil_over_tou.gif";
ImgNavboxPfeil["tourismus_r"] = "navi_pfeilr_over_tou.gif";
ImgNavboxPfeil["kur"] = "navi_pfeil_over_kur.gif";
ImgNavboxPfeil["kur_r"] = "navi_pfeilr_over_kur.gif";
ImgNavboxPfeil["kompetenz"] = "navi_pfeil_over_kom.gif";
ImgNavboxPfeil["kompetenz_r"] = "navi_pfeilr_over_kom.gif";
ImgNavboxPfeil["frei"] = "navi_pfeil_over_frei.gif";
ImgNavboxPfeil["frei_r"] = "navi_pfeilr_over_frei.gif";
ImgNavboxPfeil["ver"] = "navi_pfeil_over_ver.gif";
ImgNavboxPfeil["ver_r"] = "navi_pfeilr_over_ver.gif";
ImgNavboxPfeil["buerger"] = "navi_pfeil_over_buerger.gif";
ImgNavboxPfeil["buerger_r"] = "navi_pfeilr_over_buerger.gif";
ImgNavboxPfeil["wirt"] = "navi_pfeil_over_buerger.gif";
ImgNavboxPfeil["wirt_r"] = "navi_pfeilr_over_buerger.gif";
ImgNavboxPfeil["branchen"] = "navi_pfeil_over_buerger.gif";
ImgNavboxPfeil["branchen_r"] = "navi_pfeilr_over_buerger.gif";

var ImgNavboxPfeilGross = new Array();
ImgNavboxPfeilGross["tourismus"] = "navi_pfeil_gross.gif";
ImgNavboxPfeilGross["tourismus_r"] = "navi_pfeilr_gross.gif";
ImgNavboxPfeilGross["kur"] = "navi_pfeil_gross.gif";
ImgNavboxPfeilGross["kur_r"] = "navi_pfeilr_gross.gif";
ImgNavboxPfeilGross["kompetenz"] = "navi_pfeil_gross.gif";
ImgNavboxPfeilGross["kompetenz_r"] = "navi_pfeilr_gross.gif";
ImgNavboxPfeilGross["frei"] = "navi_pfeil_gross.gif";
ImgNavboxPfeilGross["frei_r"] = "navi_pfeilr_gross.gif";
ImgNavboxPfeilGross["ver"] = "navi_pfeil_gross.gif";
ImgNavboxPfeilGross["ver_r"] = "navi_pfeilr_gross.gif";
ImgNavboxPfeilGross["buerger"] = "navi_pfeil_gross.gif";
ImgNavboxPfeilGross["buerger_r"] = "navi_pfeilr_gross.gif";
ImgNavboxPfeilGross["wirt"] = "navi_pfeil_gross.gif";
ImgNavboxPfeilGross["wirt_r"] = "navi_pfeilr_gross.gif";
ImgNavboxPfeilGross["branchen"] = "navi_pfeil_gross.gif";
ImgNavboxPfeilGross["branchen_r"] = "navi_pfeilr_gross.gif";

var ids = new Array();
ids[0] = "tourismus";
ids[1] = "tourismus_r";
ids[2] = "kur";
ids[3] = "kur_r";
ids[4] = "kompetenz";
ids[5] = "kompetenz_r";
ids[6] = "frei";
ids[7] = "frei_r";
ids[8] = "ver";
ids[9] = "ver_r";
ids[10] = "buerger";
ids[11] = "buerger_r";
ids[12] = "wirt";
ids[13] = "wirt_r";
ids[14] = "branchen";
ids[15] = "branchen_r";

var NavMenuActifOut;
var NavMenuActifOver;
var CurrentNavbox = null;

/*#################
Navbox A Portal
###################*/
function navbox_outall(id)
{
	if (document.getElementById('navboxmenu'+id).style.visibility == 'hidden') {
		for(var i = 0; i < ids.length; i++) {
			if (id != ids[i] && document.getElementById('navboxmenu'+ids[i])) {
				document.getElementById('navboxmenu'+ids[i]).style.visibility = 'hidden';
				document.getElementById('navbox'+ids[i]).className = 'navbox'+ids[i].replace(/_r/,"");
				document['imgnavpfeil_'+ids[i]].src="/images/"+ImgNavboxPfeilGross[ids[i]];		
			}		
		}
	}		
}

function navbox_over(obj,id)
{
	navbox_outall(id);
	CurrentNavbox = obj;	
	clearTimeout(NavMenuActifOut);
	clearTimeout(NavMenuActifOver);
	NavMenuActifOver = setTimeout("navbox_overtimer('"+id+"');", 200);
}

function navbox_overtimer(id) {
	
	var NavboxMenu = 'navboxmenu'+id;
	if (document.getElementById(NavboxMenu).style.visibility == 'hidden')
	{
		CurrentNavbox.className = 'navboxover'+id.replace(/_r/,"");
		document['imgnavpfeil_'+id].src='/images/'+ImgNavboxPfeil[id];
		
		var NavMenuTop = CurrentNavbox.offsetTop-75;
		var WinHeight = parseInt(document.body.offsetHeight);
		var TopHeight=(document.getElementById('header').offsetHeight+document.getElementById('headerlinks').offsetHeight)-document.body.scrollTop;
		var TopScroll=document.body.scrollTop-(document.getElementById('header').offsetHeight+document.getElementById('headerlinks').offsetHeight);
		var NavMenuHeight = parseInt(document.getElementById(NavboxMenu).offsetHeight)+TopHeight;
		var MarginBottom = 10;

		if (NavMenuTop < TopScroll) {
		    document.getElementById(NavboxMenu).style.top=TopScroll+'px'
		}		
		else if ((NavMenuTop + NavMenuHeight) > WinHeight) {
			document.getElementById(NavboxMenu).style.top=WinHeight-NavMenuHeight-MarginBottom+'px';
		}
		else {
		    document.getElementById(NavboxMenu).style.top = NavMenuTop+'px';
		}
		document.getElementById(NavboxMenu).style.visibility = 'visible';
	}
}

function navbox_outtimer(id) {
	document.getElementById('navboxmenu'+id).style.visibility = 'hidden';
	CurrentNavbox.className = 'navbox'+id.replace(/_r/,"");
	document['imgnavpfeil_'+id].src="/images/"+ImgNavboxPfeilGross[id];
	CurrentNavbox = null;
}

function navbox_out(obj,id)
{
	if (!obj.contains(event.toElement)) {		
	    clearTimeout(NavMenuActifOver);
	    clearTimeout(NavMenuActifOut);
		NavMenuActifOut = setTimeout("navbox_outtimer('"+id+"');", 300);		
	}
}


/*#################
Navbox B Portal
###################*/
function navboxb_outall(id)
{
	if (document.getElementById('navboxmenu_'+id).style.visibility == 'hidden') {
		for(var i = 0; i < document.getElementsByTagName("div").length; i++)
		{
			ids = document.getElementsByTagName("div")[i].id;
			result = ids.search(/navboxmenu_.+/);
		    if(result != -1 && id != ids)
		    {
				document.getElementById(ids).style.visibility = 'hidden';
		    }
		}
	}
}

function navboxb_over(obj,id)
{	 
	if (id != "kompetenz_1788" && id != "kompetenz_1892" && id != "kompetenz_6017" &&
	id != "kompetenz_6020" && id != "kompetenz_6022" && id != "kompetenz_6024" &&
	id != "kompetenz_5974" && id != "kompetenz_5965" && id != "kompetenz_8278") {
	    navboxb_outall(id);
	    CurrentNavbox = obj;	
	    clearTimeout(NavMenuActifOut);
	    clearTimeout(NavMenuActifOver);
	    NavMenuActifOver = setTimeout("navboxb_overtimer('"+id+"');", 200);
	}
}

function navboxb_overtimer(id) {
		
	var NavboxMenu = 'navboxmenu_'+id;
	if (document.getElementById(NavboxMenu).style.visibility == 'hidden')
	{		
		var NavMenuTop = CurrentNavbox.offsetTop;
		var WinHeight = parseInt(document.body.offsetHeight);
		var TopHeight=(document.getElementById('header').offsetHeight+document.getElementById('headerlinks').offsetHeight)-document.body.scrollTop;
		var TopScroll=document.body.scrollTop-(document.getElementById('header').offsetHeight+document.getElementById('headerlinks').offsetHeight);
		var NavMenuHeight = parseInt(document.getElementById(NavboxMenu).offsetHeight)+TopHeight;
		var MarginBottom = 10;

		if (NavMenuTop < TopScroll) {
		    document.getElementById(NavboxMenu).style.top=TopScroll+'px'
		}		
		else if ((NavMenuTop + NavMenuHeight) > WinHeight) {
			document.getElementById(NavboxMenu).style.top=WinHeight-NavMenuHeight-MarginBottom+'px';
		}
		else {
		    document.getElementById(NavboxMenu).style.top = NavMenuTop+'px';
		}
		document.getElementById(NavboxMenu).style.visibility = 'visible';
	}
}

function navboxb_outtimer(id) {
	document.getElementById('navboxmenu_'+id).style.visibility = 'hidden';	
	CurrentNavbox = null;
}

function navboxb_out(obj,id)
{
			
	clearTimeout(NavMenuActifOver);
	clearTimeout(NavMenuActifOut);
	NavMenuActifOut = setTimeout("navboxb_outtimer('"+id+"');", 300);		
	
}

/*#################
All
###################*/
function pop_topics(url)
{
    /*url mit &r=mit navright*/
    var result = url.search(/&r/);
    if (result!=-1){
    	var w = 710;
		var h = 450;	
    }else {
    	var w = 518;
		var h = 518;
	}
	
	var left=window.screen.width/2-(w/2);
 	var top=window.screen.height/2-(h/2);
 	if (win){
 		win.focus();
 	}
 	else {
		var win = window.open(url,'topics','toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=1, copyhistory=0, menuBar=0, width='+w+', height='+h+', left='+left+', top='+top+'');
		win.focus();
 	}
}

function pop_topics_url(url)
{
	this.close();
	window.opener.location.href = url;		
}

function pop(url,w,h)
{
    var left=window.screen.width/2-(w/2)-15;
 	var top=window.screen.height/2-(h/2);
	win = window.open(url,'pop','toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=1, copyhistory=0, menuBar=0, width='+w+', height='+h+', left='+left+', top='+top+'');
	win.focus();
}

function pop_ver(url,w,h)
{
    var left=window.screen.width/2-(w/2);
 	var top=window.screen.height/2-(h/2);
	win = window.open(url,'ver','toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=0, copyhistory=0, menuBar=0, width='+w+', height='+h+', left='+left+', top='+top+'');
	win.focus();
}

function pop_close(url,w,h)
{
    var left=window.screen.width/2-(w/2);
 	var top=window.screen.height/2-(h/2);
	this.close();
	win = window.open(url,'pop','toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=1, copyhistory=0, menuBar=0, width='+w+', height='+h+', left='+left+', top='+top+'');
	win.focus();
}

function gourl(url)
{
	document.location.href = url;
}

function pop_search(url,n,js_url)
{	
	this.close();
	result = url.search(/imperia/);
	if((result != -1)) {
		window.open(url);
	}
	else {
		window.opener.focus();
		window.opener.location.href = url;
	}			
}

function changelang(sel)
{
	i = sel.selectedIndex;
	window.location.href = '/'+sel[i].value+'/index.html';
}

/*Veranstaltung*/
function changemonat(sel)
{
	i = sel.selectedIndex;
	window.location.href = '#'+sel[i].value;
}

/*Presseportal Bilder*/
function pop_pressebild(url)
{
	var w = 810;
	var h = 650;    
	
	var left=0;
 	var top=0;

 	
	var winpressebild = window.open(url,'pressebild','toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=1, copyhistory=0, menuBar=0, width='+w+', height='+h+', left='+left+', top='+top+'');
	winpressebild.focus();
 	
}

function pop_pressebildliste(url)
{
	var w = 630;
	var h = 650;	
	
	var left=window.screen.width/2-(w/2);
 	var top=window.screen.height/2-(h/2);
 	
	var win = window.open(url,'pressebildliste','toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=0, copyhistory=0, menuBar=0, width='+w+', height='+h+', left='+left+', top='+top+'');
	win.focus();
 	
}

function pop_presseclose(url)
{
	this.close();
	window.opener.location.href = url;		
}

/*Stadt*/
function pop_stadtplan(url)
{
	win = window.open(url,"cityguide","width=780,height=540,menubar=yes,resizable=yes,location=no,status=no");
}

function pop_amt(url)
{    
	var w = 710;
	var h = 450;    
	
	var left=window.screen.width/2-(w/2);
 	var top=window.screen.height/2-(h/2);
 	if (winamt){
 		winamt.focus();
 	}
 	else {
		var winamt = window.open(url,'amt','toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=1, copyhistory=0, menuBar=0, width='+w+', height='+h+', left='+left+', top='+top+'');
		winamt.focus();
 	}
}

function pop_mediaplayer(url,w,h)
{
	w = w+30;
	h = h+75;
	var left=window.screen.width/2-(w/2);
 	var top=window.screen.height/2-(h/2);
 	
 	if (mediaplayer){
 		mediaplayer.focus();
 	}
 	else {
		var mediaplayer = window.open(url,'mediaplayer','toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=1, copyhistory=0, menuBar=0, width='+w+', height='+h+', left='+left+', top='+top+'');
		mediaplayer.focus();
 	}
}

// Pop-Up Embedder Script by David Battino, www.batmosphere.com
// Version 2006-05-31   
function pop_audioplayer(filedesc,filepath,WindowNumber) 
{
    // Get Operating System 
    var isWin = navigator.userAgent.toLowerCase().indexOf("windows") != -1
    if (isWin) {
        // Use MIME type = "application/x-mplayer2";
	    visitorOS="Windows";
    } else {
        // Use MIME type = "audio/mpeg"; // or audio/x-wav or audio/x-ms-wma, etc.
	    visitorOS="Other";
    }

    // Get the MIME type of the audio file from its extension (for non-Windows browsers)
    var mimeType = "audio/mpeg"; // assume MP3/M3U
    var objTypeTag = "application/x-mplayer2"; // The Windows MIME type to load the WMP plug-in in Firefox, etc.

    var theExtension = filepath.substr(filepath.lastIndexOf('.')+1, 3); // truncates .aiff to aif
    if (theExtension.toLowerCase() == "wav") { mimeType = "audio/x-wav"};
    if (theExtension.toLowerCase() == "aif") { mimeType = "audio/x-aiff"}; 
    if (theExtension.toLowerCase() == "wma") { mimeType = "audio/x-ms-wma"};
    if (theExtension.toLowerCase() == "mid") { mimeType = "audio/mid"};
    // Add additional MIME types as desired

    if (visitorOS != "Windows") { 
        objTypeTag = mimeType; // audio/mpeg, audio/x-wav, audio/x-ms-wma, etc.
    };

    PlayerWin = window.open('','audioplayer'+WindowNumber,'width=320,height=190,top=0,left=0,screenX=0,screenY=0,resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0');

    PlayerWin.focus();
    PlayerWin.document.writeln("<html><head><title>" + filedesc + "</title>");
    PlayerWin.document.writeln("<link rel='stylesheet' href='/css/de/buergerservice/layout.css' /></head>");
    PlayerWin.document.writeln("<body>"); // specify background img if desired
    PlayerWin.document.writeln("<div align='center'>");
    PlayerWin.document.writeln("<h1 class='contentueberschrift'>" + filedesc + "</h1>");
    PlayerWin.document.writeln("<object width='280' height='69'>");
    PlayerWin.document.writeln("<param name='src' value='" +  filepath + "'>");
    PlayerWin.document.writeln("<param name='type' value='" + objTypeTag + "'>");
    PlayerWin.document.writeln("<param name='autostart' value='1'>");
    PlayerWin.document.writeln("<param name='showcontrols' value='1'>"); 
    PlayerWin.document.writeln("<param name='showstatusbar' value='1'>");
    PlayerWin.document.writeln("<embed src ='" + filepath + "' type='" + objTypeTag + "' autoplay='true' width='280' height='69' controller='1' showstatusbar='1' bgcolor='#9999ff' kioskmode='true'>");
    PlayerWin.document.writeln("</embed></object></div>");
    PlayerWin.document.writeln("<p style='text-align:center'><a href='" + filepath +"'>Datei herunterladen</a></p>");
    PlayerWin.document.writeln("<form><div align='center'><input type='button' value='schließen' onclick='javascript:window.close();'></div></form>");
    PlayerWin.document.writeln("</body></html>");

    PlayerWin.document.close(); // "Finalizes" new window
}
