esfUI.extend({
	doJump:true,
	initPage:function(){
		
		$('#camp-details ul a')
		.bind('activate',function(){			
			var curGrp = $('#camp-details ul img.current');
			var img = $(this).find('img');

			curGrp.each(function(i){
				$(this).removeClass('current').attr('src',$(this).attr('src').replace(/\-over/gi,''));
			});	
		
			img.attr('src',img.attr('src').replace(/(-over)?\.gif/gi,'-over.gif'));				
			img.addClass('current');

			var href = $(this).attr('href').substr(1);
			var vars = href.split(':');			

			esfUI.loadCampData(vars[0],vars[1]);
		})
		.hover(
			function(){
				var me = $(this).find('img');
				if(!me.is('.current')){
					me.attr('src',me.attr('src').replace(/\.gif/gi,'-over.gif'));
				}
			},
			function(){
				var me = $(this).find('img');
				if(!me.is('.current')){
					me.attr('src',me.attr('src').replace(/\-over/gi,''));
				}
			}
		).click(function(){		
			$(this).trigger('activate');
		});

		// Set default content
		var s = window.location.hash;
		if(s!=''){
			$('#camp-details ul li a').each(function(){
				if($(this).attr('href') == s){
					$(this).trigger('click');
				}
			});
		}else{
			$('#camp-details ul li a:eq(0)').trigger('click');
		}
		
	},
	loadCampData:function(pageguid,attributename){	
		/*s
		 * Sample data under ajax/camps/[camp]/[content]
		 */	
		$('#camp-details-content').empty().load('/pages/camptab.aspx?DN='+pageguid+'&name=esf:camp:' + attributename,{},function(responseText, textStatus, request){
			if(textStatus != 'success'){
				$('#camp-details-content').html('['+camp + '] [' + content + '] content not available at this time.');
			}	
			if(typeof sIFR == "function"){

    // This is the preferred "named argument" syntax
        sIFR.replaceElement(named({sSelector:"#camp-details-content h2", sFlashSrc:"/sifr/lovelt__.swf", sColor:"#902A2A", sHoverColor:"#902A2A", sWmode:"transparent"})); }   
   		
   		
			if(esfUI.doJump == true && window.location.hash != ''){
				window.scrollTo(0,$('#camp-utility').get(0).offsetTop);		
			   
			}
		});				
	}	
});