// JavaScript Document
<!--
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);
}

var mnmxmlhttp = Array ();
var mnmString = Array ();
var mnmPrevColor = Array ();
var responsestring = Array ();
var myxmlhttp = Array ();
var responseString = new String;
var xmlhttp = new myXMLHttpRequest ();
var update_voters = false;
var loginVisible = false;

function crearComunidad (url)
{
	if (document.getElementById('wacom').innerHTML == "anonimo") {

		if (!loginVisible) {
//		document.getElementById('reg-crearComunidad').innerHTML = "<div style='border: 1px solid #000000; text-align:center; height: 190px; padding-top: 20px;width: 100%;font-family: Verdana,Arial,Helvetica,sans-serif;font-size: x-small; color: #000; font-weight: bold;'><p>Para crear una comunidad, tienes que estar <strong>autentificado</strong>.</p><p>Si aún no lo estás y quieres registrarte, haz click <strong><a href='?go=ab7c7d504b7f581ea631d88d89b5750436db8b90b5501fd36c43eec78702a44a190daa3c42691b1e'>aquí.</a></strong></p><form name='form_seccion_4228' style='margin: 0px;height: 110px;' action='' method='post'><label for='' class='' style='font-size: x-small; color: #000; font-weight: bold;'>Usuario</label><br /><input id='' tabindex='1' maxlength='' name='username' value='' type='text'><br /><label for='' class='' style='font-size: x-small; color: #000; font-weight: bold;'>Clave</label><br /><input id='' tabindex='1' maxlength='' name='password' value='' type='password'><br /><input id='' tabindex='1' maxlength='' name='zona' value='134' type='hidden'><input id='' style='font-family: Arial,Helvetica,sans-serif; font-size: x-small; color: BLACK;' name='entrar' value='Entrar' tabindex='1' type='submit'></form></div>";
		document.getElementById('reg-crearComunidad').innerHTML = "<div style='border: 1px solid #000000; text-align:center; background-color: #CCCCCC; height: 90px; padding-top: 20px;width: 100%;font-family: Verdana,Arial,Helvetica,sans-serif;font-size: x-small; color: #000; font-weight: bold;'><p>Para crear una comunidad tienes que estar <strong>registrado</strong>.</p><p><strong><a href='/registroUsuarios/_TJj9qzBb_-gfrBvET700Tdpc7-aOMMQ8'>REGISTRATE, CLICK AQUI</a></strong></p></div>";
		loginVisible = true;
		} else {
		document.getElementById('reg-crearComunidad').innerHTML = "";
		loginVisible = false;
		}
		/*parent.location.href='?go=ab7c7d504b7f581ea631d88d89b5750436db8b90b5501fd36c43eec78702a44a190daa3c42691b1e';*/	
	} 
}


function menealo (id, url, voto, karma)
{
//	if (voto == "0" && document.getElementById('wacom').innerHTML == "anonimo") {
	if (document.getElementById('wacom').innerHTML == "anonimo") {

		if (!loginVisible) {
//		document.getElementById('reg-' + id).innerHTML = "<div style='border: 1px solid #000000; text-align:center; height: 190px; padding-top: 20px;width: 100%;font-family: Verdana,Arial,Helvetica,sans-serif;font-size: x-small; color: #000; font-weight: bold;'><p>Para poder participar tienes que estar <strong>autentificado</strong>.</p><p>Si aún no lo estás y quieres registrarte, haz click <strong><a href='?go=ab7c7d504b7f581ea631d88d89b5750436db8b90b5501fd36c43eec78702a44a190daa3c42691b1e'>aquí.</a></strong></p><form name='form_seccion_4228' style='margin: 0px;height: 110px;' action='' method='post'><label for='' class='' style='font-size: x-small; color: #000; font-weight: bold;'>Usuario</label><br /><input id='' tabindex='1' maxlength='' name='username' value='' type='text'><br /><label for='' class='' style='font-size: x-small; color: #000; font-weight: bold;'>Clave</label><br /><input id='' tabindex='1' maxlength='' name='password' value='' type='password'><br /><input id='' tabindex='1' maxlength='' name='zona' value='134' type='hidden'><input id='' style='font-family: Arial,Helvetica,sans-serif; font-size: x-small; color: BLACK;' name='entrar' value='Entrar' tabindex='1' type='submit'></form></div>";
		document.getElementById('reg-' + id).innerHTML = "<div style='border: 1px solid #000000; text-align:center; background-color: #CCCCCC; height: 90px; padding-top: 20px;width: 100%;font-family: Verdana,Arial,Helvetica,sans-serif;font-size: x-small; color: #000; font-weight: bold;'><p>Para votar tienes que estar <strong>registrado</strong>.</p><p><strong><a href='/registroUsuarios/_TJj9qzBb_-gfrBvET700Tdpc7-aOMMQ8'>REGISTRATE, CLICK AQUI</a></strong></p></div>"; 		
		loginVisible = true;
		} else {
		document.getElementById('reg-' + id).innerHTML = "";
		loginVisible = false;
		}
		/*parent.location.href='?go=ab7c7d504b7f581ea631d88d89b5750436db8b90b5501fd36c43eec78702a44a190daa3c42691b1e';*/	
	} else {
	if (xmlhttp) {
		//url = base_url + "backend/menealo.php";
		//content = "id=" + id + "&user=" + user;
		mnmxmlhttp[id] = new myXMLHttpRequest ();
		if (mnmxmlhttp[id]) {
			//url = url + "?" + content;
			mnmxmlhttp[id].open ("GET", url, true);
			mnmxmlhttp[id].send (null);
			valor = document.getElementById('num-' + id).innerHTML;
			
	
			if (voto > 0){
			valor.replace("+", "");
			valor = document.getElementById('num-' + id).innerHTML - (-karma);
			} else if (voto < 0) {
			valor = document.getElementById('num-' + id).innerHTML - (-karma);
			} else {
			valor = document.getElementById('num-' + id).innerHTML - (-karma);
			}
			if (valor > 0){
				document.getElementById('num-' + id).innerHTML = "<font color='#35B218'>+" + valor + "</font>";				
			} else if (valor == 0) {
				document.getElementById('num-' + id).innerHTML = "";	
			} else {
				document.getElementById('num-' + id).innerHTML = "<font color='#FC2C00'>" + valor + "</font>";
			}
			
			
			//document.getElementById('num-' + id).innerHTML = document.getElementById('num-' + id).innerHTML - 1;
			document.getElementById('link1-' + id).innerHTML = "<img src='/headers/zonas/2825/masGris.gif' border='0' alt='Ya has votado' name='Ya has votado'>";
			document.getElementById('link2-' + id).innerHTML = "<img src='/headers/zonas/2825/menosGris.gif' border='0' alt='Ya has votado' name='Ya has votado'>";
			document.getElementById('link3-' + id).innerHTML = "<img src='/headers/zonas/2825/xGris.gif' border='0' alt='Ya has votado' name='Ya has votado'>";
			warnmatch = new RegExp ("^WARN:");
			errormatch = new RegExp ("^ERROR:");

			mnmxmlhttp[id].onreadystatechange = function () {
				if (mnmxmlhttp[id].readyState == 4) {
					mnmString[id] = mnmxmlhttp[id].responseText;
					if (mnmString[id].match (errormatch)) {
						mnmString[id] = mnmString[id].substring (6, mnmString[id].length);
						alert (mnmString[id]);
						//changemnmvalues (id, true);
					} else {
						// Just a warning, do nothing
						if (mnmString[id].match (warnmatch)) {
							alert(mnmString[id]);
						} else {
							//changemnmvalues (id, false);
							//updateVoters(id);
						}
					}
				}
			}
		} else {
			alert('Couldn\'t create XmlHttpRequest');
		}
	}
	}
}
//-->