(function($)
{
	$(function()
	{
		$( '.gallery a' ).lightBox(
		{
			imageLoading: base_path + '/global/img/bg/lightbox-ico-loading.gif',
			imageBtnPrev: base_path + '/global/img/bg/lightbox-btn-prev.gif',
			imageBtnNext: base_path + '/global/img/bg/lightbox-btn-next.gif',
			imageBtnClose: base_path + '/global/img/bg/lightbox-btn-close.gif',
			imageBlank: base_path + '/global/img/bg/lightbox-blank.gif'
		});

		$( "form.search label" ).watermark();
		
		$( "input:text, textarea, select", $( "#content" ) ).uniform();
	    
		// Comentario
		if( $( '#slides' ).length )
		{
			$( '#slides' ).slides(
			{
				preload: true,
				play: 6000,
				pause: 500,
				hoverPause: true
			});
		}

		if( $( '.carousel' ).length )
		{
			$( '.carousel' ).jcarousel(
			{
				scroll: 1
			});	
		}
		
		if( $( '.slidesEvent' ).length )
		{
			$( '.slidesEvent' ).jcarousel(
			{
				scroll:2,
				wrap:'vertical'
			});
		}
		
		$( 'div.news ul li:odd' ).addClass( 'back' );
		
		// form
		if( $( 'div.form' ).length )
		{
			//$( 'select' ).customSelect();
			
			$.validator.addMethod( "notEqual", function( value, element, param )
			{
 				return this.optional( element ) || value !== param;
			}, "Please choose a value!");
			
			$.metadata.setType( "attr", "validate" );
			
			$( "#contato" ).validate(
			{
				rules: {
   					email:
					{
		 				required: true,
		 				notEqual: "Email*:"
					},
					menseger:
					{
		 				required: true,
		 				notEqual: "Mensagem*:"
					},
					cidade:
					{
						required: true,
						notEqual: "Cidade*:"
					},
					nome:
					{
		 				required: true,
		 				notEqual: "Nome*:"
					}
				},
				messages:
				{
                	nome: "O nome é obrigatório",
                	email: "Forneça um email válido",
                	menseger: "Escreva aqui sua mesagem",
                	cidade: "Escreva o nome de sua Cidade"
     			}
			});
		}
		
		var galeria = $( "div.news div.galeria" );
		
		if( galeria.length )
		{
			$( "li:first", galeria )
				.addClass( "ativo" )
				.find( "img" ).show();
				
			$( 'ul li a', galeria ).bind( "mouseenter", function()
			{
				$( this )
					.parent()
						.addClass( "ativo" )
						.find( "img" ).fadeIn( "slow" ).end()
						.siblings( ".ativo" )
							.removeClass( "ativo")
							.find( "img" ).fadeOut( "slow" ).end()

	    	});
		} 
		
	
		/*
		$( 'div.sidebar .slide.carousel a' ).click( function()
					{
						var thumb = $( this ).attr( 'href' );
						
						$( '.imgBig' ).attr( 'src', thumb );
						
						return false;
					});*/
		
	
	});
}( jQuery ) );
