function savecomments(pmId)
{
	

	var name 	= $('#name').val();

	if(name == '')
	{
		alert("please Enter the name");
		$('#name').focus(); return false;
	}
	
	
	var comments 	= $('#comments').val();
	

	if(comments == '')
	{
		alert("pleasr enter message");
		
		$('#comments').focus(); return false;
	}
	
	
	
		
	
vQueryString = 'type=2&vPmId='+pmId+'&name='+encodeURIComponent(name)+'&comments='+encodeURIComponent(comments)+'&rand='+Math.random();





	


	$.ajax({
		   
		type : "POST",
		url	 :g_site_path+"ajax/comments",
		data : vQueryString,
		dataType: "xml",
		success: function(xml)
		
		{	
		
		
		$(xml).find('response').each(function(){
				var status = parseInt( $(this).find('status').text() );
				
				var  id =  $(this).find('id').text() ;
				
			
						
				
			
				if ( status == 1 ) 
				
				{ 					
	
	
		
		
setTimeout('reloadDiv("'+id+'")',100);

			
				}
				
				else
				{
		
		//$('#msg').html('<ul class=system_messages><li class=green><span class=ico></span><strong class=system_title>This is a positive message !</strong></li></ul>');
				}
											  });
				
		}
	});
	

}


function reloadDiv(id){ 




	$.ajax({
		type : "POST",
		url	 :g_site_path+"ajax/view-comments",
		data : 'vPmId='+id+'&rand='+Math.random(),
		dataType: "html",
		success: function(html){	
		
			$('#commentdiv').html(html);
		}
	});
}
		   
