function AddComment(userid,prjid)
{
	var ajax = getXMLHttpRequest();
	var note = document.getElementById('note').value;
	if(ajax) {
	ajax.open("get","libs/project_action.php?action=addcomment&content="+note+"&userid="+userid+"&project_id="+prjid, true);
	ajax.setRequestHeader("connection", "close");
	ajax.onreadystatechange = function() {

	if(ajax.readyState === readyState.COMPLETATO) {
		
		if(statusText[ajax.status] === "OK")
		{
			if(ajax.responseText == "0")
			{
			alert("You must be Logged!");	
			}
			else
			{
			document.getElementById('comment_container').innerHTML = ajax.responseText;
			document.getElementById('note').value = "";	
			}
		}
		else 
		{
		 return false;
		}
	  } 
	}
	// invio richiesta
	ajax.send("");
	}
}

function AddCommentFree(userid,prjid)
{
	var ajax = getXMLHttpRequest();
	var note = document.getElementById('note').value;
	var name = document.getElementById('name').value;
	if(ajax) {
	ajax.open("get","libs/project_action.php?action=addcommentfree&name="+name+"&content="+note+"&userid="+userid+"&project_id="+prjid, true);
	ajax.setRequestHeader("connection", "close");
	ajax.onreadystatechange = function() {

	if(ajax.readyState === readyState.COMPLETATO) {
		
		if(statusText[ajax.status] === "OK")
		{
			if(ajax.responseText == "0")
			{
			alert("You must be Logged!");	
			}
			else
			{
			document.getElementById('comment_container').innerHTML = ajax.responseText;
			document.getElementById('note').value = "";	
			}
		}
		else 
		{
		 return false;
		}
	  } 
	}
	// invio richiesta
	ajax.send("");
	}
}


function DownloadProject(prjid)
{
	var ajax = getXMLHttpRequest();

	if(ajax) {
	ajax.open("get","libs/project_action.php?action=download&project_id="+prjid, true);
	ajax.setRequestHeader("connection", "close");
	ajax.onreadystatechange = function() {

	if(ajax.readyState === readyState.COMPLETATO) {
		
		if(statusText[ajax.status] === "OK")
		{
			document.location.href="http://www.flowfase.com/projects/Particle.zip";
			alert("Thank You For Download!!");
		}
		else 
		{
		 return false;
		}
	  } 
	}
	// invio richiesta
	ajax.send("");
	}
}

function DownloadProjectExt(prjid)
{
	var ajax = getXMLHttpRequest();

	if(ajax) {
	ajax.open("get","libs/project_action.php?action=download&project_id="+prjid, true);
	ajax.setRequestHeader("connection", "close");
	ajax.onreadystatechange = function() {

	if(ajax.readyState === readyState.COMPLETATO) {
		
		if(statusText[ajax.status] === "OK")
		{
			document.location.href="http://www.flowfase.com/projects/Particle.zip";
			/*
			var ans = confirm("Thank You For Download!!");
			if(ans)
			{
			 	document.location.href="http://www.flowfase.com";
			}
			else
			{
			 	document.location.href="http://www.flowfase.com";				
			}*/
		}
		else 
		{
		 return false;
		}
	  } 
	}
	// invio richiesta
	ajax.send("");
	}
}