jQuery(document).ready(function($){

	$('.mapa_do_site').find('dl').each(function(){
		$(this).find('dt:last-child').css('border', '0');
		$(this).find('dd:last-child').css('border-left', '0');
	});
	
	$('select').uniform();
	
	$('.selecionar_linguagem').parent().css({
											'position' : 'absolute',
											'left' : '50%',
											'top' : '45px',
											'margin-left' : '100px'
											})
	
	$('form.form_padrao[name=equipe]').css('float', 'left')
	.find('select#id').parent().css({
									'margin' : '-3px 0 0 5px'
									});

	
	
	
	
	// Video home:
	embedPlayer();
	
	$('.barratime, #barra').css('opacity', 0);
	
	$('.video_banner_home').live('mouseover mouseout', function(event){
		if( event.type == 'mouseover' ) {
			$('.barratime, #barra').stop().animate({
									'opacity' : 1
									});
		} else {
			$('.barratime, #barra').stop().animate({
									'opacity' : 0
									});
		}
	});
	
	$('.barratime').toggle(function(){
		$(this).css('background-position', '2px top');
		ytplayer.pauseVideo();
	}, function(){
		$(this).css('background-position', '2px bottom');
		ytplayer.playVideo();
	});
	
	$( '#bt_play' ).live('focus', function(){
		$( '.video_banner_home' ).mouseover();
	});
	
	$( '#bt_play' ).live('blur', function(){
		$( '.video_banner_home' ).mouseout();
	});
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	// Setando tabindex automaticamente para todos os links
	tabindex = 1;
	$( 'a' )
		.each(function(){
			link = $( this );
			link.attr( 'tabindex', tabindex );
			tabindex++;
		});
	
	
	
	
	
	
	
	
	// Convênios
	$( '.lista_convenios ul' ).find('li:odd').css('background', '#f0f0f0');
	
	$( '.lista_convenios strong' ).click(function(){
		$(this).parent().find('ul').stop(true, true).slideToggle();
	});
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	// Linha do Tempo
	$linha         = $( '.linha-do-tempo' );
	$linhaTempo    = $linha.find( 'img' );
	$linhaAnterior = $linha.find( '.anterior' );
	$linhaProxima  = $linha.find( '.proxima' );

	$linha.each(function(){
		$contadorAnterior = 3;
		$contadorProximo = 0;
		
		$linhaAnterior.click(function(e){
			if( $contadorAnterior < 3 ){
				$linhaTempo.animate( { 'left' : '+=320' }, 400 );
			} else {
				e.preventDefault();
			}
			
			$contadorAnterior = ( $contadorAnterior < 3 ) ? $contadorAnterior + 1 : 3;
			$contadorProximo = ( $contadorProximo > 0 ) ? $contadorProximo - 1 : 0;
			e.preventDefault();
		});
		
		
		
		$linhaProxima.click(function(e){
			if( $contadorProximo < 3 ){
			$linhaTempo.animate( { 'left' : '-=320' }, 400 );
			$linha.find( '.anterior' ).show( 'fast' );
			} else {
				e.preventDefault();
			}
			
			$contadorProximo = ( $contadorProximo < 3 ) ? $contadorProximo + 1 : 3;
			$contadorAnterior = ( $contadorAnterior > 0 ) ? $contadorAnterior - 1 : 0;
			e.preventDefault();
		});
		
	});
	
	
	
	
	
	
});
