﻿function selectComunidade(o,c) {
    $(".comunidades li.social a").removeAttr("class");
    o.className = "selected";
    
    var op = "operacao=getDadosComunidade&comunidade=" + c;
    fnAjax("post", "comunidades_participe", "/inc/ajax.ashx", op, function() {$(document).ready(function() {ddequalcolumns_reset()});});
}

(function ($) {
    $.fn.hint = function (blurClass) {
        if (!blurClass) blurClass = 'blur';
     
        return this.each(function () {
            var $input = $(this),
                title = $input.attr('title'),
                $form = $(this.form),
                $win = $(window);

            function remove() {
                if ($input.attr('value') === title && $input.hasClass(blurClass)) {
                    $input.val('').removeClass(blurClass);
                }
            }
     
            // only apply logic if the element has the attribute
            if (title) { 
                // on blur, set value to title attr if text is blank
                $input.blur(function () {
                    if (this.value === '') {
                        $input.val(title).addClass(blurClass);
                    }
                }).focus(remove).blur(); // now change all inputs to title
     
                // clear the pre-defined text when form is submitted
                $form.submit(remove);
                $win.unload(remove); // handles Firefox's autocomplete
            }
        });
    };
})(jQuery);

$(document).ready(function() {
    $('#_busca').hint();

    $("#topo .menu-idiomas .sel").click(function() {
        $(this).parent().find(".sub").slideDown('fast').show();
        $(this).parent().hover(function() {
        }, function() {
            $(this).parent().find(".sub").slideUp('slow');
        });
    });
});

function setLinkFav() {
    var url = "http://www.copa2014.org.br/";

    if (document.all)
    {
        $("#id_link_fav").click(function() {
            window.external.AddFavorite($(this).attr("href"), $(this).attr("title"));
            return false;
        });
    }

    $("#id_link_fav").attr("href", url);
}
