
$(document).ready(function(){ 
		var sections = $("#newProfileNav img");  
		  
		
	     //Manage click events  
	    sections.click(function(){
	    	var content = $("#newImages");
		    //show the loading bar  
	        showLoading();  
	        //load selected section  
	        switch(this.id){  
	            case "leftArrow":  
		            content.slideUp();  
	                content.load("/profile/changeNewProfilesPrev #newImages_next", hideLoading);  
	                break;  
	            case "rightArrow": 
	                content.slideUp();  
	                content.load("/profile/changeNewProfilesNext #newImages_next", hideLoading);  
	                break;  
	            default:  
	                //hide loading bar if there is no selected section  
	                hideLoading();  
	                break;  
	        }  
	    });
		  
	}); 
//show loading bar  

function showLoading(){  
	$("#loading")  
        .css({visibility:"visible"})  
        .css({opacity:"0.5"})  
        .css({display:"block"})  
    ;  
}  
//hide loading bar  
function hideLoading(){  
	var loading = $("#loading");
    loading.fadeTo(1000, 0);
    loading.css({display:"none"}) ;  
    $("#newImages").slideDown();  
};