function extraMenu(id){if(document.getElementById(id).style.display=='block'){document.getElementById(id).style.display='none';}else{if(document.getElementById("horiz_menu_1")){document.getElementById("horiz_menu_1").style.display='none';}
if(document.getElementById("horiz_menu_2")){document.getElementById("horiz_menu_2").style.display='none';}
if(document.getElementById("horiz_menu_3")){document.getElementById("horiz_menu_3").style.display='none';}
if(document.getElementById("horiz_menu_4")){document.getElementById("horiz_menu_4").style.display='none';}
if(document.getElementById("horiz_menu_5")){document.getElementById("horiz_menu_5").style.display='none';}
document.getElementById(id).style.display='block';}}
function prov(id){if(document.getElementById("prov_"+id).style.display=='block'){document.getElementById("prov_"+id).style.display='none';}else{document.getElementById("prov_"+id).style.display='block';}
document.getElementById("horiz_menu_2").style.width='180px';}
var bannerRefresh = setInterval("refreshBanners();",300000);//5 minuten
function refreshBanners() {
	$(".leader:first").html("<iframe src=\"/soccer/banners/leaderboard_fra.html\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\" hspace=\"0\" vspace=\"0\" scrolling=\"no\" height=\"90\" width=\"728\"></iframe>");
	//$(".banner:first").html("<iframe src=\"/soccer/banners/banner_fra.html\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\" hspace=\"0\" vspace=\"0\" scrolling=\"no\" height=\"60\" width=\"450\"></iframe>");
	$(".skyscraper:first").html("<iframe src=\"/soccer/banners/skyscraper_fra.html\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\" hspace=\"0\" vspace=\"0\" scrolling=\"no\" height=\"600\" width=\"160\"></iframe>");
	$(".imu:first").html("<iframe src=\"/soccer/banners/imu_fra.html\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\" hspace=\"0\" vspace=\"0\" scrolling=\"no\" height=\"250\" width=\"300\"></iframe>");
}

$(document).ready(function(){
	$("a.decreaseFont img").click(function(){$("#css_font_size").attr("href", "/themes/soccer/vk/style_small.css");return false;});
	$("a.resetFont img").click(function(){$("#css_font_size").attr("href", "/themes/soccer/vk/style_normal.css");return false;});
	$("a.increaseFont img").click(function(){$("#css_font_size").attr("href", "/themes/soccer/vk/style_large.css");return false;});
	
	//Adjust panel height
	$.fn.adjustPanel = function(){ 
		$(this).find("ul, .subpanel").css({ 'height' : 'auto'}); //Reset subpanel and ul height
		
		var windowHeight = $(window).height(); //Get the height of the browser viewport
		var panelsub = $(this).find(".subpanel").height(); //Get the height of subpanel	
		var panelAdjust = windowHeight - 100; //Viewport height - 100px (Sets max height of subpanel)
		var ulAdjust =  panelAdjust - 25; //Calculate ul size after adjusting sub-panel (27px is the height of the base panel)
		
		if ( panelsub >= panelAdjust ) {	 //If subpanel is taller than max height...
			$(this).find(".subpanel").css({ 'height' : panelAdjust }); //Adjust subpanel to max height
			$(this).find("ul").css({ 'height' : ulAdjust}); //Adjust subpanel ul to new size
		}
		else if ( panelsub < panelAdjust ) { //If subpanel is smaller than max height...
			$(this).find("ul").css({ 'height' : 'auto'}); //Set subpanel ul to auto (default size)
		}
	};
	
	//Execute function on load
	$("#bookmarks").adjustPanel(); //Run the adjustPanel function on #bookmarks
	$("#shortcuts").adjustPanel(); //Run the adjustPanel function on #shortcuts
	
	//Each time the viewport is adjusted/resized, execute the function
	$(window).resize(function () { 
		$("#bookmarks").adjustPanel();
		$("#shortcuts").adjustPanel();
	});
	
	//Click event on Chat Panel + Alert Panel	
	$("#shortcuts a:first").click(function() { //If clicked on the first link of #chatpanel and #shortcuts...
		if($(this).next(".subpanel").is(':visible')){ //If subpanel is already active...
			$(this).next(".subpanel").hide(); //Hide active subpanel
			$("#bottombar li a").removeClass('active'); //Remove active class on the subpanel trigger
		}
		else { //if subpanel is not active...
			$(".subpanel").hide(); //Hide all subpanels
			$(this).next(".subpanel").toggle(); //Toggle the subpanel to make active
			$("#bottombar li a").removeClass('active'); //Remove active class on all subpanel trigger
			$(this).toggleClass('active'); //Toggle the active class on the subpanel trigger
			$.ajax({
				url: "/soccer/user/ajax-notifications-read.php",
				cache: false
			});
		}
		return false; //Prevent browser jump to link anchor
	});	
	$("#bookmarks a:first").click(function() { //If clicked on the first link of #chatpanel and #shortcuts...
		if($(this).next(".subpanel").is(':visible')){ //If subpanel is already active...
			$(this).next(".subpanel").hide(); //Hide active subpanel
			$("#bottombar li a").removeClass('active'); //Remove active class on the subpanel trigger
		}
		else { //if subpanel is not active...
			$(".subpanel").hide(); //Hide all subpanels
			$(this).next(".subpanel").toggle(); //Toggle the subpanel to make active
			$("#bottombar li a").removeClass('active'); //Remove active class on all subpanel trigger
			$(this).toggleClass('active'); //Toggle the active class on the subpanel trigger
		}
		return false; //Prevent browser jump to link anchor
	});
	
	//Click event outside of subpanel
	$(document).click(function() { //Click anywhere and...
		$("#horiz_menu_1").hide();
		$("#horiz_menu_2").hide();
		$("#horiz_menu_3").hide();
		$("#horiz_menu_4").hide();
		$("#horiz_menu_5").hide();
		$(".subpanel").hide(); //hide subpanel
		$("#bottombar li a").removeClass('active'); //remove active class on subpanel trigger
	});
	$('.subpanel ul').click(function(e) { 
		e.stopPropagation(); //Prevents the subpanel ul from closing on click
	});
	$('#menu').click(function(e) { 
		e.stopPropagation(); //Prevents the subpanel ul from closing on click
	});
	
	//Delete icons on Alert Panel
	$("#shortcuts li, .notifications li").hover(function() {
		$(this).find("a.delete").css({'visibility': 'visible'}); //Show delete icon on hover
	},function() {
		$(this).find("a.delete").css({'visibility': 'hidden'}); //Hide delete icon on hover out
	});
 
 
 
 
 
	
});
