$(document).ready(function(){

/*	$('#FBLogout').click(function (){
		return false;
	});
*/
	// LOGIN FORM //
	
	$("#login_form").hide();
	
//	$("#login_btn a").click(function() {
//		$("#login_form").animate({
//			opacity: 1,
//			height: "toggle"
//		}, 200, function() {
//		});
//	});
	
	$("#login_btn a").click(function() {
		$("#login_form").slideToggle("fast");
	});
	
	$("#login_btn a").toggle(function() {
		$("#login_form form").animate({opacity: "1"}, 400);
		}, function() {
		$("#login_form form").animate({opacity: "0"}, 200);
	});
	
	$("#login_btn a").not("#main_nav li.active a").hover(function() {
		$(this).stop().animate({color: "#fff"}, 200);
		},function() {
		$(this).stop().animate({color: "#aaa"}, 200);
	});

	// MAIN NAVIGATION FADE COLORS //

	$("#main_nav li a").not("#main_nav li.active a").hover(function() {
		$(this).stop().animate({color: "#fff"}, 200);
		},function() {
		$(this).stop().animate({color: "#aaa"}, 200);
	});
	
	// INFIELD LABELS FADE //

	$("#login_form label, #main_search label").inFieldLabels();
	// FOOTER COURSES FADE COLORS //

	$("#footer .container a").hover(function() {
		$(this).stop().animate({color: "#6a2"}, 300);
		},function() {
		$(this).stop().animate({color: "#aaa"}, 300);
	});
	
	// FOOTER CREDIT FADE COLORS //

	$("#credit a").hover(function() {
		$(this).stop().animate({color: "#6a2"}, 300);
		},function() {
		$(this).stop().animate({color: "#888"}, 300);
	});
        
        
        $('body').click(function(event) {
            
            if($(event.target).attr('class') == "state_search" || $(event.target).attr('id') == "search"){
                $('#search_state').toggle();
            }
            else if($(event.target).parent('ul').attr('id') == "search_state"){
                $('#search_state').hide();
                
                $(event.target).parents('div').children('span').html($(event.target).html());
                
                $('input[name="data[Search][state]"]').val($(event.target).attr('id').substring(6));
            }
            else{
                $('#search_state').hide();
            }
        });
});

