/*$(document).ready (function (){
	$('.mas').each(function (i){
		$(this).click(function() {
			$(this).toggleClass('menos');
			$('#apoyo'+$(this).attr('id')).slideToggle('fast');
		});
	});
	
	$('#linkequipos').click(function(){
		$('#submenu').slideToggle('normal');
	});
	
});*/

function codigoBoton(boton) {
	var codigo;
	
	if (boton==1) {
		codigo='<a href="http://www.blogsdecadiz.com" title="Blogs de Cádiz"><img src="http://www.blogsdecadiz.com/img/boton_lavoz.gif" border="0" alt="Blogs de Cádiz" width="90" height="25"/></a>';
	}
	if (boton==2) {
		codigo='<a href="http://www.blogsdecadiz.com" title="Blogs de Cádiz"><img src="http://www.blogsdecadiz.com/img/boton_lavoz_bn.gif" border="0" alt="Blogs de Cádiz" width="90" height="25"/></a>';
	}
	if (boton==3) {
		codigo='<a href="http://www.blogsdecadiz.com" title="Blogs de Cádiz"><img src="http://www.blogsdecadiz.com/img/boton_lavoz_color.gif" border="0" alt="Blogs de Cádiz" width="90" height="25"/></a>';
	}
	document.getElementById('codigo').style.background = '#fff';
	document.getElementById('codigo').value = codigo;
	
}
function cambialomas(valor){
	//alert('entro???');
	document.getElementById('menulomas1').className = '';
	document.getElementById('menulomas2').className = '';
	document.getElementById('menulomas3').className = '';
	pestanna = 'menulomas' + valor;
	//alert(pestanna);
	document.getElementById(pestanna).className = 'activo';
	bloquepestanna = 'contlomas' + valor;
	//alert(bloquepestanna);
	document.getElementById('contlomas1').style.display = 'none';
	document.getElementById('contlomas2').style.display = 'none';
	document.getElementById('contlomas3').style.display = 'none';
	document.getElementById(bloquepestanna).style.display = 'block';
}

function ajaxObject(){
    var ajOb = null;
    if (window.XMLHttpRequest) {
        ajOb = new XMLHttpRequest();
    }
    else {
        ajOb = new ActiveXObject("Microsoft.XMLHTTP");
    }
    return ajOb;
}

function votaPost(pid) {
	var ajaxReq = ajaxObject();
	ajaxReq.open("get", "/wordpress-mu/wp-content/plugins/votos/votos.php?votar=" + pid);
	ajaxReq.onreadystatechange = function () {
		if(ajaxReq.readyState == 4){
			if (ajaxReq.responseText) {
				gracias = "Gracias";
				document.getElementById('votalo'+pid).innerHTML = gracias;
				getVotosPost(pid);
			}
		}
	};
	ajaxReq.send(null);
}	

function getVotosPost(pid) {
	var ajaxReq = ajaxObject();
	ajaxReq.open("get", "/wordpress-mu/wp-content/plugins/votos/votos.php?votos=" + pid);
	ajaxReq.onreadystatechange = function () {
		if(ajaxReq.readyState == 4){
			if (ajaxReq.responseText) {
				numvotos=ajaxReq.responseText;
				
				if (numvotos==1) {
					txt = "<span>"+numvotos+"</span>voto";
				}
				else {
					txt = "<span>"+numvotos+"</span>votos";
				}
				document.getElementById('votos'+pid).innerHTML = txt;
			}
		}
	};
	ajaxReq.send(null);
}	