$(function() {
	// BLEND
	$("#menu a.menuprincipal").blend();
	$("#menu a.menuprincipal:first span:first").addClass('first');
	$("#menu a.menuprincipal:last span:first").addClass('last');
	$("#menu .blend:first").addClass('first');
	$("#menu .blend:last").addClass('last');
	
	// SCROLLABLE
	$(".slide-show").scrollable({circular: true, mousewheel: false}).navigator({navi:'div.slide-navegacao'}).autoscroll({interval: 8000});
	$(".slide-galeria").scrollable({circular: true, mousewheel: false, next: '.bt_seta_dir', prev: '.bt_seta_esq'}).autoscroll({interval: 6000});
	$(".slide-videos").scrollable({circular: true, mousewheel: false, next: '.bt_seta_dir', prev: '.bt_seta_esq'}).autoscroll({interval: 6000});
	$(".slide-lista").scrollable({circular: true, mousewheel: false, next: '.bt_seta_dir', prev: '.bt_seta_esq'});

	// COLORBOX
	$('a[target=colorbox]').colorbox({maxWidth: '800px', fixed: true});
	$('a[target=colorboxscroll]').colorbox({maxWidth: '800px', fixed: false});
	$('a[target=colorboxiframe]').colorbox({iframe: true, width: '100%', height: '100%'});
	
	// VIDEOS
	var videos0 = new videos(); 
    videos0.imagens = [''];
	
    videos0.youtubeBase = '<iframe id="player-0" width="512" height="384" src="###YOUTUBE_URL###?autoplay=1&wmode=transparent&modestbranding=1&autohide=1" frameBorder="0"></iframe>';
    videos0.videoJsBase = '<video id="player-0" src="###VIDEO_URL###" width="512" height="384" poster="###POSTER###"></video>';
    videos0.inicializar('#player-0', '0', 512, 384, 1, 1, 'FFFFFF', '000000', 1, 1, '' , '', $('.videoColorbox'));
	
	// FLASH
	swfobject.embedSWF("/lib/assets/swf/slideshow.swf", "slideshow", "353", "199", "10.0.0", {}, {
        jsonURL: '/lib/assets/swf/slideshow.asp'
    }, {
        scale: 'noscale',
        salign: 'tl',
        wmode: 'transparent',
        menu: 'false'
    });
	
	// TWITTER
	$("#twitter").tweet({
        avatar_size: 32,
        count: 4,
        username: "julianapt",
        loading_text: "Carregando o Twitter...",
        refresh_interval: 60,
        template: '<a href="">{avatar}{text}'
    });
	
    // MENU
	 $('#bt_02, #bt_03').mouseover(function (e) {
        $("div[id*=submenu_]").hide();
        e.stopPropagation();
        $idSub = $(this).attr('id');
        $idSub = '#' + $idSub.replace('bt_', 'submenu_');
        $positionLeft = $($idSub).prev().offset().left;
        $positionWidth = $($idSub).prev().css('width');
        $($idSub).css('left', $positionLeft + 'px');
        $($idSub).mouseover(function (e) {
            e.stopPropagation();
        });
        $($idSub).show();
    });

    $('#bt_06').mouseover(function (e) {
        $("div[id*=submenu_]").hide();
        e.stopPropagation();
        $idSub = $(this).attr('id');
        $idSub = '#' + $idSub.replace('bt_', 'submenu_');
        $positionLeft = $($idSub).prev().offset().left;
        $positionWidth = $($idSub).prev().css('width'); 
		$($idSub).css('left', $positionLeft - 45 + 'px'); 

        $($idSub).mouseover(function (e) {
            e.stopPropagation();
        });
        $($idSub).show();
    });

    $(document.body).mouseover(function () {
        $("div[id*=submenu_]").hide();
    });
});
