$(document).ready(function() {

	
				$main_nav = "#nav-main";
	
				$submenues = Array();
				$submenues["nav-main-2"] = "#hold-nav-main-2";
				$submenues["nav-main-3"] = "#hold-nav-main-3";
				$submenues["nav-main-4"] = "#hold-nav-main-4";
				$submenues["nav-main-4-2"] = "#hold-nav-main-4-2";
				$submenues["nav-main-5"] = "#hold-nav-main-5";
	
	
	$("#content-banners").delegate("a","click",function(){ 
	//alert($(this).attr('href') ); 
	window.location.href($(this).attr('href'));
	return false ;
	//content-banner-control
		//window.location.href($(this).attr('href'));
	}); 
	$("#nav-main").delegate("a","click",function(){  
		window.location.href($(this).attr('href'));
	}); 
	$("#nav-main").delegate("a","mouseover",function(){  
	//alert("test");
		if($submenues[$(this).attr("id")]) {
			//alert("test");
			if($($main_nav+" "+$submenues[$(this).attr("id")]).attr("id") ) {
				//alert($($main_nav+" "+$submenues[$(this).attr("id")]).attr("id"));
			} else {
				//alert($($main_nav+" "+$submenues[$(this).attr("id")]).attr("id"));
				$("#"+$(this).attr("id")).append($($submenues[$(this).attr("id")]).clone()); 
	
			}
		}
	});  
	$("body").delegate("a","mouseleave",function(){  
		 $($submenues[$(this).attr("id")]).remove(); 
	
	}); 
	ajustHeight();
	
	/* controls */
	$('#content-banner-control').delegate("a","click", function() {
		//alert($('#content-banners').children(":first").attr('id'));
		
		$('#content-banners').append($($(this).attr('href'))) ;
		
		return false;
	});
	$('#control-sermons').delegate("a","click", function() {
		//alert($(this).attr('href'));
		t = $(this).attr('href');
		v= '<audio controls="controls" autoplay="true">'+
  			'<source id="audio-src" src="'+t+'" type="audio/mp3" />'+
  			'Your browser does not support the audio element.'+
			'</audio>';
			//$(this).append(v);
		
		//$('#audio-player').html(v)
		$(this).parent().append($('#audio-player'));
		$('#audio-player').html(v) ;
		ajustHeight();
		return false;
		
	});

	function ajustHeight() {
		if 	($('#content-body-1').height() > $('#content-body-2').height() ) {
			$('#content-body-2').css('height',($('#content-body-1').height())+'px')  ;	
		} else {
			$('#content-body-1').css('height',($('#content-body-2').height())+'px')  ;		
		}
	}
});
