			$( window ).load( function()
			{
				

				$( ".show-panel" ).find( "a" ).bind( "click", function()
				{
					$( ".painel-fechar" ).bind( "click", function()
					{
						$( ".painel" ).hide();
						$( ".show-panel" ).find( "a" ).removeClass( "active" );			
						
						return false;
					});
				
					$( ".painel" ).hide();
				
					var e      = $( this );
					
					if ( !e.is( ".active" ) )
					{					
						$( ".show-panel" ).find( "a" ).removeClass( "active" );					
						
						e.addClass( "active" );
						
						var eoffset = $( ".ar" ).offset().left;
						var acesso = e.attr( "href" );
					
						var painel = $( ".painel-" + acesso );
						var w      = $( window );
					
						var dHeight = painel.outerHeight();
						var dWidth  = painel.outerWidth();
					
						// Recupera a altura e largura da janela.
						var wHeight = w.height();
						var wWidth  = w.width();
							
						var left = ( wWidth / 2 - dWidth / 2 ) + w.scrollLeft() + eoffset;
						var top =  ( wHeight / 2 - dHeight / 2 ) + w.scrollTop();
					
						painel.css({
									"left" : left,
									"top"  : top
								  });						
						
						painel.slideDown( "fast" );					
					}
					else
					{
						$( ".ar" ).find( "a" ).removeClass( "active" );
					}
					
					return false;
				});
				
			
				$( '.solucao' ).not( ':first' ).hide();
				$( '.solucao:first' ).addClass( 'solucao-on' );
				$( '.menu-solucoes' ).animate( { backgroundPosition : '0px -34px' } ) ;
				
				$( ".link-solucoes" ).bind( "click", function()
				{				
					var solucao = $( this ).attr( "href" );

					if ( solucao === 'privado' )
					{
						$( '.menu-solucoes' ).animate( { backgroundPosition : '0px -34px' } ) ;
					}
					else if ( solucao === 'publico' )
					{
						$( '.menu-solucoes' ).animate( { backgroundPosition : '0px -68px' } ) ;
					}
					else
					{
						$( '.menu-solucoes' ).animate( { backgroundPosition : '0px -102px' } ) ;
					}
					
					$( '.solucao' ).css( 'background-color', '#FFFFFF' );
					
					$( '.solucao-on' ).fadeOut( 'fast', function()
					{
						$( this ).removeClass( 'solucao-on' );
						
						$( '.' + solucao ).fadeIn( 'fast', function()
						{
							$( '.solucao' ).css( 'background', 'transparent' );										  
						})
						.addClass( 'solucao-on' );
										  
						
					});

					return false;
				});				
				
				$( ".produtos a" ).each(function( i )
				{
					var title = $( this ).attr( "title" );
					
					if ( title != null && title !== 'undefined' && title.length > 0 )
					{
						$( "body" ).append( "<div class='hint' id='hint" + i + "'><p>" + $( this ).attr( "title" ) + "</p></div>" );
						
						var my_tooltip = $( "#hint" + i );

						$( this ).removeAttr( "title" ).mouseover(function()
						{
							my_tooltip.css(
											{
												opacity : 0.8, 
												display : "none"
											}).fadeIn( 400 );

						}).mousemove( function( kmouse )
						{					
							my_tooltip.css({left:kmouse.pageX+15, top:kmouse.pageY+15});
						}).mouseout(function()
						{
							my_tooltip.fadeOut(400);
						});
					}
				});
				
				
				
				$('input[title], textarea[title]').each(function() {
						if($(this).val() === '') {
							$(this).val($(this).attr('title'));	
						}
						
						$(this).focus(function() {
							if($(this).val() == $(this).attr('title')) {
								$(this).val('').addClass('focused');	
							}
						});
						$(this).blur(function() {
							if($(this).val() === '') {
								$(this).val($(this).attr('title')).removeClass('focused');	
							}
						});
					});
				
				
				
				$( document ).find( ".action" ).each( function( i )
				{
					$( this ).bind( "click", function()
					{
						var link   = $( this );
						var action = link.attr( "href" );
						
						if ( link.is( ".running" ) )
						{
							return false;
						}
						
						link.addClass( "running" );
						
						if ( action === "email" )
						{
							var form = link.parents( "form" );
							var params = form.serialize();
							
							form.find( "input, textarea" ).each( function( i )
							{
								$( this ).attr( "disabled", "disabled" );
							});
							
							form.find( ".status" ).show( "slow" )
												  .html( "Aguarde..." );
							
							$.post( "src/mail.php", params, function( data ) 
							{
								form.find( ".status" ).html( data );
								
								form.find( "input, textarea" ).each( function( i )
								{
									$( this ).attr( "disabled", "" );
								});
								
								link.removeClass( "running" );
							});
						}
						
						if ( action === "limpar" )
						{
							var form = link.parents( "form" );
							
							form.find( "input[type='text'], textarea" ).each( function( i )
							{	
								$( this ).val( $( this ).attr( "title" ) );
							});
						}
						
						return false;
					});
				});				
			});
