// JavaScript Document


$('#image_team_large, #image_timeline_large, #image_gallery_large, #image_blog_large').hide();
$('#image_team div.image_over, #image_timeline div.image_over, #image_gallery div.image_over, #image_blog div.image_over').hide();

showTimeline('image_stories');
$('#image_stories div.image_off').hide();
$('#bottom div.image_container').hoverIntent(showBlock,doNothing);

function showBlock(){
	
	//if( $('#image_stories_large').hasClass('visible_block')){
	//		 $('#image_stories_large').removeClass('visible_block');
	//		 $('#image_stories_large').fadeOut();								   
	//}
	//var itemz = $('#bottom').children('div.image_container').length;
	//var itemz = $('#bottom div.image_container').index(this);
	//alert( itemz);
	var selectedBox = $(this).attr('id');
	
	if( $(this).hasClass('visible_block') ) {
			
	}
	else {
		
		
		//$('#' + selectedBox + '').addClass('image_small');
		
		
		// ----------------------------------------------
		// HANDLE THE BOTTOM FIRST
		$('#bottom div.image_over').each(function(){
				$(this).hide();
		});
		$('#bottom div.image_off').each(function(){
				$(this).show();
		});
		$('#bottom div.image_container').each(function(){
				$(this).addClass('hidden_block image_padding');
				$(this).removeClass('visible_block image_padding2');
		});
		$('#' + selectedBox + '').removeClass('image_padding');
		$('#' + selectedBox + '').addClass('image_padding2');
		$('#' + selectedBox + ' div.image_over').slideToggle();
		$('#' + selectedBox + ' div.image_off').slideToggle();
		
		
		//----------------------------------------------
		// INITIALIZE THE TIMELINE FEATURE
		showTimeline(selectedBox);
		
		
		// ----------------------------------------------
		// NOW HANDLE THE TOP
		selectedBox = selectedBox + '_large';
		
		// RESET ALL THE TOP TABS
		$('#top div.image_container').each(function(){
				$(this).hide();
		});
		
		$('#' + selectedBox + '').slideToggle();
		$('#' + selectedBox + '').addClass('visible_block');
		
	}
	
	
										
	
	
}

function doNothing(){}







function showTimeline(sectionIn){
 
 	if(sectionIn != 'image_blog' && sectionIn != 'image_team'){
	 $(function(){
		  $().timelinr({
			 orientation: 'horizontal',
			 // value: horizontal | vertical, default to horizontal
			 containerDiv: '#timeliner_' + sectionIn + '',
			 // value: any HTML tag or #id, default to #timeline
			 datesDiv: '#timeliner_dates_' + sectionIn + '',
			 // value: any HTML tag or #id, default to #dates
			 datesSelectedClass: 'selected',
			 // value: any class, default to selected
			 datesSpeed: 500,
			 // value: integer between 100 and 1000 (recommended), default to 500 (normal)
			 issuesDiv : '#timeliner_issues_' + sectionIn + '',
			 // value: any HTML tag or #id, default to #issues
			 issuesSelectedClass: 'selected',
			 // value: any class, default to selected
			 issuesSpeed: 200,
			 // value: integer between 100 and 1000 (recommended), default to 200 (fast)
			 issuesTransparency: 0.2,
			 // value: integer between 0 and 1 (recommended), default to 0.2
			 issuesTransparencySpeed: 500,
			 // value: integer between 100 and 1000 (recommended), default to 500 (normal)
			 prevButton: '#timeliner_prev_' + sectionIn + '',
			 // value: any HTML tag or #id, default to #prev
			 nextButton: '#timeliner_next_' + sectionIn + '',
			 // value: any HTML tag or #id, default to #next
			 arrowKeys: 'false',
			 // value: true/false, default to false
			 startAt: 1,
			 // value: integer, default to 1 (first)
			 autoPlay: 'false',
			 // value: true | false, default to false
			 autoPlayDirection: 'forward',
			 // value: forward | backward, default to forward
			 autoPlayPause: 2000
			 // value: integer (1000 = 1 seg), default to 2000 (2segs)
		  });
	   }); 
	}

}
