$(document).ready(function(){

	$("#footer_content a").fadeTo(1, 0.4);
	
    $(".metaopener span").click(function () {
      $(".metadata").slideToggle("slow");
    });
            
    $("#footer_content a").hover(
    
    	function(){
    		$(this).stop().fadeTo("normal", 1);
    	},
    
    	function(){
    		$(this).stop().fadeTo("normal", 0.4);
    	}
    );
    
    $('#comment').elastic();
    
    
    $('#commentform p label').each(function(){
        var restingPosition = '25px';

        // style the label with JS for progressive enhancement
        $(this).css({
                'position' : 'relative',
                'top' : restingPosition,
                'left' : '5px',
                'display' : 'inline',
                'z-index' : '99',
                'color' : '#999'
        });

        var inputval = $(this).next().val();

        // grab the label width, then add 5 pixels to it
        var labelmove = '0';

        // onload, check if a field is filled out, if so, move the label out of the way
        if(inputval !== ''){
            $(this).stop().animate({ 'top':'-'+labelmove }, 1);
        }    	

        // if the input is empty on focus move the label to the left
        // if it's empty on blur, move it back
        $('input, textarea').focus(function(){
            var label = $(this).prev('label');
            var adjust = '0';
            var value = $(this).val();

            if(value == ''){
                label.stop().animate({ 'top':'-'+adjust }, 'fast');
            } else {
                label.css({ 'top':'-'+adjust });
            }
        }).blur(function(){
            var label = $(this).prev('label');
            var value = $(this).val();

            if(value == ''){
                label.stop().animate({ 'top':restingPosition }, 'fast');
            }	

        });
    }) // End "each" statement    

    
});