function slideDown()
{
	
	subNav = $(this).next('ul.subNav');
	var active = $("ul#hauptnavigation ul.active");
	var subActive = $("ul#hauptnavigation ul.active ul");
	if($(this).parent('li').parent(".subSubNav").length > 0 || $(this).parent('li').parent(".subSubSubNav").length > 0) {
			$("ul#hauptnavigation ul:visible").not(subNav).not(active).not(subActive).slideUp(500);
			return false;
		}else if($(this).parent('li').parent(".subNav").length > 0) {
			return false;
		}
		$("ul#hauptnavigation ul:visible").not(subNav).not(active).not(subActive).stop(true,true);
		$("ul#hauptnavigation ul:visible").not(subNav).not(active).not(subActive).slideUp(500);
		subNav.slideDown(500);
	
		return false;
}

function slideUp()
{
	
}
var config = {    
     sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)    
     interval: 400, // number = milliseconds for onMouseOver polling interval    
     over: slideDown, // function = onMouseOver callback (REQUIRED)    
     timeout: 500, // number = milliseconds delay before onMouseOut    
     out: slideUp // function = onMouseOut callback (REQUIRED)    
};

$(document).ready(function() {
	
 	$("ul#hauptnavigation li a").hoverIntent( config );
	if($('#tabs').length > 0) {
		$("#tabs").tabs();
	
		$("#gmap").css("height","327px");
	}
});

// ### Aufrufen des Popups für die Galeriebilder (Großansicht)
function Galerie( id, id_pool ) {
  myWin = open( "/galerie.php?id="+id+"&id_media="+id_pool+"&lang="+lang, "Galerie", "left=75,top=75,width=570,height=460,toolbar=no,scrollbars=no,menubar=no,status=no,resizable=no" );
}

// ### Aufrufen des Popups für die Videos
function Video( video, lang ) {
  myWin = open( "/video.php?video="+video+"&lang="+lang, "Video", "left=75,top=75,width=480,height=288,toolbar=no,scrollbars=no,menubar=no,status=no,resizable=no" );
}

// ### Aufrufen des Popups für die Zeitzonen
function Zeitzonen( lang, uhrzeit ) {
  myWin = open( "/zeitzonen.php?lang="+lang+"&uhrzeit="+uhrzeit, "Zeitzonen", "left=75,top=75,width=440,height=620,toolbar=no,scrollbars=no,menubar=no,status=no,resizable=no" );
}

function StadionplanOnMouseOver( id, path ) {
	if ( document.getElementById( 'akt_stadion_plan' ).value != id ) {
		swapImg( 'kat_'+id, path+id+'_on.gif' );
	}
}

function StadionplanOnMouseOut( id, path ) {
	if ( document.getElementById( 'akt_stadion_plan' ).value != id ) {
		swapImg( 'kat_'+id, path+id+'.gif' );
	}
}

function StadionplanOnClick( id, path ) {
	if ( document.getElementById( 'stadionplan' ).src != path+'kategorie-'+id+'.gif' ) {
		swapImg( 'kat_1', path+'1.gif' );
		swapImg( 'kat_2', path+'2.gif' );
		swapImg( 'kat_3', path+'3.gif' );
		swapImg( 'kat_4', path+'4.gif' );
	
		document.getElementById( 'akt_stadion_plan' ).value = id;
		swapImg( 'kat_'+id, path+id+'_on.gif' );
		swapImg( 'stadionplan', path+'kategorie-'+id+'.gif' );
	}
}

function swapImg( id, img ) {
	if ( document.getElementById( id ) ) {
		document.getElementById( id ).src = img;
	}
}

function setValue( id, value ) {
	if ( document.getElementById( id ) ) {
		document.getElementById( id ).value = value;
	}
}

//### blendet je ein Element ein & aus
function showhide( showid, hideid ) {
	if ( showid == hideid && document.getElementById( showid ) ) {
		if ( document.getElementById( hideid ).style.visibility == 'hidden' ) {
			hideid = '';
		}
		else {
			showid = '';
		}
	}
  if ( document.getElementById( showid ) ) {
    document.getElementById( showid ).style.visibility = 'visible';
    document.getElementById( showid ).style.display = '';
  }
  if ( document.getElementById( hideid ) ) {
    document.getElementById( hideid ).style.visibility = 'hidden';
    document.getElementById( hideid ).style.display = 'none';
  }
}

//### blendet ne Ebene aus, ist in den Startseiten-Flashs verbaut
function hidelayer(nav) {
	if ( document.all ) {
		document.all[nav].style.visibility = "hidden";
	}
	if ( document.getElementById ){
		document.getElementById( nav ).style.visibility = "hidden";
	}
	else {
		document.layers[nav].visibility = "hidden";
	}
}

function openWin(URL) {
	myWin=open(URL, "myWin", "width=400,height=400,toolbar=0,scrollbars=0,menubar=0,status=0,resizable=0");
}
function openWindow(url,title,width,height)
{
	myWIn = open(url, title, "width="+width+",height="+height+",toolbar=0,scrollbars=1,menubar=0,status=0");
	myWIn.focus();
}

function LiveScoring(URL) {
	myWin=open(URL, "myWin", "width=600,height=600,toolbar=0,scrollbars=1,menubar=0,status=0,resizable=0");
}