$(document).ready(function(){	
	
	/*var pnl_pad = 130;
	var full_width = $(window).width() - 2;
	var full_height = $(window).height() - pnl_pad - $("#menu").height() + "px";
	var panel_height = $(window).height() - pnl_pad - $("#menu").height() - 40;
	$("#panel_live").css("left", center_pos).animate({ top: pnl_pad }, { duration: 1 });
	$("#panel_content").css("left", center_pos).css("top", $(window).height()).css("height", panel_height + "px");
	$("#panel_content .bg_inner").css("height", (panel_height-10) + "px");
	$("#window").css("width", full_width).css("height", full_height);*/
	var center_pos = ($(window).width() - $("#panel_live").width())/2;
	$("#header").css("left", center_pos).animate({ top: 0 }, { duration: 1 });
	$("#btn_toggle").css("right", center_pos+($('#btn_dmf').width())).animate({ top: 0 }, { duration: 500 });
	
	document.body.onresize = function (){
		var center_pos = ($(window).width() - $("#panel_content").width())/2;
		var full_width = $(window).width() - 2;
		var full_height = $(window).height() - pnl_pad - $("#menu").height() + "px";
		var panel_height = $(window).height() - pnl_pad - $("#menu").height() - 40;
		$("#header").animate({ top: 25, left: center_pos }, { duration: 500 });
		$("#panel_live").animate({ top: pnl_pad, left: center_pos }, { duration: 500 });
		$("#btn_dmf").css("right", center_pos);
		$("#btn_toggle").css("right", center_pos+($('#btn_dmf').width()));
		$("#panel_content").css("left", center_pos).css("top", $(window).height()).css("height", panel_height + "px");
		$("#panel_content .bg_inner").css("height", (panel_height-10) + "px");
		$("#window").css("width", full_width).css("height", full_height);
	}

	$("#av_menu li").click(function(){
		var avNum = $("#av_menu li").index(this);
		var avID = '#'+$(this).attr("id");
		$("#av_list").animate({ top: -($("#av_list").height()*(4-avNum)) },{ duration: 1 });
		// Unselects Current Tab
		$('.tab_blk_inner_sel').removeClass('tab_blk_inner_sel').addClass('tab_blk_inner');
		// Selects New Current Tab
		$(avID+' div').addClass('tab_blk_inner_sel');
	});
	
	$("#com_menu a").click(function(){
		var comNum = $("#com_menu a").index(this);
		$("#com_list").animate({ top: -($("#com_list").height()*(2-comNum)) },{ duration: 1 });
		// Unselects Current Tab
		$('.tab_wht_left_sel').removeClass('tab_wht_left_sel').addClass('tab_wht_left');
		$('.tab_wht_inner_sel').removeClass('tab_wht_inner_sel').addClass('tab_wht_inner');
		$('.tab_wht_right_sel').removeClass('tab_wht_right_sel').addClass('tab_wht_right');
		// Selects New Current Tab
		$('#com_menu li:eq('+comNum+') .tab_wht_left').addClass('tab_wht_left_sel');
		$('#com_menu li:eq('+comNum+') .tab_wht_inner').addClass('tab_wht_inner_sel');
		$('#com_menu li:eq('+comNum+') .tab_wht_right').addClass('tab_wht_right_sel');
	});
	
	$("#btn_toggle").click(function(){
		window.open("http://davidradio.es/mfd/radio.html");
	});

});