function send_answer(poll_id)
{
	for (var i=0; i < document.pollForm.poll_answer.length; i++)
	{
		if (document.pollForm.poll_answer[i].checked)
		{
			var rad_val = document.pollForm.poll_answer[i].value;
		}
	}

	if (rad_val == ''){var rad_val = 1;}

	 vote(rad_val, poll_id);
}



function vote(id, poll_id)
{
		var xmlhttp=false; //Clear our fetching variable
        try
        {
                xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object…
        }

        catch (e)
        {
           try
           {
              xmlhttp = new
              ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
           }

           catch (E)
           {
              xmlhttp = false;
           }
        }

        if (!xmlhttp && typeof XMLHttpRequest!='undefined')
       	{
                xmlhttp = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
        }

//=======================================================================================================================

        var file = 'modules/vote.php?id='; //This is the path to the file we just finished making

        xmlhttp.open('GET', file + id + '&poll_id=' + poll_id, true); //Open the file through GET, and add the id we want to retrieve as a GET variable
    	xmlhttp.onreadystatechange=function()
    	{
	        if (xmlhttp.readyState==4)
	        { //Check if it is ready to recieve data
		        var result = xmlhttp.responseText; //The content data which has been retrieved

		        if( result != 'n' )
		        {
		              document.getElementById('poll').innerHTML = result;
		        }
		    }
        }


        xmlhttp.send(null) //Nullify the XMLHttpRequest
		return;
}
