function disableAction(){
	return false;
}

var xmlhttp
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	 try {
	  xmlhttp = new XMLHttpRequest();
	 } catch (e) {
	  xmlhttp=false
	 }
	}
	function myXMLHttpRequest() {
	  var xmlhttplocal;
	  try {
	    xmlhttplocal= new ActiveXObject("Msxml2.XMLHTTP")
	 } catch (e) {
	  try {
	    xmlhttplocal= new ActiveXObject("Microsoft.XMLHTTP")
	  } catch (E) {
	    xmlhttplocal=false;
	  }
	 }

	if (!xmlhttplocal && typeof XMLHttpRequest!='undefined') {
	 try {
	  var xmlhttplocal = new XMLHttpRequest();
	 } catch (e) {
	  var xmlhttplocal=false;
	  alert('couldn\'t create xmlhttp object');
	 }
	}
	return(xmlhttplocal);
}

function sndReq(feud_id,vote,userIp,userId,b) {
	var theContent = document.getElementById('content'+feud_id); 
	// switch UL with a loading div
	theContent.innerHTML = '<div class="loading_LRG"></div>';
	
    xmlhttp.open('get', './ajax/vote_dynamic.php?f='+feud_id+'&v='+vote+'&p='+userIp+'&i='+userId+'&b='+b);
    xmlhttp.onreadystatechange = handleResponse;
    xmlhttp.send(null);	
}

function handleResponse() {
  if(xmlhttp.readyState == 4){
		if (xmlhttp.status == 200){
       	
        var response = xmlhttp.responseText;
        var update = new Array();

        if(response.indexOf('|') != -1) {
            update = response.split('|');
            changeText(update[0], update[1]);
        }
		}
    }
}

function changeText( div2show, text ) {
    // Detect Browser
    var IE = (document.all) ? 1 : 0;
    var DOM = 0; 
    if (parseInt(navigator.appVersion) >=5) {DOM=1};

    // Grab the content from the requested "div" and show it in the "container"
    if (DOM) {
        var viewer = document.getElementById(div2show);
        viewer.innerHTML = text;
    }  else if(IE) {
        document.all[div2show].innerHTML = text;
    }
}

/* =============================================================== */
function run(b,a){	
	var oRadio = document.forms[b].elements['vote'];
	
	for(var i = 0; i < oRadio.length; i++) { 
		if(oRadio[i].checked) {
			var vote =oRadio[i].value; }
	}
	if(vote=="" || vote==null){
		alert("Ummmm, you forgot to select an option dude.");
		return false;}
	
	var feud_id = document.getElementById('feud_id'+a).value;	
	//var vote = document.getElementById('vote'+a).length;
	//var current_vote = document.getElementById('current_vote'+a).value;
	var userIp = document.getElementById("userIp").value;
	var userId = document.getElementById("userId").value;
	//alert(feud_id+','+vote+','+userIp+','+userId+','+b);
	sndReq(feud_id,vote,userIp,userId,b);	
}

