$(document).ready(function(){
    // Global form placeholder support

    if (!Modernizr.input.placeholder && typeof ie === 'undefined') {
    	$('label').addClass('inlined');
	
    	$("label.inlined + input.input-text").each(function (type) {            
            if (!$(this).val() == "") {
                $(this).prev("label.inlined").addClass("has-text");
            }

            $(this).focus(function () {
                $(this).prev("label.inlined").addClass("focus");
            });

            $(this).keypress(function () {
                $(this).prev("label.inlined").addClass("has-text").removeClass("focus");
            });

            $(this).blur(function () {
                if($(this).val() == "") {
                    $(this).prev("label.inlined").removeClass("has-text").removeClass("focus");
                }
            });
        });
    } else {
        Modernizr.load([
    		{
    			test: Modernizr.input.placeholder,
    			nope: '/js/jquery/jquery.placeholder.min.js',
    			complete : function () {
    				if (!Modernizr.input.placeholder) {
    					$('input, textarea').placeholder();
    				}
    		    }
    		}
    	]);
    }
});
