Cufon.replace('#footer .a-empresa .info .comunidade-orkut', {textShadow: '0px 1px 0px #000', hover: {color: '#BAD2FF'}});
Cufon.replace('#page h1, #intro-seo .box h3 a, #post-info .center, h2#commentsl, .feed-box .assinantes, #conteudo_exclusivo h2, .ferramentas h2, #page.curso-de-seo h2');
Cufon.replace('.post .h2_posts a', {hover: {textDecoration: 'underline'}})

Cufon.replace('#erro404 .center h1, #footer .error .header', {textShadow: '0px 2px 0px #000'});

// Shadow 1px Black - 90º
Cufon.replace('#erro404 .center h2, #optimization .box .header, #rotator h2, #rotator h3, .mouse-over, .feed-box .box-header, #header-post h1, \n\
.post #about_author .author-header, #page .menu .box-header, #page .two-boxes .box .box-header, #page .two-boxes .box .header .assine-ja\n\
#page .two-boxes .box .header .registre-se, #footer .a-empresa, #footer .contact-form, #popup-info .cufon, .assine-ja, .registre-se, .deixe-comentario .header span', {textShadow: '0px 1px 0px #000'});

// Shadow 1px White - 90º
Cufon.replace('#services .header, .post .header_post .post-info, #services .box .box-header, .post .continue_reading, #menu-ouro #ouro_flag,\n\
', {textShadow: '0px 1px 0px #FFF'});

Cufon.replace('#main-menu a', {textShadow: '0px 1px 0px #000', hover: {color: '#FFF'}});
Cufon.replace('#breadcrumb', {textShadow: '0px 1px 0px #FFF', hover: {color: '#325F91'}});

Cufon.replace('#services .box .contact', {textShadow: '0px 1px 0px #324C33'});
Cufon.replace('#footer .contact-form .send, #footer .error .header', {textShadow: '0px 1px 0px #E4E6E7'});
Cufon.replace('#page-header h1', {textShadow: '0px 1px 0px rgba(0, 0, 0, 0.5)'});
Cufon.replace('#intro-seo .box a.continue', {textShadow: '0px -1px 0px #000', hover: {textShadow: '0px -1px 0px rgba(0, 0, 0, 0.5)'}});
Cufon.replace('#erro404 .box-ultimos-artigos li a', {textShadow: '0px 1px 0px rgba(0, 0, 0, 0.8)', hover: {color: '#BAD2FF'}});

Cufon.replace('#erro404 .404-red', {color: '#EB8A17'});

$(window).bind('load', function () {
    if(!$.browser.msie){
        $('#erro404 .box-curso-seo .img').cross();
    }
});

 var prev_opt = 0;

function rotateContent(po){
    $('#rotator .rotator-choose .option').eq((po == 0) ? 1 : 0).trigger('click');
    thenRotate = setTimeout('rotateContent('+prev_opt+')', 5000);
}


// Estevão Mascarenhas - 24/03/2010 - MestreSEO

$(function(){
	if($.browser.msie){
		$('.triangle').css('display', 'none');
	}

        var t;

	$('.tools .content').mouseenter(function(){
            $('.mouse-over').stop(true, true).fadeOut(500);
            clearTimeout(t);
	});

        $('.tools .content').mouseleave(function(){
            t = setTimeout(function(){$('.mouse-over').stop(true, true).fadeIn(500);}, 500);
	});

	var popup = $("#popup-info");
	var title_save;
	var pos;
	
	// Tool tooltip	- Estevão - estevao.am@gmail.com
	$('.tool').mouseenter(function(){
		pos = $(this).offset();

		title_save = $(this).attr('title');
		$(this).attr('title', '');
		title = title_save.split(' - ');
		h1 = title[0];
		desc = title[1];

		popup.find('.cufon').html(h1);
		popup.find('.description').html(desc);
		
		Cufon.replace('#popup-info .cufon', {textShadow: '0px 1px 0px #000'});

		popup.offset({top: ((pos.top + 1) - parseInt(popup.outerHeight()/2) - parseInt($(this).outerHeight()/2) - 26), left: ((pos.left + 1) - parseInt(popup.outerWidth()/2) + parseInt($(this).outerWidth()/2))});
		if(!$.browser.msie){
			popup.find('.triangle').offset({left: ( popup.offset().left + parseInt(popup.outerWidth()/2) - 5 )});
		}

		popup.stop(true, true).fadeIn();
	});
	
	$('.tool').mouseleave(function(){
		popup.stop(true, true).fadeOut();
		$(this).attr('title', title_save);
		title_save = '';
	});
	
	// Capitalize
	String.prototype.capitalize = function(){
		return this.replace( /(^|\s)([a-z])/g , function(m,p1,p2){return p1+p2.toUpperCase();} );
	};


 	/* Rotator */
        opts = $('#rotator .rotator-choose .option');

	opts.click(function(){
            clearTimeout(thenRotate);
            if(!$(this).hasClass('selected')){
                index = opts.index($(this)); // Pegar o index do DOM element para projetar nas news

                opt = $(this);

                opts.removeClass('selected');
                opt.addClass('selected');

                // Verifica se é para mover para direita ou esquerda
                if(prev_opt < index){
                    px = (1005*(index - prev_opt) != 0) ? 1005*(prev_opt - index) : 0;

                    if(!$.browser.msie){
                        if($.browser.opera){
                            if(px < 0){
                                px = (-1)*px;
                            }
                            $('#rotator .rotator-news').stop(true, true).animate({
                                'right': '+='+px+'px'
                            });
                        } else {
                            $('#rotator .rotator-news').stop(true, true).animate({
                                'right': '-='+px+'px'
                            });
                        }
                    } else {
                        $('#rotator .rotator-news').animate({
                            'right': '-='+px+'px'
                        }, 0);
                    }
                } else {
                    px = (1005*(prev_opt - index) != 0) ? 1005*(index - prev_opt) : 1005;

                    if(!$.browser.msie){
                        if($.browser.opera){
                            if(px < 0){
                                px = (-1)*px;
                            }
                            $('#rotator .rotator-news').stop(true, true).animate({
                                'right': '-='+px+'px'
                            });
                        } else {
                            $('#rotator .rotator-news').stop(true, true).animate({
                                'right': '+='+px+'px'
                            });
                        }
                    } else {
                        $('#rotator .rotator-news').animate({
                            'right': '+='+px+'px'
                        }, 0);
                    }
                }

                news = $('#rotator .rotator-news .new');

                if(!$.browser.msie){
                    // FadeIn, FadeOut... Obs.: Por algum motivo o fadeOut ele buga, por isso o animate({ opacity: 0 })
                    news.eq(prev_opt).stop(true, true).animate({
                        opacity: 0
                    });
                    news.eq(index).stop(true, true).fadeIn().animate({
                        opacity: 1
                    }).removeClass('hidden');
                } else {
                    news.eq(prev_opt).css('visibility', 'hidden');
                    news.eq(index).css('visibility', 'visible').removeClass('hidden');
                }

                prev_opt = index;
            }
        });

        thenRotate = setTimeout('rotateContent('+prev_opt+')', 5000);

        /* Menus */

        $('ul li:first a').css('border-top', '0px');
        $('ul li:last a').css('border-bottom', '0px');

        /* Login Box */

        $('#login-box .aba').click(function(){
            $('#login-box').hide();
        });

        $('#user-menu .logar').click(function(){
            $('#login-box').show();
        });

        $('#search-button').click(function(){
            $('#search-button').parent().submit();
        });

        $('input').keydown(function(e){
            if (e.keyCode == 13) {
                $(this).parents('form').submit();
                return false;
            }
        });
});