Comment 	=	new function()
{
	this.saveIt		=	function(type)
	{
	
		if(this.validateForm(type) === true)
		{
		var params = "comment="+$("comment").value+"&logged="+type+"&news_id="+$('nID').value+"&name="+$('name').value+"&email="+$('email').value;
			
		hdr ="Content-type", "application/x-www-form-urlencoded";
        hdr +="Content-length", params.length;
      	hdr +="Connection", "close";
      	hdr +="Accept",	"text/javascript, text/html, application/xml, text/xml";
			
		url	=	"/stiri/comment"
			  new Ajax.Request(url,{
			  method: 'post',
			  headers: hdr,
			  parameters: params,
			  onSuccess: function(transport) {
			  				  	
			    if (transport.responseText == "1")
			    {
			    	$("rmvbl").hide();
			    	
			    	$("information").innerHTML	=	"Comentariul tau a fost salvat. \n Un moderator il va confirma in cel mai scurt timp";
			    	$("comments").removeChild($("rmvbl"));
			    }
				if (transport.responseText.indexOf("e3") !== "-1")
				{
					message =   transport.responseText.replace("e3", "");
					$("information").innerHTML	=	message;
				}
			  }
			});
		}
		else this.handleErrors(this.validateForm(type));
	}
	
	var errorListener	=	new Array();
	var minChars		=	10;
	
	this.validateForm	=	function(type)
	{
		return true;
	}
	
	this.handleErrors	=	function(errorListener)
	{
		$("comment").style.border 	=	"1px solid red";
		var error 	=	"";
		for(i = 0; i<=errorListener.length - 1; i++)
		{
			error	+=	errorListener[i];
			
		}
		$("information").innerHTML	=	error;		
	}
};