//Background Slider
$(document).ready(function() {
	$('#backgroundSlider').cycle({
		pause: 0,
		speed: 1000,
		timeout: 3500,
		sync: 1
	});
	//
	$.fn.supersized.options = {  
		startwidth: 640,  
		startheight: 480,
		vertical_center: 1
	};
	$('#backgroundSlider').supersized(); 
	
});

// Slider Projects
$(document).ready(function() {
	$('#backgroundSlider.projects').before('<ul id="navSlider">').cycle({
		pause: 0,
		speed: 500,
		sync: 1,
		timeout: 0,
		fx: 'fade',
		prev: '#prevImage',
		next: '#nextImage', 
		pager: '#navSlider',
		
		pagerAnchorBuilder: function(idx, slide) { 
		        return '#navSlider li:eq(' + idx + ')'; 
		    }  
	});
	
	// Gallery Slider, via http://bit.ly/9F2kgm
		var conveyor = $("#navSlider", $("#sliderContainer")),
		item = $(".item", $("#sliderContainer"));
				
		conveyor.css("width", (item.length * (parseInt(item.css("width")) ) - 19 ) );
					
		var sliderOpts = {
			max: (item.length * ( parseInt(item.css("width")) ) ) - parseInt($("#slider", $("#sliderContainer")).css("width")),
			slide: function(e, ui) { 
				conveyor.css("left", "-" + (ui.value - 19) + "px");
			}
		};
		$("#sliderMover").slider(sliderOpts);
	
});

// Uniform
$(document).ready(function(){
	$('select').uniform();
});

//Tabs
$(document).ready(function(){
		$('.tabs').tabs();
});

//Slider Novidades
/*$(document).ready(function(){
	$('.scrollable').scrollable( {circular: true} );
});*/

// Gallery Hover
$(document).ready(function() {
	$('#galleryList li a.bg').hover (function() {
		$(this).css( {backgroundPosition: '0 -187px'} );
	}, function() {
		$(this).css ({backgroundPosition: '0 0'});
	});
});

//Project Tags
$(document).ready(function() {
	$('#bottomWrap a.prevProject').hover (function() {
		$(this).animate({left:'2px'});
	}, function() {
		$(this).animate({left:'22px'});
	});
	
	$('#bottomWrap a.nextProject').hover (function() {
		$(this).animate({right:'2px'});
	}, function() {
		$(this).animate({right:'22px'});
	});
});

// Hide Content
$(document).ready(function() {	
	$('#bottomWrap.pages').hover (function() {
		$('#bottomWrap.pages').stop().animate({bottom:'33px'}, 2000);
	}, function() {
		$('#bottomWrap.pages').stop().animate({bottom:'-156px'}, 2000);
	});
});

// Slider projectos
$(document).ready(function() {
	$('.projectList .lessProjects').addClass('inactive');
	$('.projectList .moreProjects').click (function() {
		$('#galleryList ul').animate(
			{left:'-288px'},
			{duration: 1500, complete: function() {
				$('.projectList .moreProjects').addClass('inactive');
				$('.projectList .lessProjects').removeClass('inactive');
			}
		});
	});
	$('.projectList .lessProjects').click (function() {
		$('#galleryList ul').animate(
			{left:'9px'},
			{duration: 1500, complete: function() {
				$('.projectList .lessProjects').addClass('inactive');
				$('.projectList .moreProjects').removeClass('inactive');
			}
		});
	});
});
