
	var galeria_aberta = 1;
	var valor_galeria_aberta = 0;
	
	
	$().ready(function($){
		
			//Inverter background fotos en -> pt
			try{
				var lingua_fotos = $('#caixa_miolo_fotos_interno').attr('class');
				if(lingua_fotos.toUpperCase() == 'EN' ){
					var altera_back = $('#altera_back').attr('class');
					$('#corpo.galeria-de-fotos').css({backgroundImage: 'url("'+altera_back+'/img/background_fotos_2_en.jpg")'})
				} 
			}catch(err){}
			
			//Setando o menu da pagina filmografia
			var id_menu = $('.pagina').attr('id');
			var class_id = id_menu.split('_');
			if(class_id[1] == 'filmografia-filme'){
				class_id[1] = 'filmografia';
			};
			
			if(class_id[1] == 'noticia'){
				class_id[1] = 'noticias';
			};
			
			var num_volta = $('#'+class_id[1]).attr('class');
		    
			
		
			//Voltar seta pra a poisção da pagina
			$('#menu_seta').animate({marginLeft: num_volta+'px'}, 1);
			
			if (jQuery.support.opacity)
				$('#menu #'+class_id[1]+' img').animate({ opacity: 0.5 }, 1 );
			
			//Mechendo A seta do menu
			$('#menu ul li').live('mouseover mouseout', function(event) {
				if (event.type == 'mouseover') {
					var id = this.id;
					var num = $('#'+id).attr('class');
					
					
						$('#menu_seta').stop().animate({marginLeft: num+'px'}, 300);
					
						if (jQuery.support.opacity){
							$('#menu ul li#'+this.id+' img').animate({ opacity: 0.5 }, 1 );
						}
					
				  } else {
					var id = $('.pagina').attr('id');
					var class_id = id.split('_');
					var num = $('#'+class_id[1]).attr('class');
					
					$('#menu_seta').stop().animate({marginLeft: num+'px'} ,300);
					if(id_menu != 'p_'+this.id && jQuery.support.opacity){
						$('#menu ul li#'+this.id+' img').animate({ opacity: 1.0 }, 1 );
				  	}
				  }
			});
			
			//Colorindo Logo do Rodape
			$('#corpo_rodape .logos').live('mouseover mouseout', function(event) {
				var id = this.id;
				if (event.type == 'mouseover') {
					var num = $('#'+id).css({backgroundPosition: '0 -25px'});
				  } else {
					var num = $('#'+id).css({backgroundPosition: '0 0'});
				  }
			});
			
			//esmaecer galeria da home
			$('.bloco img, .categoria img, #thumb img, #paginacao_galeria img, #thub_por_midia img, #thub_por_filme img').animate({ opacity: 0.8 }, 1 );
			$('.bloco img, .categoria img, #thumb img, #paginacao_galeria img,  #thub_por_midia img, #thub_por_filme img').live('mouseover mouseout', function(event) {
				  if (event.type == 'mouseover')
					$(this).animate({ opacity: 1.0 }, 100 );
				  else 
					$(this).animate({ opacity: 0.8 }, 100 );
				  
			});
			
			$(".len_claro img").animate({ opacity: 0.8 }, 1 );
			$('#len_pt, #len_en').live('mouseover mouseout', function(event) {
				  if($(this).attr('class') == 'len_claro'){
				  if (event.type == 'mouseover')
					$('#'+this.id+' img').animate({ opacity: 1.0 }, 100 );
				  else 
					$('#'+this.id+' img').animate({ opacity: 0.8 }, 100 );
				  }
				  
			});
			
			
			
			//Rolar galeria de fotos home esquerda
			$('#pag_esquerdo').click(function(){
				if(galeria_aberta >= 2){
					galeria_aberta = galeria_aberta - 1;
					valor_galeria_aberta = valor_galeria_aberta + 476; 
					//alert(valor_galeria_aberta);
					$('#esteira_rolo').stop().animate({marginLeft: valor_galeria_aberta+'px'}, 600);
					
					$('.num_galeria a').css({color:'#000000'})
					$('#num_'+galeria_aberta+' a').css({color:'#808080'})
				}
			})
			
			//Rolar galeria de fotos home direita 
			$('#pag_direito').click(function(){
				if(galeria_aberta <= 2){
					galeria_aberta = galeria_aberta + 1;
					valor_galeria_aberta = valor_galeria_aberta - 476; 
					//alert('-'+valor_galeria_aberta);
					$('#esteira_rolo').stop().animate({marginLeft: valor_galeria_aberta+'px'}, 600);
					
					$('.num_galeria a').css({color:'#000000'})
					$('#num_'+galeria_aberta+' a').css({color:'#808080'})
					
				}
			})
			
			//Rolar galeria de fotos home por numero
			$('.num_galeria').click(function(){
				var num
				if(this.id == 'num_1')
					num = 0;
				else if(this.id == 'num_2')
					num = -476;
				else if(this.id == 'num_3')
					num = -952;
				
				$('#esteira_rolo').stop().animate({marginLeft: num+'px'}, 600);
				$('.num_galeria a').css({color:'#000000'})
				$(this).children('a').css({color:'#808080'})
					
			})
			
			
			// Subir legenda de filme
			$('.subir_legenda').live('mouseover mouseout', function(event) {
				
				 var alt = $(this).children("#legenda_video_filme").height() + 20;
				  if (event.type == 'mouseover'){
					$(this).children("#legenda_video_filme").stop().animate({marginTop: '-'+alt+'px'}, 300);
				  }else 
					$(this).children("#legenda_video_filme").stop().animate({marginTop: '0px'}, 300);
				
				/*  if (event.type == 'mouseover'){
					$(this).children("#legenda_video_filme").stop().animate({marginTop: '-40px'}, 300);
				  }else 
					$(this).children("#legenda_video_filme").stop().animate({marginTop: '0px'}, 300);
				*/
			});
			
			// Subir legenda de filme
			$('.subir_legenda_pg').live('mouseover mouseout', function(event) {
				 var alt = $(this).children("#legenda_video_filme_pg").height() + 20;
				  if (event.type == 'mouseover'){
					$(this).children("#legenda_video_filme_pg").stop().animate({marginTop: '-'+alt+'px'}, 300);
				  }else 
					$(this).children("#legenda_video_filme_pg").stop().animate({marginTop: '0px'}, 300);
			});
			
			
			$('.scroll-pane').jScrollPane({showArrows: true});
			
			$(".gallery a[rel^='prettyPhoto']").prettyPhoto({  });
			
			
			// Salvar nos Favoritos
			$("a.fav").click(function(e){
				
				e.preventDefault(); // this will prevent the anchor tag from going the user off to the link
				var bookmarkUrl = this.href;
				var bookmarkTitle = this.title;
			 	var len = this.rev;
				
				if (window.sidebar) { // For Mozilla Firefox Bookmark
					window.sidebar.addPanel(bookmarkTitle, bookmarkUrl,"");
				} else if(( window.external || document.all) && (navigator.userAgent.toLowerCase().indexOf('chrome') < 0)){ // For IE Favorite
					window.external.AddFavorite( bookmarkUrl, bookmarkTitle);
				} else if(window.opera) { // For Opera Browsers
					$("a.fav").attr("href",bookmarkUrl);
					$("a.fav").attr("title",bookmarkTitle);
					$("a.fav").attr("rel","sidebar");
				}  else if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) { 
					 if(len == 'en'){
					 	alert('This function is not available in Google Chrome. Click the star symbol at the end of the address-bar or hit Ctrl-D to create a bookmark.') 
					 }else{
						alert('Esta função não está disponível no Google Chrome.\n\nClique no símbolo de estrela no final da barra de endereços\n\nou pressione Ctrl-D para salvar em favoritos.')
					 }
					 return false;
				}  else { // for other browsers which does not support
							 
							  if(len == 'en'){
								 alert('Your browser does not support this bookmark action\n\n hit Ctrl-D to create a bookmark.');
							 }else{
								 alert('Seu navegador não suporta esta ação favorito\n\npressione Ctrl-D para salvar em favoritos.');
							 }
							
							 return false;
				}
		});
		
		$('#deixar_coment a').click(function(){
			$('#formulario_comentarios').fadeIn(300);
			return false;
		})
		$('#numero_comentarios a').click(function(){
			$('#todosComentarios').slideDown("slow");

		})
		
		
		

	})
	
	
