// JavaScript Document

$(document).ready(function($){
	var sections = $(".directory h5");  
    var loading = $("#loading");  
    var content = $("#main");  
	
	
	
	//show loading bar  
	function showLoading(){  
    loading  
        .css({visibility:"visible"})  
        .css({opacity:"1"})  
        .css({display:"block"})  
    	;  
	}  
	//hide loading bar  
	function hideLoading(){  
	    loading.fadeTo(1000, 0);  
	    content.slideDown();  
	};


	//Manage click events  
	sections.click(function(){  
	    //show the loading bar  
	    showLoading();  
	    //load selected section  
	    switch(this.id){  
	        case "tdorak":  
	            content.slideUp();  
	            content.load("tdorak.html #main", hideLoading);  
	            break;  
	        case "news":  
	            content.slideUp();  
	            content.load("sections.html #section_news", hideLoading);  
	            break;  
	        case "interviews":  
	            content.slideUp();  
	            content.load("sections.html #section_interviews", hideLoading);  
	            break;  
	        case "external":  
	            content.slideUp();  
	            content.load("external.html", hideLoading);  
	            break;  
	        default:  
	            //hide loading bar if there is no selected section  
	            hideLoading();  
	            break;  
	    }  
	});  

	$("#faculty-back").click(function(){
		showLoading();
		content.slideUp();
		content.load("index.html #main", hideLoading);
	});
	


});