
        
            //<![CDATA[
            
                $(document).ready(function() 
                {
					
                    /*--
                    * -----------------------
                    * =======================
                    * FORMULÁRIOS
                    * =======================
                    * -----------------------
                    --*/
					
					// ============================================
                    // FUNÇÕES GLOBAIS
                    // ============================================
					
					function switchText()
					{
						if ($(this).val() == $(this).attr('title'))
						{
							$(this).val('');
						}
						else if ($.trim($(this).val()) == '')
						{
							$(this).val($(this).attr('title'));
						}
					}
					
					// ============================================
                    // EXIBIR / OCULTAR TÍTULOS DE FORMULÁRIOS
                    // ============================================
					
					$('input[type=text][title!=""]').each(function() 
					{
						if ($.trim($(this).val()) == '')
						{
							$(this).val($(this).attr('title'));
						}
					}).focus(switchText).blur(switchText);
					
					$('textarea[title!=""]').each(function() 
					{
						if ($.trim($(this).val()) == '') 
						{
							$(this).val($(this).attr('title'));
						}
					}).focus(switchText).blur(switchText);
                    
                    // ============================================
                    // ACCORDION
                    // ============================================
            
                    // -----
                    // OCULTA
                    // -----
                    
                    $('.envolve_conteudo_formulario').hide();
            
                    // -----
                    // EXIBE
                    // -----
                    
                    $('a[href=#]').click(function()
                    {
                        var next = $(this).parents('h2.botao').next().stop(true, true);
            
                        if (next.is(':visible'))
                        {
                            next.slideUp(1500,'easeInOutCubic');									
                            $('h2.botao').removeClass('ativo');
                        }
                        else
                        {
                            next.slideDown(1500,'easeInOutCubic');
                            $('h2.botao').removeClass('ativo');
                            $(this).parents('h2.botao').addClass('ativo');
                        }
            
                        next.siblings('.envolve_conteudo_formulario:visible').slideUp(400);
                        return false;
            
                    })
					
					// ============================================
                    // ENVIO DE FORMULÁRIOS
                    // ============================================
					
					$("form").submit(function()
					{						
						
						var dados = $(this).serialize();												
						var erros = false;
						var files;
						
						$(this).find('input[type=text][title!=""]').each(function()
						{
							if ($(this).val() == $(this).attr('title'))
							{
								erros = true;
							}
						})
						$(this).find('textarea[title!=""]').each(function() 
						{
							if ($(this).val() == $(this).attr('title'))
							{
								erros = true;
							}
						})
						
						if (erros == false)
						{
							
							$(this).find("div.status > div").addClass('information');							
							$(this).find("div.status > div > span").html('Enviando! Por favor aguarde alguns segundos.');
							$(this).find("div.status").fadeIn();
							
							if (($(this).parents("div").attr("id")) == 'exibition')
							{
								files = 'comentarios';
							}
							else
							{
								files = 'formularios';
							}
							
							$.post('http://www.ebrothers.com.br/controllers/'+files+'.php', dados, function(resposta)
							{
								if (resposta != false)
								{
									
									$('input[type=text][title!=""]').each(function() 
									{
										$(this).val($(this).attr('title'));
									});
									
									$('textarea[title!=""]').each(function() 
									{
										$(this).val($(this).attr('title'));
									});
									
									$("div.status > div").attr('class','confirm');		
									$("div.status > div > span").html(resposta);
									$("div.status").delay(3000).fadeOut();
									
								}
								else
								{
									$("div.status > div").attr('class','error');		
									$("div.status > div > span").html('Ocorreu um erro! Por favor, tente novamente.');
									$("div.status").delay(5000).fadeOut();
								}								
							});
						}
						else
						{
							$(this).find("div.status > div").addClass('alert');
							$(this).find("div.status > div > span").html('Ops! Preencha todos os campos.');
							$(this).find("div.status").fadeIn();
							$(this).find("div.status").delay(3000).fadeOut();							
						}

						return false;
														
					})							
            			
                    /*--
                    * -----------------------
                    * =======================
                    * GRID ACCORDION
                    * =======================
                    * -----------------------
                    --*/
					                        
					/*--
                    * -----------------------
                    * =======================
                    * CLIENTES
                    * =======================
                    * -----------------------
                    --*/
					                
					$("div#listaClientes div a").hover(function()
					{
						$(this).find("img.comum").fadeIn();
					}, function()
					{
						$(this).find("img.comum").fadeOut();
					});
                
                    /*--
                    * -----------------------
                    * =======================
                    * LIGHTBOX
                    * =======================
                    * -----------------------
                    --*/
                
					jQuery('.lightbox').lightbox();
					
					/*--
                    * -----------------------
                    * =======================
                    * O QUE FAZEMOS
                    * =======================
                    * -----------------------
                    --*/
					
					/*--
                    * -----------------------
                    * =======================
                    * BLOG
                    * =======================
                    * -----------------------
                    --*/					
					
					$("div#categoriasBlogs li a").hover(function(){
						$(this).animate({
							'padding-left': '+=10px'
						}, "normal");
					}, function(){
						$(this).animate({
							'padding-left': '-=10px'
						}, "normal");
					});
					
					/*--
                    * -----------------------
                    * =======================
                    * HOME
                    * =======================
                    * -----------------------
                    --*/
					
					$("div#conquistas ul").cycle({
						fx		: 'fade',
						speed   : 1000,
						timeout : 8000
					})
					
					$('div#bannerDestaque').wpwBSrotator({
						width:991,
						height:392,
						rows:4,
						cols:5,
						ease:"easeInOutCirc",
						blockSpeed:800,
						blockDelay:100,
						blockOrderNext: "random",
						blockOrderPrev: "random",
						menuVisible: true,
						menuWidth: 200,
						menuType:"text",
						menuPosition:"right",
						menuAlign:"left",
						slideshowSpeed:5200,
						slideshowEnabled:true
						
					});
                
                })
                    
            // ]]>

