/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
(function($){
    Menu = function(clase,frame){
    var element = $("a."+clase);
    var init = function(){
        element.each(function(){
            var dir = $(this).attr('rel');
            $(this).click(function(){
                $('.'+frame).attr('src',dir);
                select($(this));
            });            
        });
        $('#menuContacto').bind('click',function(){
            element.each(function(){
                $("img",$(this)).each(function(){
                    if ($(this).attr('rel') == 'selected')
                        $(this).hide();
                    else
                        $(this).show();
                })
            });
            $('.'+frame).attr('src',contacto);
        });
        var contacto = $('#menuContacto').attr('href');       
        $('#menuContacto').attr('href','javascript:void(0)');
        $('#menuNewsletter').bind('click',function(){
            element.each(function(){
                $("img",$(this)).each(function(){
                    if ($(this).attr('rel') == 'selected')
                        $(this).hide();
                    else
                        $(this).show();
                })
            });
            $('.'+frame).attr('src',newsletter);
        });
        var newsletter = $('#menuNewsletter').attr('href');
        $('#menuNewsletter').attr('href','javascript:void(0)');
    };
    var select = function(ele){
        element.each(function(){
            $("img",$(this)).each(function(){                
                if ($(this).attr('rel') == 'selected')
                    $(this).hide();
                else
                    $(this).show();
            })
        });
        $("img",$(ele)).each(function(){            
            if ($(this).attr('rel') == 'selected')
                $(this).show();
            else
                $(this).hide();
        });
    }
    init();
};
})(jQuery);

