$(function(){
	$('#parceiros a, #soon a' ).hover(function(){
		$(this).animate({opacity:0.5}, 100);
	}, function(){
		$(this).animate({opacity:1}, 100);
	})
	
	$('#play_index' ).hover(function(){
		$(this).animate({opacity:0.5}, 100);
	}, function(){
		$(this).animate({opacity:0.8}, 100);
	})
	
	
	/*
	 * ToggleFormText
	 *
	 * Author:   Grzegorz Frydrychowicz
	 * E-mail:   grzegorz.frydrychowicz@gmail.com
	 * Date:     16-11-2007
	*/

	$("input:text, textarea, input:password").each(function(){
        if(this.value == '')
            this.value = this.title;
    });
    $("input:text, textarea, input:password").focus(function(){
        if(this.value == this.title)
            this.value = '';
    });
    $("input:text, textarea, input:password").blur(function(){
        if(this.value == '')
            this.value = this.title;
    });
    /*$("input:image, input:button, input:submit").click(function(){
        $(this.form.elements).each(function(){
            if(this.type =='text' || this.type =='textarea' || this.type =='password' ){
                if(this.value == this.title && this.title != ''){
                    this.value='';
                }
            }
        });
    });*/
	
	/*FIM ToggleFormText*/
	
})


/*EMBED DO FLASH*/
var release = "7,0,19,0"; 
function flashsrc(swf,flashVarString,w,h,bgcolor,menu,mode,q,id){
    
     document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ' 
     +'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+release+'" ' 
     +'width="'+w+'" height="'+h+'" id="'+id+'" align="">' 
     +'<param name="movie" value="'+swf+'">' 
     +'<param name="menu" value="'+menu+'"> ' 
     +'<param name="quality" value="'+q+'"> ' 
     +'<param name="wmode" value="'+mode+'"> ' 
     +'<param name="bgcolor" value="'+bgcolor+'"> ' 
     +'<param name="flashvars" value="'+flashVarString+'"> ' 
     +'<embed src="'+swf+'" flashvars="'+flashVarString+'" menu="'+menu+'" quality="'+q+'" wmode="'+mode+'" ' 
     +' bgcolor="'+bgcolor+'"  width="'+w+'" height="'+h+'" name="'+swf+'" ' 
     +' align=""  type="application/x-shockwave-flash" ' 
     +' pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object> '); 
};


/*AJAX FORM powered by Fernando Souza, nandosouza.com

Usage: 
$(function(){
	$('form').ajaxForm();
});

Seleciona todos os formulários contidos na página em questão e executa a função
$('form').ajaxForm();

*/

(function($){
	$.fn.ajaxForm = function(options){
		this.each(function(){
			
			var $this    = $(this);
			var distino  = this.action;
			var $logText  = $('.log');
			
			/*Detecta se já existe um label com a classe "log". Caso não encontre a escreve no final do form */
			if ($logText[0]) {
			}else {
				$this.append('<label class="log"></label>');
			}
			
			$('.log').fadeOut();
			$('.log').ajaxStart(function() {
			  $('.log').html('Dados sendo enviados');
			});
			
			
			if($this.is('form')&&$this.attr('action')!=''){
				this.action = '';
				$this.submit(function(){
					var campos = $this.serialize();
					$('.log').fadeIn().html(campos);
					$.post(distino,	{campos: campos}, function(data, textStatus) {
						$('.log').fadeIn().text(data);
					});
					return false;
				})
			}else{
				alert('Um dos formulários não está com o atributo Action Definido');
			}
			
		})
	}
})(jQuery)

$(function(){
	$('#formNewsletter').submit(function(){
		var destino = $(this).attr('action');
		var nome = $(this).find('input[name="nome"]').val();
		var email = $(this).find('input[name="email"]').val();
		
		$('.log').html('').hide();
		
		if(nome==$(this).find('input').attr('title')){
			$('.log').delay(1).fadeIn().html('Preecha o campo nome');
		}else{
			$.get(destino, {nome:nome,email:email}, function(data, textStatus) {
				$('.log').fadeIn().html(data);
			});
		}
				
		
		return false
	})
})

function teste() {
	$("#header #marca_hover").animate({				 
				 width: 'toggle' ,
				 fade: 'slow',
				 opacity: 'toggle',
				 left: '=0'	     				
			}, { 
				queue:false, 
				duration:700	
			});
}

$(document).ready(function() {
	
	$('h3 a#post').click(function(){
		$(".formForum").slideToggle("slow");
		return false;
	});
	
	//TWITTER
	$(".tweet").tweet({
		username: "estudiomuzak",
		join_text: "auto",
		avatar_size: 0,
		count: 6,
		auto_join_text_default: "", 
		auto_join_text_ed: "we",
		auto_join_text_ing: "we were",
		auto_join_text_reply: "RT: ",
		auto_join_text_url: "we were checking out",
		loading_text: "carregando tweets..."
	});
	
	$(document).pngFix(); 
});

$(function(){
	var qtdLinks  = $('#lista_opcao a').length;
	var somaLinks;
	
	$('.lista_pag').each(function(){
		somaLinks = 0;
		$(this).find('a').each(function(){
			larguraLinks = $(this).width()+parseInt($(this).css('paddingLeft')+$(this).css('paddingRight'))+7;
			somaLinks += larguraLinks;
		})
		$(this).width(somaLinks);
	});
		
})

/*INICIANDO SHADOWBOX*/
Shadowbox.init();

