$(document).ready(function() {

$('.sectionbody').hide();

$('h3.sectiontitle, .rotateme').click( function() {
	if (!$(this).parent().find('h3.sectiontitle').hasClass('visible')) {
		$(this).parent().find('h3.sectiontitle').addClass('visible');
		$(this).parent().find('div.rotateme').animate({rotate: '90deg'}, 0);
		$(this).parent().find('div.sectionbody').slideDown('slow');
	} else {
		$(this).parent().find('h3.sectiontitle').removeClass('visible');
		$(this).parent().find('div.rotateme').animate({rotate: '0deg'}, 0);
		$(this).parent().find('div.sectionbody').slideUp('slow');
	}

});

$('.filterlink-switch').addClass('on');

$('.filterlink-switch').click(function() {
	var filterVal = $(this).attr("title");
	if (!$(this).hasClass('on')) {
			
		$(this).addClass('on');
		$(this).removeClass('off');
		$(this).animate( {backgroundPosition: '40px 0px'} );
		$('.allwork').each(function() {
		$(this).removeClass('on');
			if($(this).hasClass(filterVal)) {
				$(this).show('slow').addClass('hidden');
			}
		});
				
	} else  { /* switch is off */
			
		$(this).removeClass('on');
		$(this).addClass('off');
		$(this).animate( {backgroundPosition: '0px 0px'} );
		$('.allwork').each(function() {
			if($(this).hasClass(filterVal)) {
				$(this).hide('slow').removeClass('hidden');
			}
		});
	}
				
});

// Helvetica poster rotate
$('.rotate').toggle(function(){
	$(this).animate({rotate: '180deg'}, 0);
},function(){
	$(this).animate({rotate: '0deg'}, 0);
});


$('.loadsamp').click(function() {
	var filterVal = $(this).attr("title");
	var sampPath = '/work/'+filterVal+'.html';
		
	$.fancybox({
		'hideOnContentClick': false,
		'autoDimensions':	false,
		'opacity'		:	true,
		'scrolling'		:	'no',
		'width'			:	'960',
		'height'		:	'480',
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	400, 
		'speedOut'		:	200,
		'href'			:	sampPath,
		'overlayShow'	:	true,
		'centerOnScroll':	true

	});

});


$("a.contactform").fancybox({
		'hideOnContentClick': false,
		'autoDimensions':	false,
		'opacity'		:	true,
		'scrolling'		:	'no',
		'width'			:	'640',
		'height'		:	'460',
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	400, 
		'speedOut'		:	200, 
		'overlayShow'	:	true,
		'centerOnScroll':	true

});


/* ------- nufase.com */
});
