var xmlHttp

function votecoupon(cid,vote,ctype)
 {
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  }
	document.getElementById("hcid").value=cid;
	document.getElementById("hform").value=0;
	if (vote=="N")
	document.getElementById("hform").value=2;
	
	var url = "../../votecoupons.php";
	url = url+"?cid="+cid;
	url = url+"&vote="+vote;
	url = url+"&ctype="+ctype;
	xmlHttp.onreadystatechange = stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
 }

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function stateChanged()
{ 
	if (xmlHttp.readyState==4)
	{
		var id=document.getElementById("hcid").value;
		var formid=document.getElementById("hform").value;
		
		if (formid==1)
			eval("document.getElementById('commts" + id + "').innerHTML=xmlHttp.responseText");
		else if (formid==2)
			eval("document.getElementById('blcp" + id + "').innerHTML=xmlHttp.responseText");
		else
			eval("document.getElementById('r" + id + "').innerHTML=xmlHttp.responseText");
	}
}