// JavaScript Document
function sendRichiestaContatto()
{
	var xmlHttpComment=GetXmlHttpObject();
	if (xmlHttpComment==null)
  {
		alert ("Your browser does not support AJAX!");
		return;
  }
	
	var mail=encodeURIComponent($("#mail").val());
	var messaggio=encodeURIComponent($("#messaggio").val());
	$("#loader").fadeIn("fast");
	$("#mail").css('border','1px solid #006633');
	$("#messaggio").css('border','1px solid #006633');
	
	if( mail=='' || messaggio=='')
		{
			$("#loader").fadeOut("fast");
			if(mail=='')$("#mail").css('border','1px solid #FF0000');
			if(messaggio=='')$("#messaggio").css('border','1px solid #FF0000');
			return;
		}
		
	var url=path+"/ajax.php?op=sendrichcont";

	var attID=($("#attID").val());
	var attName=($("#allegato").val());
	
	param="messaggio="+messaggio;
	param=param+"&mail="+mail;
	param=param+"&attID="+attID;
	param=param+"&attName="+attName;
	xmlHttpComment.open("POST",url,true);
	xmlHttpComment.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttpComment.setRequestHeader("Content-length", param.length);
	xmlHttpComment.setRequestHeader("Connection", "close");
	
	xmlHttpComment.onreadystatechange = function() {
						if (xmlHttpComment.readyState == 4 && xmlHttpComment.responseText!='') 
						{
							$("#commentdiv").html(xmlHttpComment.responseText);
							$("#commentdiv").fadeIn("fast");
						}
					}
	xmlHttpComment.send(param);
}


function sendCookieSi()
{
	var xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
		{
		alert ("Your browser does not support AJAX!");
		return;
		}
		
	var url=path+"/ajax.php";
	url=url+"?op=setcooksiono";
	xmlHttp.onreadystatechange = function() {
					if (xmlHttp.readyState == 4 && xmlHttp.responseText!='') {
						$("#result").html(xmlHttp.responseText);
					}
			}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


function InviaCommentoPost(newsid)
{
	var xmlHttpComment=GetXmlHttpObject();
	if (xmlHttpComment==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	
	var nome=encodeURIComponent($("#nome").val());
	var mail=encodeURIComponent($("#mail").val());
	var sito=encodeURIComponent($("#sito").val());
	var comment=encodeURIComponent($("#comment").val());
	$("#loader").fadeIn("fast");
	$("#nome").css('border','1px solid #006633');
	$("#mail").css('border','1px solid #006633');
	$("#comment").css('border','1px solid #006633');
	
	if(nome.length=='' || mail=='' || comment=='')
		{
			$("#loader").fadeOut("fast");
			if(nome=='')$("#nome").css('border','1px solid #FF0000');
			if(mail=='')$("#mail").css('border','1px solid #FF0000');
			if(comment=='')$("#comment").css('border','1px solid #FF0000');
			return;
		}
		
	var url=path+"/ajax.php?op=sendcomblog&news="+newsid;

	param="comment="+comment;
	param=param+"&nome="+nome;
	param=param+"&mail="+mail;
	param=param+"&sito="+sito;
	xmlHttpComment.open("POST",url,true);
	xmlHttpComment.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttpComment.setRequestHeader("Content-length", param.length);
	xmlHttpComment.setRequestHeader("Connection", "close");
	
	xmlHttpComment.onreadystatechange = function() {
						if (xmlHttpComment.readyState == 4 && xmlHttpComment.responseText!='') 
						{
							$("#commentdiv").html(xmlHttpComment.responseText);
							$("#commentdiv").fadeIn("fast");
						}
					}
	xmlHttpComment.send(param);
	
}