
   
    function vote(vote_button)
    {
        var polldiv = vote_button.name;
        var poll = document.getElementById(polldiv);  //'poll1'
        if (poll != null)
        {
            var inputs = poll.getElementsByTagName('input');
            if (inputs == null)
                alert('inputs null');
            
            var url = './poll_vote.php?sid=' + Math.random();
            var url = url + '&vote=' + polldiv;
            
            var i = 0;
            while (i < inputs.length)
            {
                if (inputs[i].type == 'checkbox' || inputs[i].type == 'radio')
                {
                    url = url + '&' + inputs[i].name + '=' + inputs[i].checked;
                }
                i++;
            }
            
            //alert(url);
            send(url, polldiv);
        }
    }
            
    function send(url, polldiv)
    {
        
        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
        }
     
        
        xmlhttp.open('GET', url, 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 content = xmlhttp.responseText; //The content data which has been retrieved
                //alert(content);
                if( content != 'n' ){ //If the response was not "n" (meaning it worked)
                      //alert(content);
                      document.getElementById(polldiv).innerHTML = content; //Set the inner HTML of the div with the old value in it to the new value **
                }
        }
        }
        xmlhttp.send(null) //Nullify the XMLHttpRequest
        return;
    }

