esfUI.extend({
	initPage : function(){
		$('#location-states h3')
		.attr({title:'Click to expand'})
		.css({cursor:'pointer'})
		.hover(function(){$(this).addClass('hover')},function(){$(this).removeClass('hover')})
		.click(function(){
			var me = $(this);
			var p = $(this).parent(); // Main <div class="location-data">
			// Toggle view
			$('.location-data').each(function(){
				var d = $(this);
				// If current <div> node is the same as our <div> and has a class="open" or 
				// current <div> is not the same as our <div>
				if((p.get(0) === d.get(0) && p.is('.open')) || (p.get(0) != d.get(0))){
					$(this).find('.data-table').slideUp(function(){
						d.removeClass('open');
					});
				}else{
					$(this).find('.data-table').slideDown(function(){
						d.addClass('open');
					});				
				}
			});
		});
		
	},
	loadCampOverview:function(contentId){
	    if(typeof(currentpreview) == "undefined" || currentpreview != contentId)
	    {
	        currentpreview = contentId;
		    // Reset all camp info
		    $('.location-entry').stop().slideUp(function(){
			    $(this).removeClass('open');
			    // Show our camp
			    $('#location-content')
			    .empty()
			    .load('/pages/camppreview.aspx?DN=' + contentId, {}, function(responseText, textStatus, request) {
				    if(textStatus == 'success'){
				       $('#location-content').find('.location-entry').stop().slideDown(function(){
						    $(this).addClass('open');
    						
					    });	
				    }			
			    });
		    });	
		}	
	}
});


