// JavaScript Document
$(document).ready(function() {
	
	var divh = $('.reveal_text').css('height');//get initial height of expanded text block
	
	$('<p class="read_more_link"><a href="#">Read More</a></p>')
		.insertAfter('div.reveal_text');//add read more text
		
	$('.reveal_text').css('height','8.5em').css('overflow','hidden');//close text block

//jiggle hand on page load
	$('#apDiv17')
	.animate({top: '+=25px'},300, 'swing')
	.animate({top: '-=25px'},300, 'swing')
	.animate({top: '+=25px'},300, 'swing')
	.animate({top: '-=25px'},300, 'swing')	
	.animate({top: '+=25px'},300, 'swing')
	.animate({top: '-=25px'},300, 'swing');


//expand text function
function expandtext (){
		
			
		if( $('.read_more_link').text() == 'Read less' ){
			
					$('.reveal_text').animate({
						'height': '8.5em'			
						}, 1200, 'easeOutBack');
	
					$('.read_more_link').html('<a href="#">Read more</a>');
			
						} else {
				
					$('.reveal_text').animate({ 
					'height': divh 
					}, 1200, 'easeOutBack');
					$('.read_more_link').html('<a href="#">Read less</a>');
				};
			return false;
	};
	
//expand text area using read more link or clicking on jiggly hand
	$('.read_more_link').click(expandtext);
	$('#apDiv17').click(expandtext);	
	
//jiggle the hand on hover
	$('#finger').hover( function(){
		$('#apDiv17')
			.stop(true)
			.css('top', '0px')
			.animate({top: '+=25px'},300, 'swing')
		},
		function(){
			$('#apDiv17')
			.stop(true)
			.delay(00)
			.animate({top: '-=25px'},300, 'swing')
			.animate({top: '0px'},300, 'swing')
			} );
	
//main image rollovers	
	$('#apDiv1,#apDiv2,#apDiv3,#apDiv4,#apDiv5,#apDiv6').hover( function(){
		$(this).fadeTo(300, 0.05);},
			function(){
				$(this).fadeTo(400,1);
			}
	   );
//return image to normal incase visitor uses back button	
	$('#apDiv1,#apDiv2,#apDiv3,#apDiv4,#apDiv5,#apDiv6').click( function(){
		$(this).fadeTo(100,1);
	});

});
