// JavaScript Document
jQuery(document).ready(function(){
	jQuery('.work-permalink').hover(function () {
		jQuery(this).find('.bg-alpha').fadeIn(700);
	}, function () {
		jQuery(this).find('.bg-alpha').fadeOut(700);
	});	
	
	jQuery('a.work-permalink, .slider-item a').hover(
	 function() {
	  jQuery(this).attr("title","");
	 },
	 function() {
	  jQuery(this).attr("title",originalTitle);
	 }
	);	
	jQuery('.slider-item').hover(function () {
		jQuery(this).find('.bg-alpha').fadeIn(700);
	}, function () {
		jQuery(this).find('.bg-alpha').fadeOut(700);
	});	
	
	var invoke_slide_work = function(){
		jQuery('.slide').cycle({
			fx: 'fade',
			next:  '#next-slider-project',
			prev: '#prev-slider-project',
			easing:'easeOutBack',
			height:'auto',
			timeout: 0
		});
	}
	
	var destroy_slide_work = function(){
		jQuery('.slide').cycle('destroy');
	}
	
	jQuery('#mode-slider').click(function () { 
		jQuery('#work-gallery').removeClass('all');
		jQuery('#work-gallery').addClass('slide');
		jQuery('#slider-project-nav').addClass('slider_active');
		jQuery('#mode-showall').removeClass('showall_active');
		invoke_slide_work();
		jQuery.cookie('mode_slide', 'slide');
		return false;
	});
	
	jQuery('#mode-showall').click(function () { 
		destroy_slide_work();
		jQuery('#work-gallery').removeClass('slide');
		jQuery('#work-gallery').addClass('all');
		jQuery('#work-gallery').removeAttr('style');
		jQuery('#work-gallery .wp-caption').removeAttr('style');
		jQuery('#mode-showall').addClass('showall_active');
		jQuery('#slider-project-nav').removeClass('slider_active');
		jQuery.cookie('mode_slide', 'all');
		return false;
	});	
});

