// JavaScript Document


//Esta funcion es para el Efecto de los Vinculos Principales
function efecto_links(contenedor,estado)
{
	if(estado==1)
		document.getElementById(contenedor).style.backgroundColor='#FAFAFA';
	else
		document.getElementById(contenedor).style.backgroundColor='';
}



//Funciones necesarias para la cookies del contador de visitas-----------------------------------------------------------------

var num = 0;

function mandarGalleta(nombre, valor, caducidad) 
{
	document.cookie = nombre + "=" + escape(valor) + ((caducidad == null) ? "" : ("; expires=" + caducidad.toGMTString()));
}

function consultarGalleta(nombre) 
{
	var buscamos = nombre + "=";
	
	if (document.cookie.length > 0) 
	{
		i = document.cookie.indexOf(buscamos);
		if (i != -1) 
		{
			i += buscamos.length;
			j = document.cookie.indexOf(";", i);
			if (j == -1)
				j = document.cookie.length;
			return unescape(document.cookie.substring(i,j));
		}
	}
}

function Contador() 
{
	var time = new Date();
	var dia = time.getDate();
	var mes = time.getMonth();
	var anno = time.getYear();
	
    var fecha = new Date (anno, mes, dia+1);		//fecha de expiracion de la cookie
    
    if (!(num=consultarGalleta("Visitas")))	// Si no existe la cookie "Visitas" 
		num = 0;								// reseteo a 0 la variable num

	num++;
    mandarGalleta("Visitas", num, fecha);
	document.getElementById('celda_contadora').innerHTML = "<span class='visitas'>Usted es el Usuario N&uacute;mero "+num+" en el d&iacute;a de hoy</span>";
      //document.write(num+" veces.");
}

//-------------------------------------------------------------------------------------------------------------------------------

//Funcion para cambiar el estilo de la pagina-------------------------------------------------------------------------------------

function cambiar_Estilo(valor)
{
        var temp_Element = document.getElementsByTagName("link")[0];
		temp_Element.href = "CSS/"+valor+".css";
}

function cambiar_Estilo1(value)
{
        var temp_Element1 = document.getElementsByTagName("link")[0];
		temp_Element1.href = "../CSS/"+value+".css";
		//alert(temp_Element1.href)
}

//--------------------------------------------------------------------------------------------------------------------------------

//Funcion para las Paginas Provinciales------------------------------------------------------------------------------------------

function buscar(valor)
{
	if(valor == "Seleccione")
	{
		alert('Seleccione la Página que desea Visitar');
		document.form.action = '';
		document.form.method = ''; 
		document.form.target='';
	}
	else
	{
		document.form.action = valor;
		document.form.method = "get"; 
		document.form.target = '_blank';
	}
}

//-------------------------------------------------------------------------------------------------------------------------------


