$(function(){
	//This function is used to slide the main area to the selected item
	$('.titleBar').click(function(){
		if($(this).hasClass('openItem')){
			$(this).removeClass('openItem');
			$(this).siblings('.itemBody').hide().adjustItemHeight();
	
		} else {
			$(this).addClass('openItem');
			$(this).siblings('.itemBody').show().adjustItemHeight();
		}	
	});	
	
	//This function is used to open the item body and expand the content area to the appropriate height
	$.fn.adjustItemHeight = function(){
		var totalHeight = 0;
		var parentColumn = $(this).parent().parent();
		parentColumn.find('.item').each(function(){
			totalHeight += $(this).outerHeight(true);
		});
		$('#content #jobsArea').height( totalHeight+75 );
	}
	//This function is used to launch a picture gallery for the given criteria

	$('#webArea').addClass('currentJobSlide');
});

//This function is used to place the page at the appropriate spot if a side is given
function moveJobSlider( slideToGet ){
	if( !$('#'+slideToGet).hasClass('currentJobSlide') ){
		var mark = $('#'+slideToGet).offset();
		$('.currentJobSlide').animate({left:( mark.left < 0 ? '34%' : '-34%')},500).removeClass('currentJobSlide');
		$('#'+slideToGet).animate({left:'0'},500).addClass('currentJobSlide');
		$('.currentJobSlide .titleBar').eq(0).adjustItemHeight();
	}
}



