$(document).ready(function(){
	// WELCOME BANNER
	/// Set the variables
	var welcomeBanner	= $('#banner-home');
	var welcomeShow		= $('#welcome-banner-show');
	var welcomeShowLink	= $('#welcome-banner-show a');
	var welcomeHide		= $('#welcome-hide', $('#banner-home'));
	
	//When the hide button is clicked
	welcomeHide.click(function(){
		$(this).parents('#banner-home').slideUp('slow', function() {
			welcomeShow.delay(5000).css('visibility', 'visible')				//show footer link
			welcomeShowLink
				.animate({ paddingTop: '40px', paddingBottom:'20px' }, 500, "easeOutElastic")
				.animate({ paddingTop: '10px', paddingBottom:'10px' }, 750, "easeOutCirc"); 
		});
		//Set cookie
	  	var cookieDate = new Date(); 											//register date variable
	 	cookieDate.setTime(cookieDate.getTime() + (60 * 60 * 1000)); 			//set to 60 min
	  	$.cookie('bannerCookie', 'closed', { path: '/', expires: cookieDate });	//set cookie
	});
	
	//When the show button is clicked
	welcomeShowLink.click(function() { 
		$.cookie('bannerCookie', null, { path: '/' });			//Delete cookie
		welcomeBanner.animate({ opacity: 'show' }, 'slow');		//Show banner
		$('html, body').animate({scrollTop:0}, 'slow');		//Scroll up to the top
		welcomeShow.css('visibility', 'hidden'); 				//Hide the show link
		return false;	
	});
	
	//Show delete button on hover
	welcomeHide.hide();
	welcomeBanner.hover(function() {
    	welcomeHide.animate({ opacity: 'show' }, 'slow');
	}, function() {
		welcomeHide.animate({ opacity: 'hide' }, 'fast');
	});
	
	//Cookies
	var bannerCookie 	= $.cookie('bannerCookie'); //register cookie
	//Set the display based on cookie selection
	if (bannerCookie == 'closed') {
		//welcomeBanner.css('display','none');
		welcomeBanner.removeClass('open').addClass('closed');
		welcomeShow.css('visibility', 'visible');
	} else {
		welcomeBanner.removeClass('closed').addClass('open');	
		welcomeShow.css('visibility', 'hidden');
	}
});



$(document).ready(function(){
/*------------------------------
	S O C I A L   M E D I A
-------------------------------*/
	$('#social ul').kwicks({  
		min: 40,
		sticky: true,
		spacing: 20,
		duration: 500,
		easing: 'easeOutCirc',
		event : 'click'
		}); 
	
	$("#social li").click(function(){
    	window.location=$(this).find("a").attr("href");return false;
	});
});


	
$(document).ready(function(){
/*------------------------------
	F O R M S
-------------------------------*/
	//Displaying the form fields title as text inside
	$('label').inFieldLabels();
});

	
$(window).load(function() {
/*------------------------------
	G E N E R A L
-------------------------------*/
	//Scroll back home
	$('a[href=#top]').click(function(){
        $('html, body').animate({scrollTop:0}, 'slow');
        return false;
    });
	//Scroll to anchor
	 $('.portfolio.intro-wrapper li a').smoothScroll({offset: -125});
});


$(window).load(function() {
/*------------------------------
	P O R T F O L I O
-------------------------------*/
	// Portfolio thumbnail text bounce
	$('.thumbnail').hover(function() {
		$(this).parent.find('h5').stop().animate({ marginTop: '10px', marginBottom: '5px' },200); 
	}, function() { //mouse out
		$(this).parent.find('h5').stop().animate({ marginTop: '4px', marginBottom: '10px'},100); 
	});

});