/*

http://www.brettdewoody.com/projects/movable_type/mt_ajax_comments/index.php

*/

		function ajax_comment_post()
		{
			Form.disable('comments-open-footer');
//			new Effect.Appear('progress', {duration: 0.0});
			var url = '/mt/mt-comments.cgi';
			var pars = Form.serialize('comments_form');
			if (pars.indexOf("post=") == -1)
				pars += '&post=Post';
			var myAjax = new Ajax.Updater( 'comment_posted', url, { 
																		method: 'post', 
																		parameters: pars,
																		onComplete: highlight_comment
																		});	
			
			
			return false;
		}
		
		function highlight_comment()
		{
//			new Effect.Fade('comment_form_block', { duration: 0.2, queue:'end' });
//			new Effect.Appear('comment_posted', { duration: 0.5, queue:'end' } );
//			new Effect.Highlight('comment_posted',{ startcolor: '#FF9933', duration: 2.0 });
			$('comment_posted').show();
			comment_enable();
		}
		
		function ajax_preview_comment()
		{
			var url = '/mt/mt-comments.cgi';
			var pars = Form.serialize('comments_form').replace(/post=Post&?/i, "");
			if (pars.indexOf("preview=") == -1)
				pars += '&preview=Preview';
			var myAjax = new Ajax.Updater( 'comment_posted', url, { 
																		method: 'post', 
																		parameters: pars,
																		onComplete: highlight_preview_comment
																		});	
			
			return false;
		}
		
		function highlight_preview_comment()
		{
//			new Effect.Appear('comment_posted', { duration: 0.5, queue:'end' } );
//			new Effect.Highlight('comment_posted',{ startcolor: '#FF9933', duration: 2 });
			$('comment_posted').show();
			comment_enable();
		}
		
		function comment_enable()
		{
			Form.enable('comments-open-footer');
		}
