// ---v- Check page name
function thispg(pg){
    var page = pg+'.html';
    return (window.location.href.indexOf(page)!=-1)?true:false;
}
// ---^-
$(function(){
    var TOTOP = 'Volver Arriba';
    var AREYOUSURE = "¿Estás seguro que deseas salir de esta página?\n ¡Si lo haces todos los datos ingresados se perderán!";
    
    var anchors = $('a');
// ---v- Unobtrusive popup Windows
    $($('.newwin'),anchors).click(function(){
        cls = $(this).attr('class');
        url = $(this).attr('href');
        w   = ((cls.match(/w:(\d+)/)||[])[1]) || 320;
        h   = ((cls.match(/h:(\d+)/)||[])[1]) || 200;
        // Available param values:
        // toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=600,height=400
        parm = "width="+w+",height="+h+",scrollbars=1,resizable=1";
        window.open(url,'InfoWindow',parm).focus();
        return false;
    });
// ---^-
// ---v- FAQ/MailFAQ pages: number answers, add "Back to top" links
    if (thispg('faq')) {
        var faqs = $('dl.faqa');
        $('dt',faqs).each(function(i){$(this).prepend('<span>' + (i+1) + '. </span>')});
        $('dd',faqs).append('<a href="#top" class="ttp">' + TOTOP + '</a>');
    }
// ---^-
// ---v- Create stripped table
    $('table.strips tr:even').attr('class','tdd');
// ---^-
// ---v- Warning message for all links on register page
    if (thispg('register')) {
        var makesure = function(){return confirm(AREYOUSURE);};
        anchors.not($('a.newwin')).click(makesure);
    }
// ---^-
// ---v- Remove focus
    anchors.focus(function(){$(this).blur()});
// ---^-
});
// ---v- Display emotions
function showico(){
    var tags = $('.sttl')
    var tlen = tags.length;
    if(tlen>0){
        for (var i = 0; i < tlen; i++) display.changeSmiles(tags[i], '/img/icons/emoticons/');
    }
}
// ---^-
