//*************************************
//			Login Panel Animation 	  *
//*************************************
$(document).ready(function(){
    var opened;
	
	$("#loginpanel").hide();
	
	
	// Handle login form at bottom of page
    $("#loginbtn").toggle(function(){
    	$('#loginpanel').fadeIn(200);
    	$('#loginform #email').focus();
    	return false;
    },function(){
    	$('#loginpanel').fadeOut(400);
    	return false;
	});
	
	// validate login form
	$(".validform").validate({
	   invalidHandler: function() {
	   	 $('.form_loading_icon').hide();
	   }
	});
    
	//form send show loader
	$('.formSUBMIT').click(function(){
    	$(this).next(".form_loading_icon").hide().fadeIn(200);
    });    
	
	//form animate
	$(".form_container").hide().fadeIn(400);
	
	// fade in/out nav on hover
	$("#nav li")
	.fadeTo(1000, 0.8)
	.mouseover(function(){
		$(this).stop().fadeTo(150, 1);
	})
	.mouseout(function(){
		$(this).stop().fadeTo(150, 0.8);
	})
	
	// set nav active state on click
	$("#nav a").click(function(){
		$("#nav a").removeClass("active");
		$(this).removeClass("inactive").addClass("active")
	})
	
	// disable submit buttons on submit
	$(".form").submit(function(){
		$("#send_btn").fadeTo(70).attr('disabled', 'disabled');
	});
	
	// fade in/out logo
	$('#aurer-logo').fadeTo(1500, 0.6)
	.mouseover(function(){
		$(this).fadeTo('fast', 1);
	})
	.mouseout(function(){
		$(this).fadeTo('fast', 0.6);
	});
	
	// Gallery nav animation
	$('#gallery_nav li').hover(function(){
		$(this).stop(true).animate({"top": -5, "paddingBottom": 15},100);
		$(this).contents('a').stop(true).animate({"paddingBottom":15}, 100);
	},function(){
		$(this).stop(true).animate({"top": 0, "paddingBottom": 10},100);
		$(this).contents('a').stop(true).animate({"paddingBottom":10}, 100);
	})
	
	// Social links animation
	$("#social-links a").hover(function(){
		var w = $(this).contents('span').width()+40;
		$(this).stop(true).animate({"width":w}, 200, "easeOutExpo");
	},function(){
		$(this).stop(true).animate({"width":25}, 200, "easeInExpo");
	})
	
});


