$(document).ready(function()
{
	$("section.main form").each(function(){
		$(this).validate();
	});
	
	
    // Show/hide placeholder text
    $(".placeholders input, .placeholders textarea").each(function(){
        if (this.defaultValue)
            $(this).parent().addClass('active').addClass('focus');
    });
    $(".placeholders input, .placeholders textarea").live('focus',function() {
        if ($(this).val() == '')
            $(this).parent().addClass('focus');
    });
    $('.placeholders input, .placeholders textarea').live('keydown', function(event)
    {
        $(this).parent().addClass('active');
        // if ($(this).val() == '')
        //             $(this).parent().removeClass('active');
    }); 
    $(".placeholders input").live('blur', function() {
        if ($(this).val() == '')
            $(this).parent().removeClass('focus').removeClass('active');
    });
    $('.placeholders label').live('click', function(){
        $(this).siblings('input').focus();
    });
    
    // Replace form text
    $(".replace").live('focus',function() {
        if ($(this).val() == this.defaultValue)
            $(this).val("").toggleClass('userText');
        });
        $(".replace").live('blur', function() {
        if (!$(this).val())
            $(this).val(this.defaultValue).toggleClass('userText');
    });

});
