	var url = "Vote.php"; // The server-side script
	var link_id_div;
	 var xmlhttp;
	function handleHttpResponse() { 
	if (xmlhttp.readyState == 4) {
		if(xmlhttp.status==200) {
		  var results=xmlhttp.responseText;
		  if (results == "already voted")
		  {
			alert(results);
		  }
		  else
		  {
			  var v = document.getElementById(link_id_div);
			  v.innerHTML=results;
		  }
		}
	  }
	} 
	function addVote(value,user_name) { 
		link_id_div = value;
		if (user_name == "0")
		{
			alert("Please login to vote");
			return false;
		}
		url = "Vote.php";
		url = url +"?link_id="+value+"&user_name="+user_name;
		xmlhttp = getHTTPObject();
		//url = url + "?user_name="+document.comment_form.comment_userid.value;
		//url = url + "&comment_link_url_id="+document.comment_form.comment_link_url_id.value;
		//url = url + "&link_id="+document.comment_form.comment_link_id.value;
		//url = url + "&comments="+document.comment_form.comments.value;
		xmlhttp.open("GET", url, true);
		xmlhttp.onreadystatechange = handleHttpResponse;
		xmlhttp.send(null);
	}
	function getHTTPObject() {			     
		  if(window.XMLHttpRequest){
			xmlhttp = new XMLHttpRequest();
		  }
		  else if (window.ActiveXObject){
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
			if (!xmlhttp){
				xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
		}
		return xmlhttp;
	} 
	String.prototype.trim = function() {
		return this.replace(/^\s+|\s+$/g,"");
	}

