function compartir1(){
	document.getElementById('compartir1').style.display = "block"
}
function compartir2(){
	document.getElementById('compartir2').style.display = "block"
}
function publicar(){
	document.getElementById('publicarsitio').style.display = "block";
	document.getElementById('publicarsitio').style.top = Scroll() + 250 + "px";
}
function cerrarCaja(caja)
{
		document.getElementById(caja).style.display = "none";
}
function link(){
	document.getElementById('linkpermanente').style.display = "block";
	document.getElementById('linkpermanente').style.top = Scroll() + 450 + "px";
}

function opinar(nota_id,nroVotos)
{
	var cook, votaciones,nroVotos;
	cook = readCookie("valorar").replace(/%7C/g,"|");
	if (cook.indexOf(nota_id) == -1)
	{
		nroVotos = parseInt(nroVotos)+1;
		var votaciones = document.getElementById("votaciones");
		
		if (votaciones!=null)
		{
			document.getElementById("votaciones").innerHTML="("+ nroVotos + ")";
			document.getElementById("votarHabilitado").style.display="none";
			document.getElementById("votarDeshabilitado").style.display="inline";
			document.getElementById("votacionesDeshabilitadas").innerHTML="<img src=\"/_common/images/iconos/valoraste.gif\" width=\"72\" height=\"21\" alt=\"\" /><span>("+ nroVotos + ")</span>";
		}
		document.valorar.src="/_common/scripts/valorar.asp?nota_id="+nota_id;
		document.getElementById("votarHabilitado2").style.display="none";
		document.getElementById("votarHabilitado").style.display="none";
		document.getElementById("votarDeshabilitado").style.display="inline";
		document.getElementById("votarDeshabilitado2").style.display="inline";
		document.getElementById("votacionesDeshabilitadas2").innerHTML="<img src=\"/_common/images/iconos/valoraste.gif\" width=\"72\" height=\"21\" alt=\"\" /><span>("+ nroVotos + ")</span>";
	}
	else
	{
		
		if (votaciones!=null)
		{
			document.getElementById("votarHabilitado").style.display="none";
		}
		document.getElementById("votarHabilitado2").style.display="none";
		document.getElementById("votarDeshabilitado").style.display="inline";
		document.getElementById("votarDeshabilitado2").style.display="inline";
	}
}


function opinarPositivoNegativo(nota_id, spanVotos, valor_tipo)
{
	var cook, votaciones,nroVotos;
	var liDa = document.getElementById('porcientoDa');
	var liNoDa = document.getElementById('porcientoNoDa');
	var msjVotacion = document.getElementById('msjVotacion');
	var votaciones = document.getElementById('votaciones');
	cook = readCookie("valorar").replace(/%7C/g,"|");
	if (cook.indexOf(nota_id) == -1)
	{
		var idValorar = 'valorar' + nota_id;
		document.getElementById(idValorar).src="/_common/scripts/valorar.asp?nota_id="+nota_id+"&valor_tipo="+valor_tipo;
		if (votaciones!=null)
		{
			var nroVotos = votaciones.innerHTML.substr(votaciones.innerHTML.indexOf('>')+1);
			nroVotos = nroVotos.replace('</span>','');
			votaciones.innerHTML = parseInt(nroVotos) + 1;
		}
		else
		{
			if (valor_tipo == 1)
			{
				liDa.className = "porcentaje rojo";
			}
			else
			{
				liNoDa.className = "porcentaje rojo";
			}
			if (msjVotacion != null)
			{
				msjVotacion.innerHTML = "Ya votaste."
			}
		}
	}
	else
	{
		if (msjVotacion != null)
		{
			msjVotacion.innerHTML = "Ya votaste."
		}
		if (votaciones != null)
		{
			votaciones.innerHTML = "Ya votaste."
		}
	}
}


function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return '';
}

	function votar1(nota_id, nroVotos)
	{
		var cook;
		cook = readCookie("valorar").replace(/%7C/g,"|");
		if (cook.indexOf(nota_id) == -1)
		{
			document.valorar.src="/_common/scripts/valorar.asp?nota_id="+nota_id+"&valor=1";
			nroVotos = parseInt(nroVotos)+1;
			document.getElementById("votaciones").innerHTML="("+ nroVotos + ")";
			document.getElementById("votaciones").className = "votoDeshabilitado";
			document.getElementById('imgValoracion').src = '/_common/images/iconos/valorar-new-off.gif';
			document.getElementById('txtValorar').className = "txtVotoDeshabilitado";
			document.getElementById('txtValorar').innerHTML="Ya Valoraste ";
		}
		else
		{
			document.getElementById("votaciones").className = "votoDeshabilitado";
			document.getElementById('imgValoracion').src = '/_common/images/iconos/valorar-new-off.gif';
			document.getElementById('txtValorar').className = "txtVotoDeshabilitado";
		}
		return false;
	}

	// Este método llama al votar de la nota.
	// Culpable: Niko
	function votar(valor, nota_id)
	{
		var cook;
		cook = readCookie("valorar").replace(/%7C/g,"|");
		if (cook.indexOf(nota_id) == -1)
		{
			document.valorar.src="/_common/scripts/valorar.asp?nota_id="+nota_id+"&valor="+valor;
			document.getElementById('votos').innerHTML = '<b class="color">Gracias por votar</b>';
			mostrarValoracion(0);
		}
		else
		{
			document.getElementById('votos').innerHTML = '<b class="color">Ya votaste</b>';
			mostrarValoracion(0);
		}
	}

	// Código de navegabilidad para mostrar de a uno los valores en el mouseover.
	// Culpable: Niko
	function mostrarValoracion(valor)
	{
		document.getElementById('poco_brando').style.visibility = ((valor == 1) ? "visible" : "hidden" );
		document.getElementById('brando').style.visibility = ((valor == 2) ? "visible" : "hidden" );
		document.getElementById('muy_brando').style.visibility= ((valor == 3) ? "visible" : "hidden" );
		if (document.getElementById('imgValoracion1') != null)
		{
			document.getElementById('imgValoracion1').src = ((valor >=1) ? "/_common/images/iconos/valoracionMarcado.gif" : "/_common/images/iconos/valoracion.gif");
		}
		if (document.getElementById('imgValoracion2') != null)
		{
			document.getElementById('imgValoracion2').src = ((valor >=2) ? "/_common/images/iconos/valoracionMarcado.gif" : "/_common/images/iconos/valoracion.gif");
		}
		if (document.getElementById('imgValoracion3') != null)
		{
			document.getElementById('imgValoracion3').src = ((valor >=3) ? "/_common/images/iconos/valoracionMarcado.gif" : "/_common/images/iconos/valoracion.gif");
		}

	}
