function mensajeinadec(permalink){
	$.post('enviar_mensaje.php',{pl: permalink});
	apprise('<p align="center">Su advertencia ha sido enviada con éxito.</p> Trataremos de resolverla en el menor tiempo posible.');
}

function cambiar(categoria) {	
	switch (categoria) {
        case "general":
			jQuery('#tm-2').hide();
			jQuery('#tm-3').hide();
			jQuery('#tm-4').hide();
			jQuery('#tm-5').hide();
			jQuery('#tm-1').slideDown();
			break;
        case "consultas":
            jQuery('#tm-1').hide();
			jQuery('#tm-3').hide();
			jQuery('#tm-4').hide();
			jQuery('#tm-5').hide();
			jQuery('#tm-2').slideDown();
            break;
        case "anuncios":
            jQuery('#tm-1').hide();
			jQuery('#tm-2').hide();
			jQuery('#tm-4').hide();
			jQuery('#tm-5').hide();
			jQuery('#tm-3').slideDown();
            break;
        case "denuncias":
            jQuery('#tm-1').hide();
			jQuery('#tm-2').hide();
			jQuery('#tm-3').hide();
			jQuery('#tm-5').hide();
			jQuery('#tm-4').slideDown();
            break;
        case "otros":
            jQuery('#tm-1').hide();
			jQuery('#tm-2').hide();
			jQuery('#tm-3').hide();
			jQuery('#tm-4').hide();
			jQuery('#tm-5').slideDown();
            break;
        default:
            break;
    }

}



jQuery(document).ready(function() {
/*
    <?php if (isset($_GET['registro']) && ($_GET['registro'] === 'ok')): ?>
    alert("Se ha registrado correctamente; para completar el proceso deberá iniciar sesión con la contraseña que recibirá en su e-mail.");
    <?php endif; ?>
*/



/* OK: */
    // Acceso y registro
    jQuery('#link_login').data("href", "/login/rt=/reload/");
    jQuery('#link_login').data("title", "Inicio de sesión");
    jQuery('#link_registro').data("href", "/register/rt=/reload/");
    jQuery('#link_registro').data("title", "Registro");

    jQuery('#link_login, #link_registro').each(function() {
        jQuery(this).fancybox({
            'type':               "iframe",
            'href':               jQuery(this).data("href"),
            'width':              600,
            'height':             600,
            'speedIn':            300,
            'speedOut':           150,
            'titlePosition':      "inside",
            'title':              jQuery(this).data("title"),
            'hideOnOverlayClick': false
        });
    });

    jQuery('#link_mensaje').click(function(event) {
        jQuery('#link_login').click();
    });
	
	
	
	jQuery('.link_menpriv').each(function() {
        jQuery(this).fancybox({
            'type':               "iframe",
            'href':               jQuery(this).data("href"),
            'width':              950,
            'height':             715,
            'speedIn':            300,
            'speedOut':           150,
            'titlePosition':      "inside",
            'title':              jQuery(this).data("title"),
            'hideOnOverlayClick': false
        });
    });
	
/* :OK */



/*
    jQuery('#avisos').fancybox({
        'autoScale'     : true,
        'transitionIn'  : "none",
        'transitionOut' : "none",
        'type'          : "iframe",
        'overlayShow'   : false
    });
    jQuery('#avisos2').fancybox({
        'autoScale'     : true,
        'transitionIn'  : "none",
        'transitionOut' : "none",
        'type'          : "iframe",
        'overlayShow'   : false
    });
    jQuery('#link_login, #link_mensaje').click(function() {
        jQuery('#form_login').css("display", "block");
    });
*/



    // Escribir mensaje
    var da_mensaje = "Escribe aquí tu mensaje, dispones de 150 caracteres (mínimo 10) para compartir con todo el mundo tu mensaje sobre los animales.";

    jQuery('#mensaje').focus(function() {
        if (jQuery(this).val() == da_mensaje) {
            jQuery(this).val("");
        }
    });
    jQuery('#mensaje').blur(function() {
        if (jQuery(this).val() == "") {
            jQuery(this).val(da_mensaje);
        }
    });
    jQuery('#mensaje').limit(150, "#contador");



/* OK: */
    // Menú inferior
    jQuery('.menu').each(function() {
        jQuery(this).fancybox({
            'type':          "iframe",
            'width':         600,
            'height':        600,
            'speedIn':       300,
            'speedOut':      150,
            'titlePosition': "inside",
            'title':         jQuery(this).children('img').attr("alt")
        });
    });

	
	$('.tooltip1').tipsy({fade: true, title: function() { return this.getAttribute('original-title'); }, gravity: 's', fade:false});
	$('.tooltip2').tipsy({fade: true, title: function() { return this.getAttribute('original-title'); }, gravity: 'e', fade:false});
	$('.tooltip3').tipsy({fade: true, title: function() { return this.getAttribute('original-title'); }, gravity: 'w', fade:false});
    // Easy Image Rollover
    var da_peps = {};

    da_peps.rollover = {
        init: function() {
            this.preload();
            jQuery('.roll').hover(
                function() {
                    jQuery(this).attr("src", da_peps.rollover.newimage(jQuery(this).attr("src")));
                },
                function() {
                    jQuery(this).attr("src", da_peps.rollover.oldimage(jQuery(this).attr("src")));
                }
            );
        },
        preload: function() {
            jQuery(document).bind("load", function() {
                jQuery('.roll').each(function() {
                    jQuery('<img>').attr("src", da_peps.rollover.newimage(jQuery(this).attr("src")));
                });
            });
        },
        newimage: function(src) {
            return src.substring(0, src.search(/(\.[a-z]+)$/)) + "_hover" + src.match(/(\.[a-z]+)$/)[0];
        },
        oldimage: function(src) {
            return src.replace(/_hover\./, ".");
        }
    };

    da_peps.rollover.init();
/* :OK */
});

