function clear()
{
document.getElementById('fill_comment').value="";
document.getElementById('user_id').value="";
document.getElementById('cid').value="";
document.getElementById('business_id').value="";
}

/*Clear function End*/

jQuery(document).ready(function(){ 
        jQuery('#save_mom').click(function() {
		 var fill_comment = jQuery("#fill_comment").val();
		  if(fill_comment == '')
		{
			jQuery.blockUI({message:  '<h1>Please Enter Comments you cant add blank comments...</h1>', css: { 
	                    border: 'none', 
	       			    padding: '15px', 
	        			backgroundColor: '#000', 
	        			'-webkit-border-radius': '10px', 
	        			'-moz-border-radius': '10px', 
	        			opacity: '.5', 
	        			color: '#fff' 
	    				} 
					}); 
			
			
					
				
		    
			jQuery.ajax({ 
	                url: 'images/waits.gif',
					cache: false, 
	                complete: function() { 
	                 	setTimeout(jQuery.unblockUI, 2000);
						return false;
						clear();
						location.reload();
					  } 
	            });
			
		}
		else
		{
	   
	    jQuery.blockUI({ message: jQuery('#question'), css: { width: '360px' } });
		}
		}); 
		
		
		jQuery('#yes').click(function() {
		 
	    var fill_comment = jQuery("#fill_comment").val();
		var user_id = jQuery("#user_id").val();
		var cid = jQuery("#cid").val();
		var business_id = jQuery("#business_id").val();
		
		
				
		
		if(user_id != '' && fill_comment!='')
		{
		
			jQuery.blockUI({message:  '<h1>Comment Save Successfuly...</h1>', css: { 
	                    border: 'none', 
	       			    padding: '15px', 
	        			backgroundColor: '#000', 
	        			'-webkit-border-radius': '10px', 
	        			'-moz-border-radius': '10px', 
	        			opacity: '.5', 
	        			color: '#fff' 
	    				} 
					}); 
			
			
				jQuery("#disp_comments").load("savecomment.php",{fill_comment:fill_comment,user_id:user_id,business_id:business_id});	
				
		    
			jQuery.ajax({ 
	                url: 'images/waits.gif',
					cache: false, 
	                complete: function() { 
	                 	setTimeout(jQuery.unblockUI, 2000);
						clear();
						location.reload();
					  } 
	            });
			jQuery("#all_comments").load("display_comments.php"); 
		
		}
		
		
			
		else{
			
			
			
			jQuery.blockUI({message:  '<h1>Your no loged in. if you have register user please loged in first and create new account...</h1>', css: { 
	                    border: 'none', 
	       			    padding: '15px', 
	        			backgroundColor: '#000', 
	        			'-webkit-border-radius': '10px', 
	        			'-moz-border-radius': '10px', 
	        			opacity: '.5', 
	        			color: '#fff' 
	    				} 
					}); 
			
			 
				window.location.replace("login.php?cid="+cid+"&login=login");
			
			
		}
	
	
	 });
		
		
       jQuery('#no').click(function() { 
            jQuery.unblockUI(); 
            return false; 
        }); 
         
        
        
    });

/*Save function End*/

function del_comments(del_comments)
{
	//var del_coo=del_comments;
	//jQuery("#disp_comments").load("del_comments.php",{del_coo:del_coo});
	//jQuery("#all_comments").load("display_comments.php");
}
