var VotingFlag=true;
function AddVoting(j, q, t, c)
{

	if(VotingFlag==true)
	{
		VotingFlag=false;
		var url = "index.php?task=voting&mode=AddVoting&rrt=xml&id="+q+"&j="+j+"&t='"+t+"'&c="+c;
		//alert(url);
		var ajax = new AJAXInteraction(url, displayVoting);
		ajax.doGet();
	}
}
function viewResults(id)
{
	var url = "index.php?task=voting&mode=showvoting&rrt=xml&id="+id;
//	window.location.href=url;
	var ajax = new AJAXInteraction(url, displayVoting);
	ajax.doGet();

}
/*
function removenode(nodename){
	delnode = document.getElementById(nodename);
	delnode.removeNode(true);
}
*/
function displayVoting(response)
{
	try{
	  st  = response.getElementsByTagName("status")[0].firstChild.data;
	  if (st=="ok")
	  {	

		id = response.getElementsByTagName("idx")[0].firstChild.data;

		votes = response.getElementsByTagName("total_votes")[0].firstChild.data;
		values = response.getElementsByTagName("total_values")[0].firstChild.data;
		//unit_ul_width = response.getElementsByTagName("unit_ul_width")[0].firstChild.data;		
		unit_ul_width = response.getElementsByTagName("rating_width")[0].firstChild.data;		
		ratingvalue = response.getElementsByTagName("ratingvalue")[0].firstChild.data;		

		//msg('votingmsg','',ratingvalue);		
//Update Drawing
		var static_li = document.getElementById("static_li");
		static_li.style.width = unit_ul_width+"px";

		removeNode(getCtrl("voting_li1"));
		removeNode(getCtrl("voting_li2"));
		removeNode(getCtrl("voting_li3"));
		removeNode(getCtrl("voting_li4"));
		removeNode(getCtrl("voting_li5"));		
// using getCtrl was failing on IE, so use straight
	  vm = document.getElementById('votingmsg');
	vm.innerHTML = ratingvalue;
	return;
		newtext = dotext(ratingvalue)	;

		vm.appendChild (newtext);
		
		removeNode(getCtrl("linkskipvote"));	

	  }else{
	  }
	}
	catch(er)
	{
	  alert (er.message);
	}
}
