<!-- Muestra un cartelito de información -->
function bookmark(url, description)
{
	netscape="Presione CTRL+D para añadir esta página a sus favoritos.";
	opera_mess="Presione CTRL+D para añadir esta página a sus favoritos.";
	other_mess="Use las utilidades de su navegador para añadir esta página a favoritos.";
	if (navigator.appName=='Microsoft Internet Explorer')
	{ window.external.AddFavorite(url, description); }
	else if (navigator.appName=='Netscape')
	{ alert(netscape); }
	else if(window.opera)
	{ alert(opera_mess); }
	else
	{ alert(other_mess); }
}

function valida_comentario(){
    //valido el nombre
    if (document.comment.name.value.length==0){
       alert("Debe escribir un nombre")
       document.comment.name.focus()
       return 0;
    }
    if (document.comment.comments.value.length==0){
       alert("Debe escribir un comentario")
       document.comment.comments.focus()
       return 0;
    }
    if (document.comment.clave.value.toLowerCase() != 'amigo'){
       alert("Debe escribir la palabra amigo")
       document.comment.clave.focus()
       return 0;
    }
    var form=document.getElementById('comment');    
    form.submit(); 
} 

function enviar_form(formulario, dato)
{
	var form=document.getElementById(formulario);
	form.elements[0].value = dato;
	form.submit();
}
function getURLParam(strParamName){
	  var strReturn = "";
	  var strHref = window.location.href;
	  if ( strHref.indexOf("?") > -1 ){
	    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
	    var aQueryString = strQueryString.split("&");
	    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
	      if (
	aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 ){
	        var aParam = aQueryString[iParam].split("=");
	        strReturn = aParam[1];
	        break;
	      }
	    }
	  }
	  return unescape(strReturn);
}
function comprobar(){
	var name = document.getElementById("name").value;
	var mail = document.getElementById("mail").value;
	var commentsbox = document.getElementById("commentsbox").value;
	var at=document.getElementById("mail").value.indexOf("@");
	
	var validar = true;
	if(name == ''){
		validar = false;
		alert('Para hacer un comentario debe introducir su nombre.');
	}
	if (at == -1 && mail != ''){
		 alert("No es un E-mail correcto.");
		 validar = false;
	 }
	 if(commentsbox == ''){
	 validar = false;
		alert('Debe dejar un comentario.');
	 }
	 if(!validar)
	 	return false;
	 	
} 
	
function efecto_slide(obj_id)
	{
		if (document.getElementById(obj_id).style.display == 'none')
		{Effect.Appear(obj_id, {duration: 0.5});}
		else
		{Effect.Fade(obj_id, {duration: 0.5});}
	} 

function ocultar_obj(obj_id)
	{
		document.getElementById(obj_id).style.display = 'none';
	} 
	
/* */
function popUp2(URL,WIDTH,HEIGHT,SCROLL,LEFT,TOP)
{
 day = new Date();
 id = day.getTime();
 eval("page" + id + " = window.open(URL, '" + id + "','scrollbars="+ SCROLL +",width="+ WIDTH +",height="+ HEIGHT +",left = "+ LEFT +",top = "+ TOP +"');");
}

function activarCSS(title) { 
	alert("empezando");
	// Obtengo los elementos link 
	var links = document.getElementsByTagName("link");
	alert(links.length);
	// Los recorro todos y el que tenga  
	// el title que queremos lo activamos 
	// el resto los desactivamos 
	for (var i=0; i<links.length; i++) {
		
		if (links[i].getAttribute("title") == title) { 
			links[i].disabled = false; 
		} else { 
			links[i].disabled = true; 
		} 
		alert(links[i].disable);
	} 
	alert("acabando");
} 

function envio(form,seccion)
{
	jQuery.post("ajax.php",
			jQuery(form).serialize(),
			function(data)
			{
				jQuery('#'+seccion).html(data);
				location.hash='#proximos_eventos'; 
				jQuery(".aviso_ajax").tooltip({showURL: false, extraClass: "texto_aviso" });
			}
	);
	jQuery('#'+seccion).html('<img src="img/loading_16.gif" /> CARGANDO...');
}


function cambia_tab(tab)
{
	if(tab=='cat'){
		jQuery('#buscador_avanzado').css('display','none');
		jQuery('#buscador_categorias').css('display','block');
		jQuery('#tab_categorias').css('border-bottom','0');
		jQuery('#tab_buscador').css('border-bottom','1px solid silver');
		jQuery('#tab_categorias').css('height','21px');
		jQuery('#tab_buscador').css('height','20px');
	}
	else{
		jQuery('#buscador_categorias').css('display','none');
		jQuery('#buscador_avanzado').css('display','block');
		jQuery('#tab_categorias').css('border-bottom','1px solid silver');
		jQuery('#tab_buscador').css('border-bottom','0');
		jQuery('#tab_categorias').css('height','20px');
		jQuery('#tab_buscador').css('height','21px');
	}
}

function mes_anterior(mes,anio){
	if(mes==1){
		jQuery('#imes').attr('value',12);
		jQuery('#ianio').attr('value',anio-1);
		jQuery('#select_mes').attr('value',12);
		jQuery('#select_anio').attr('value',anio-1);
	}
	else{
		jQuery('#imes').attr('value',mes-1);
		jQuery('#select_mes').attr('value',mes-1);
	}
	envio('#filtro','cuerpo_tabla');
}

function mes_siguiente(mes,anio){
	if(mes==12){
		jQuery('#imes').attr('value',1);
		jQuery('#ianio').attr('value',anio+1);
		jQuery('#select_mes').attr('value',1);
		jQuery('#select_anio').attr('value',anio+1);
	}
	else{
		jQuery('#imes').attr('value',mes+1);
		jQuery('#select_mes').attr('value',mes+1);
	}
	envio('#filtro','cuerpo_tabla');
}
