function mostrarTabs(selec, cant, tipo){
	for (i=1; i<=cant; i+=1)
	{
		document.getElementById(tipo+i).style.display="none";
		document.getElementById("tab"+i).style.backgroundPosition="0 -23px";
		document.getElementById("tab"+i).style.color="#54696a";
		document.getElementById("tab"+i).style.lineHeight="23px";
	}
	document.getElementById(tipo+selec).style.display="block";
	//document.getElementById("tab"+tipo).style.cursor="default";
	document.getElementById("tab"+selec).style.backgroundPosition="top";
	document.getElementById("tab"+selec).style.color="#fff";
	document.getElementById("tab"+selec).style.lineHeight="20px";
}
function VentanaAbrir(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function showCine(){
    //Mostrar cines
	document.getElementById('cineSalas').style.display='block';
    //Cambiar Botones top y foot
	document.getElementById('hideCineTop').innerHTML = '<a href="javascript:hideCine();"><img src="images/icons/hide.gif" width="12" height="12" alt="" />&nbsp;<strong>Ocultar funciones de esta película</strong></a>';
	//document.getElementById('hideCineFoot').innerHTML = '<a href="javascript:hideCine();"><img src="images/icons/hide.gif" width="12" height="12" alt="" />&nbsp;<strong>Ocultar funciones de esta película</strong></a>';
}
function hideCine(){
    //Mostrar cines
	document.getElementById('cineSalas').style.display='none';
    //Cambiar Botones top y foot
	document.getElementById('hideCineTop').innerHTML = '<a href="javascript:showCine();"><img src="images/icons/more.gif" width="12" height="12" alt="" />&nbsp;<strong>Ver funciones de esta película</strong></a>';
	//document.getElementById('hideCineFoot').innerHTML = '<a href="javascript:showCine();"><img src="images/icons/more.gif" width="12" height="12" alt="" />&nbsp;<strong>Ver funciones de esta película</strong></a>';
}

/*
REALIZA LA VOTACIÓN DE UNA ENCUESTA
Parámetros:
	- encuesta_id: id de la encuesta
Objetos Necesarios:
	form.encuesta_id
	form.pregunta<encuesta_id>: array con los id de las preguntas
	form.pregunta_cantidad<encuesta_id>: número de preguntas de la encuesta
	form.voto<pregunta_id>: objeto input tipo radio con las respuestas de la pregunta
*/

function Votar(encuesta_id,cantPreguntas,preguntas){

	var pregunta_id, obj_pregunta;
	var obj_respuesta, respuesta_id;
	var lista_preguntas = preguntas.value.split(",");
	if (cantPreguntas.value == 1)
	{
        pregunta_id = lista_preguntas[0];
		obj_respuesta = eval('window.document.aspnetForm.ctl00$mainContent$EncuestaAbierta'+encuesta_id+'$'+pregunta_id);
		if (obj_respuesta == undefined)
		{
			obj_respuesta = eval('window.document.aspnetForm.EncuestaNota$'+pregunta_id);
		}
		
      	respuesta_id = -1;
      	if (obj_respuesta.length > 0) //tengo mas de una respuesta
		{
			for (var i=0; i<obj_respuesta.length; i++){
			if (obj_respuesta[i].checked)
				respuesta_id = obj_respuesta[i].value;
			}
		}
		else // una sola respuesta
		{	if (obj_respuesta.checked)
				respuesta_id = obj_respuesta.value;
		}
        if (respuesta_id == -1)
        {
			window.alert("Seleccione una respuesta");
			return;
		}
		
    }else{
        k = 0;
        respuesta_id = "";
        for (var j=0; j<lista_preguntas.length-1; j++){
            pregunta_id = lista_preguntas[j];
			obj_respuesta = eval('window.document.aspnetForm.ctl00$mainContent$EncuestaAbierta'+encuesta_id+'$'+pregunta_id);
			if (obj_respuesta == undefined)
			{
				obj_respuesta = eval('window.document.aspnetForm.EncuestaNota$'+pregunta_id);
			}
			if (obj_respuesta.length > 0) //tengo mas de una respuesta
			{
				for (var i=0; i<obj_respuesta.length; i++)
				{
				    if (obj_respuesta[i].checked)
				        {	
					        k = k + 1;
					        respuesta_id = respuesta_id + obj_respuesta[i].value + ",";
					    }
					
				}
			}
        }
            if (k != (lista_preguntas.length-1)){
				 window.alert("Seleccione una respuesta por cada pregunta");
		         return;
			}
    }
    respuestas="&respuestas="+respuesta_id;
	VentanaAbrir("EncuestaVotar.aspx?encuesta_id="+encuesta_id+respuestas+"&dominioorigen=1","Encuesta",600,420,'yes');
}


/*
REALIZA LA VOTACIÓN DE UNA ENCUESTA PARA ESPECIAL OSCARS
Parámetros:
	- encuesta_id: id de la encuesta
Objetos Necesarios:
	form.encuesta_id
	form.pregunta<encuesta_id>: array con los id de las preguntas
	form.pregunta_cantidad<encuesta_id>: número de preguntas de la encuesta
	form.voto<pregunta_id>: objeto input tipo radio con las respuestas de la pregunta
*/

function VotarOscar(encuesta_id)
{
	var pregunta_id, obj_pregunta;
	var obj_respuesta, respuesta_id;
	var respuestas;
	respuestas	= "";

	//Verifica que haya una respuesta seleccionada por pregunta

	if (eval('window.document.frmEncuesta'+encuesta_id+'.pregunta_cantidad'+encuesta_id+'.value') == 1){
		//Si hay solo una pregunta
		pregunta_id = eval('window.document.frmEncuesta'+encuesta_id+'.pregunta'+encuesta_id+'.value');
		obj_respuesta = eval('window.document.frmEncuesta'+encuesta_id+'.voto'+pregunta_id);
		respuesta_id = -1;
		if (obj_respuesta.length > 0) //tengo mas de una respuesta
		{
			for (var i=0; i<obj_respuesta.length; i++){
			if (obj_respuesta[i].checked)
				respuesta_id = obj_respuesta[i].value;
			}
		}
		else // una sola respuesta
		{	if (obj_respuesta.checked)
				respuesta_id = obj_respuesta.value;
		}

		if (respuesta_id == -1){
			window.alert("Seleccione una respuesta");
			return;
			}
			else{
				respuestas = '&respuestas='+respuesta_id;
			}
		}
	else{
		//Si hay mas de una pregunta
		obj_pregunta = eval('window.document.frmEncuesta'+encuesta_id+'.pregunta'+encuesta_id);
		for (var j=0; j<obj_pregunta.length; j++){
			pregunta_id = obj_pregunta[j].value;
			obj_respuesta = eval('window.document.frmEncuesta'+encuesta_id+'.voto'+pregunta_id);
			respuesta_id = -1;
			if (obj_respuesta.length > 0) //tengo mas de una respuesta
			{
				for (var i=0; i<obj_respuesta.length; i++){
				if (obj_respuesta[i].checked)
					if ((respuesta_id = obj_respuesta[i].value) > 0)
					{
						/* ACA */ respuestas = respuestas + '&respuestas='+respuesta_id;						
//						respuestas = '&respuestas='+respuesta_id;
					}
				}



			}
			else // una sola respuesta
			{	if (obj_respuesta.checked)
					respuesta_id = obj_respuesta.value;
			}
			if (respuesta_id == -1){
				window.alert("Seleccione una respuesta para todas las preguntas");
				return;
				}
			}
		}
	
	window.location = "/anto/oscars/encuesta/EncuestaChequearVotar.asp?dominioorigen=1&encuesta_id="+encuesta_id+respuestas;
}


function encuestayavoto(encuesta_id) {
	var cookie = readCookie("encuesta"+encuesta_id) //cargo todas las encuestas por las que voto
	var valor = encuesta_id + '=true' //armo el string a buscar
	if (cookie != null) //por si no existe la cookie
	{
		var posicion = cookie.indexOf (valor);
		if (posicion>-1)
			return true;
		else
			return false;
	}
	else
		return false;
}
//---------- Leo los valores de la cookie ----------//

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 null;
}

function reporteAbusoAbrir(url,w,h,pagina)
{
    if((readCookie("cookieLogin")!=null) && (readCookie("cookieLogin")!=''))
    {
        window.open(url, 'popupwindow', 'width='+w+', height='+h+',scrollbars=no,top=150,left=400'); return false;
    }else{
        document.location.href='https://registracion.lanacion.com.ar/ingresar?sitioId=15&tipoParticipacion=2&pagina=' + pagina ;
    }
}


function solapa1(){
    document.getElementById('tab-body2').style.display = "none"
    document.getElementById('tab-body1').style.display = "block"
}
function solapa2(){
    document.getElementById('tab-body1').style.display = "none"
    document.getElementById('tab-body2').style.display = "block"
}
function solapa3(){
    document.getElementById('tab-body1').style.display = "none"
    document.getElementById('tab-body2').style.display = "none"
}

/**********************************[ FUNCIONES PARA EL VER MAS BLOGS DE LA PROMO DE BLOGS DE LA TERCERA]****************************/

/*
	Esta función se usa para hacer más amigable el slide down del ver mas blogs en la promo de blogs de la tercera.
	Culpable: NiKo.
*/

	  $(document).ready(
		  function()
		  {
		      if (navigator.appName != 'Microsoft Internet Explorer')
		      {				
			    $("#imgBotonesVerBlogs").click(
						     function () 
						     {
							    $("#masBlogs").slideToggle("slow");
						     }
						     );
			  }
		 });

/*
	Con esta función le cambiamos al boton el texto según esten despelgados los otros blogs o no.
	Culpable: NiKo.
*/
	var mostrar;
	mostrar = true;
	function cambiarNombreBoton()
	{
		if (mostrar)
		{
			document.getElementById('imgBotonesVerBlogs').src = '/images/verMenosBlogs.gif';
			if (navigator.appName == 'Microsoft Internet Explorer')
			{
				document.getElementById('masBlogs').style.display = 'block';
			}			
			mostrar = false;
		}
		else
		{
			document.getElementById('imgBotonesVerBlogs').src = '/images/verMasBlogs.gif';
			if (navigator.appName == 'Microsoft Internet Explorer')
			{
				document.getElementById('masBlogs').style.display = 'none';
			}			
			mostrar = true;
		}
	}

/*
	Efecto para iluminar en verde el blog seleccionado.
	Culpable: NiKo.
*/
	function iluminarLi(objLi)
	{
		objLi.className = "liBlogSeleccionado";
	}

/*
	Efecto para apagar la iluminación en verde del blog seleccionado.
	Culpable: NiKo.
*/
	function oscurecerLi(objLi)
	{
		objLi.className = "liBlog";
	}



/**********************************[ /FUNCIONES PARA EL VER MAS BLOGS DE LA PROMO DE BLOGS DE LA TERCERA]****************************/