$(document).ready(function() {
			
	// Menu Scroll
	$('a.nav').click(function() {
		$.scrollTo(this.hash, 1000, {offset: {top:-130}});
		$('a.nav').removeClass("selected");
		$(this).addClass("selected");
		return false;
	});


	// Thumb Hover
	$('#featured li').hover(function() {
		$(this).find('img').stop().animate({ 'opacity': '0.05' }, 'fast');
	}, function() {
		$(this).find('img').stop().animate({ 'opacity': '1' }, 'fast');
	});
	
	
	// Featured Nav
	var slider = $('.slider1').bxSlider({
		wrapperClass: 'wrapper',
		hideControlOnEnd: true,
		speed: 500  
	});
	
	$('#featured li a').click(function(){
		var thumbIndex = $('#featured li a').index(this);
		slider.goToSlide(thumbIndex);
		$('#featured li a').removeClass('pager-active');
		$(this).addClass('pager-active');
		return false;
	});
		
/*	
	$('.bx-next').click(function(){
		$('.slider2').each(function(){
			$(this).cycle({
				timeout: 0,
				before:function (curr, next, opts) {var index = opts.currSlide; $index=0; $('.prev').hide(); $('.next').show();}	
			});
		});
	});	
*/
	

	// Project Slider
	$('.slider2').each(function(){
		$(this).cycle({
			timeout: 0,
			speed: 500,
			fx: 'fade',
			next: $(this).parent().find('.next'),
			prev: $(this).parent().find('.prev'),
			/*
after:function (curr, next, opts) {var index = opts.currSlide;$('.prev')[index == 0 ? 'hide' : 'show']();
												//$('.next')[index == opts.slideCount - 1 ? 'hide' : 'show']();
											}
*/
		});
	});
	
	$('input[type="text"]').focus(function() {
	   if ($(this).hasClass('error')) {
	       $(this).keyup(function() {
	           $(this).prev().removeClass('error');
	       });
	   }
	});
	
	
	//Social network tooltip
		$('#social a').qtip({
               position: {
                  corner: {
                     tooltip: 'topMiddle', 
                     target: 'bottomMiddle' 
                  }
               },
               style: {
                  border: {
                     width: 1,
                     radius: 5,
                     color: '#6e6e6e'
                  },
                  padding: 7, 
                  textAlign: 'center',
                  color: '#DD2400',
                  fontSize: '14px',
                  tip: true
               }
            });
	
});
