$(function(){	
	
	$.krypton.tooltip();
	$.krypton.zebra();
	
	$('.red_overlay').fadeTo('fast', 0.5); 
	$('.title_overlay').fadeTo('fast', 0.9); 
	
	$("a.fancy").fancybox({ 'titleShow' : false, 'transitionIn'	: 'elastic', 'transitionOut' : 'elastic', 'width' : '90%' });
	
	var c1_h = $('#Container').height();
	
	$('#work_btn').click(function(){
		$('#Container').animate({'marginTop': c1_h*-1 }, {duration: 1500, easing: 'easeInOutSine'});
		$('#Container2').slideDown(300, 'easeInOutSine');
		return false;
	});
	
	$('.work_list2 li a .img').hoverIntent({ over: workOn, timeout: 75, out: workOff });
	
	function workOn(){   
		$(this).children('.red_overlay').stop().fadeTo('150', 0, 'easeInOutSine');
		$(this).children('.magnify_icon').stop().animate({ top: '140px'}, 100, 'easeInOutSine');
	}
	
	function workOff(){ 
		$(this).children('.red_overlay').stop().fadeTo('250', .4, 'easeInOutSine');
		$(this).children('.magnify_icon').stop().animate({ top: '170px'},100, 'easeInOutSine', function(){
			$(this).css({ top: '170px'});
		});
	}
	
	
	
	$('.block_list').each(function(index) {
		var calc = index*960;
		//alert(calc);
		$(this).css({ left: calc});	
		
	});
	
	
	$('#work_next').click(function(){
		$('#tray_1').animate({ left: -960}, 300, 'easeInOutSine');
		
		$(this).fadeOut(150, 'easeInOutSine');
		$('#work_previous').fadeIn(150, 'easeInOutSine');
	});
	
	$('#work_previous').click(function(){
		$('#tray_1').animate({ left: 0}, 300, 'easeInOutSine');
		$(this).fadeOut(150, 'easeInOutSine');
		$('#work_next').fadeIn(150, 'easeInOutSine');
	});
	
	
	$('#work_previous').hoverIntent({ over: prv_over, timeout: 75, out: prv_out });
	$('#work_next').hoverIntent({ over: next_over, timeout: 75, out: next_out });
	
	function prv_over(){   
		$(this).children('#arrow_white').stop().animate({ left:'0px'},100, 'easeInOutSine');
		$(this).children('#arrow_shadow').stop().animate({ top: '295px', left:'6px'},100, 'easeInOutSine');
	}
	
	function prv_out(){  
		$(this).children('#arrow_white').stop().animate({ left:'2px'},100, 'easeInOutSine'); 
		$(this).children('#arrow_shadow').stop().animate({ top: '292px', left:'4px'},100, 'easeInOutSine');
	}
	
	
	function next_over(){   
		$(this).children('#arrow_white').stop().animate({ right:'0px'},100, 'easeInOutSine');
		$(this).children('#arrow_shadow').stop().animate({ top: '295px', right:'6px'},100, 'easeInOutSine');
	}
	
	function next_out(){  
		$(this).children('#arrow_white').stop().animate({ right:'2px'},100, 'easeInOutSine'); 
		$(this).children('#arrow_shadow').stop().animate({ top: '292px', right:'4px'},100, 'easeInOutSine');
	}
	
	
	
	
	
	
	
	$('#backtotop').click(function(){
		$('#Container').animate({'marginTop': 0 }, 1500,'easeInOutSine', function(){
			$('#Container2').hide(1);
		});
		return false;
	});
	
	//$('.work_list li a .img img').pixastic("desaturate");
	
	
	
	
	
	
});



