// JavaScript Document - jQuery

$(document).ready(function() {
	var selected_tab;
	$("#content_header span").hide();
	
	$("#tab_container a").click(function () {
		
		$("#content_header span").show();
		
		var div_id 			= $(this).parent().parent().attr("id");
		var front_id 		= $("#content_header h2").attr("id");
		var selected_html 	= $("#" + div_id + " p a").html();
		var front_html 		= $("#content_header h2").html();

		// Switch the html
		$("#content_header h2").html(selected_html);
		
		// Show the correct div
		$("#content").children("div").each(function(i, obj){
			$(obj).hide();
		});

		$("#c_" + div_id).show();
		selected_tab = "#c_" + div_id;
	});
	
	$("#content_header span").click(function () {
		$(this).hide();
		$("#c_file_info").show();
		$(selected_tab).hide();
		$("#content_header h2").html($("#address").val());
	});
});