$(document).ready(function(){
			//Comment form handler
			$('#comment-form-holder').jqm();
			
			//open modal
			$("a#comment-button").live("click",function(e){
			e.preventDefault();
			
			$('#comment-form-holder').jqmShow();
			$('#comment-form-holder').center();
			$("#comment-success").hide();
			$("#comment-error").hide();
			$("form#comment-form").reset();
			$("form#comment-form").show();
			$("#comment-loader").hide();
			});
			
			$("form#comment-form").bind("submit",function(e){
				e.preventDefault();
				$("#comment-loader").show();
				$.post(base_url+"/comments-ajax.php", $(this).serialize(), function(data){
					
					if(data == 'success')
					{
						$("#comment-error").hide();
						$("form#comment-form").hide();
						$("#comment-success").show();
						setTimeout(function() { 
        		$('#comment-form-holder').jqmHide();
    				}, 3000);
					}
					else
					{
						$("#comment-error").html(data);
						$("#comment-error").show();
						$("#comment-loader").hide();
					}
					
				});
			});
						
	});
	jQuery.fn.reset = function () {
  		$(this).each (function() { this.reset(); });
			}
