
$(document).ready(function(){

	// opens nav
	$("#navClick").click(function(){
		$("#navBox").slideToggle("fast");
		$('.dropdownTitle').html('View all');
		$("ul#navitems li a.reset").css('color', '#000');
	});
	
	// toggles info / close buttons
	$('a#infoToggleButton').toggle(function() {
		$('.contentBox', $(this).parent().parent()).animate({"opacity": "1"}, 500);
		$(this).addClass('close');
	}, function() {
		$('.contentBox', $(this).parent().parent()).animate({"opacity": "0"}, 500);
		$(this).removeClass('close');
	});
	
	// drop down box
	$(".dropdownTitle").click(function(e) {
		if($(".dropdownTitle").hasClass('open')) {
			$(".dropdown").slideUp("fast");
			$(this).removeClass('open');	
		}
		else {
			$(".dropdown").slideDown("fast");
			$(this).addClass('open');
		}
	});
	
	// clears input box
    $(".signup").focus(function(srcc){
        if ($(this).val() == $(this)[0].title){
            $(this).val("");
        }
    });
   
    $(".signup").blur(function(){
        if ($(this).val() == ""){
            $(this).val($(this)[0].title);
        }
    });
   
    $(".signup").blur(); 
	
	// Comment form focus and labels
	$('#comments input:text, #comments textarea').focus( function(){
		var label = $( 'label[for='+$(this).attr('id')+']' ).text();
		if( $(this).val() == label ) $(this).val('');
	});
	$('#comments input:text, #comments textarea').blur( function(){
		var label = $( 'label[for='+$(this).attr('id')+']' ).text();
		if( $(this).val() == '' ) $(this).val( label );
	});
	$('#comments label').css('display','none');
	$('#comments input:text, #comments textarea').blur();
	
	$('#comments form').submit(function(){
		$('#comments input:text, #comments textarea').each( function(){
			var label = $( 'label[for='+$(this).attr('id')+']' ).text();
			if( $(this).val() == label ) $(this).val( '' );
		});
	})
});
