$(document).ready(function(){
		Cufon.replace('#social,a', {hover: 'true'}); 
		$('#social').delay(2000).animate({right:8},500);
		$('#work').css({
			'top':($(window).height()/2) - 202 + 'px'
		});
	
		
		
		$('#check').click(
			function(){
				$(this).animate({'right':'-205px'},1000);
				$('#work').delay(1000).animate({'right':($(window).width()/2) - 363 + 'px'},600,'easeInOutBack');
			}
		);
		
		$('#close_button').click(
			function(){
				$(this).animate({'height':0,'top':'41px'},600,'easeInOutBack');
				$('#work').delay(600).animate({'right':'-1000px'},600,'easeInOutBack');
				$('#check').delay(1200).animate({'right':'5px'},1000);
				$(this).delay(1300).animate({'height':'35px','top':'6px'},10,'easeInOutBack');
				reel.delay(1300).animate({'left': 0},10,
				
				function(){				
				if($('.left a:visible')){
					$('.left a').delay(1300).hide();
				}
				if($('.right a:hidden')){
					$('.right a').delay(1300).show();
				}
				
				currentPosition = 0;
				});
			}
		);
		/******************************************************************************
		 SLIDER
		******************************************************************************/
		
	
	
		var imageWidth = $('.reel li').width();
		var imagesLength = $('.reel li').size();
		var reelWidth = imageWidth * imagesLength;
		if(imagesLength>1)
		$('.right a').show();
		
		/* Reel Width */
		$('.reel').css('width',reelWidth);
		var reel = $('.reel');
		var currentPosition = reel.position().left;
		
		$('.right a').click(function(){
				
				if(currentPosition == -reelWidth + imageWidth){
				}else{
				reel.animate({'left': currentPosition - imageWidth},500);
				if(currentPosition == -reelWidth + 2*imageWidth){
					$(this).hide();
				}
				if($('.left a:hidden')){
					$('.left a').show();
				}
				currentPosition = currentPosition - imageWidth;
				}
			
			return false;
		});
		$('.left a').click(function(){
				
				if(currentPosition == 0){
				}else{
				reel.animate({'left': currentPosition + imageWidth},500);
				if(currentPosition == -imageWidth){
					$(this).hide();
				}
				if($('.right a:hidden')){
					$('.right a').show();
				}
				currentPosition = currentPosition + imageWidth;
				}
			
			return false;
		});

		
		
		
		
		
		
});//END OF READY