jQuery.noConflict(); jQuery(document).ready(function($) { $('.kws_form:not(.has_errors):not(.has_success) input[type=text]').clearText(); $('.kws_form .cc_success').vAlign(); }); (function (jQuery) { jQuery.fn.clearText = function() { return this.focus(function() { if( this.value == this.defaultValue ) { this.value = ""; } }).blur(function() { if( !this.value.length ) { this.value = this.defaultValue; } }); }; })(jQuery); (function (jQuery) { jQuery.fn.vAlign = function() { return this.each(function(i){ var ah = jQuery(this).height(); var ph = jQuery(this).parent().height(); var mh = (ph - ah) / 2; jQuery(this).css('margin-top', mh); }); }; })(jQuery);