

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;
	}
  }
  
  return (xmlhttplocal);
}

var mnmxmlhttp = Array ();
var mnmString = Array ();
var mnmPrevColor = Array ();
var responsestring = Array ();
var myxmlhttp = Array ();
var responseString = new String;


function menealo (id, votes)
{  
		url = "/menealo.php";
		var content = "id=" + id + "&votes=" + votes;
		
    		mnmxmlhttp[id] = new myXMLHttpRequest (); 
    		if (mnmxmlhttp) { 
    			mnmxmlhttp[id].open ("POST", url, true);
    			mnmxmlhttp[id].setRequestHeader ('Content-Type',
    					   'application/x-www-form-urlencoded');
    
    			mnmxmlhttp[id].send (content);
    			errormatch = new RegExp ("^ERROR:");
    
    			mnmxmlhttp[id].onreadystatechange = function () {
    				if (mnmxmlhttp[id].readyState == 4) {
    					mnmString[id] = mnmxmlhttp[id].responseText;
						changemnmvalues (id, false);

    				}
    			}
    		}
    	
}



function changemnmvalues (id, error)
{
	b = mnmString[id];
	target1 = document.getElementById ('votes-' + id);
	target1.innerHTML = b;

	target2 = document.getElementById ('link-' + id);
	target2.style.background = 'transparent url(/images/vote-active.gif) no-repeat left top';
	target2.href = '#';
	
	return false;
}
