function send_comment(url){
	frm = document.getElementById('site_comments');	
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		 alert ("Browser does not support HTTP Request")
		 return
	}
	 
	
	 		 	
	//create a string with all form's paramters
	var params = "sent_comment=1";
	for (var i=0; i<frm.elements.length; i++)
	{
		var val;
		//TBD: add special code for lists with multiple selections if needed
		if (frm.elements[i].type == "checkbox" || frm.elements[i].type == "radio") {
			//save the value only if it is checked
			if (!frm.elements[i].checked) continue;
			val = (frm.elements[i].checked) ? frm.elements[i].value : "";
		} else {
			val = frm.elements[i].value;
		}
	   params += (params != "" ? "&" : "") + frm.elements[i].name + "=" + encodeURI(val);	   
	}
	
	//set function that will process the results
	xmlHttp.onreadystatechange=stateChanged_comments
	
	//open connection, set headers and send parameters
	xmlHttp.open("POST", url, true);
	//Send the proper header information along with the request
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", params.length);
	xmlHttp.setRequestHeader("Connection", "close");	 
	xmlHttp.send(params);
}

function stateChanged_comments(){
	
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
		
		str = xmlHttp.responseText;
		
	 	if(document.getElementById("div_comments")) {
			start_comments = str.indexOf('<!--%START_SITE_COMMENTS%-->');
			end_comments = str.indexOf('<!--%END_SITE_COMMENTS%-->');
			part_comments = str.slice(start_comments, end_comments);
			document.getElementById("div_comments").innerHTML=part_comments;
		}	 
				
	 	document.getElementById("div_comments_loader").style.display = "none";
	 	document.getElementById("div_comments").style.display = "block";
	 	
	 } else {
	 	document.getElementById("div_comments").style.display = "none";
	 	document.getElementById("div_comments_loader").style.display = "block";
	 }
}

