jQuery(document).ready(function () {
	jQuery('.content span.pullquote').each(function () {
		jQuery(this).parent().before('<blockquote class="pullquote">'+jQuery(this).text()+'</blockquote');
	});
	
	// show the content that does nothing with javascript disabled
	jQuery('.options a:hidden').css('display','block');
	
	
	// fix the min-height/menu problem for short entries
	// wouldn't it be wonderful if css could do this?
	jQuery('.main_entry').css('min-height', '0px');
	var t = parseInt(jQuery('.aside.subnavigation').css('top')) + parseInt(jQuery('.aside.subnavigation').height()) + 100 + 25;
	if (jQuery('.options').length > 0 && parseInt(jQuery('.options').position().top) < t) jQuery('.options').css('top', t + 'px');
	jQuery('.comment_count .options').css('top', 'auto');
	
	
	// form validation
	jQuery('body:not(.wp-admin,#media-upload) form.validate').submit(function () {
		var $form = jQuery(this);
		$form.find('[type=submit]').attr('disabled', 'disabled');
		$form.find('.ajax-loader').show();
	}).validate({
		/*submitHandler: function(form) {
			jQuery(form).ajaxSubmit(function () {
			});
		},*/
		invalidHandler: function(form, validator) {
			var $form = jQuery(form.currentTarget);
			$form.find('[type=submit]').attr('disabled', false);
			$form.find('.ajax-loader').hide();
		},
		errorElement: 'span',
		highlight: function(element, errorClass, validClass) {
			jQuery(element).parent().andSelf().addClass(errorClass);
		},
		unhighlight: function(element, errorClass, validClass) {
			jQuery(element).parent().andSelf().removeClass(errorClass);
		},
		showErrors: function(errorMap, errorList) {
			this.defaultShowErrors();
			jQuery('span.error').addClass('note');
		}
	});
});