$(document).ready(function(){
	
/*______________________________________________________________________________jquery Cycle em index.php*/
	var tamanho_carousel = $('#carousel_img li').length;
	if(tamanho_carousel>1){
		$('.next, .prev').css({'display':'block'});
		$('#carousel_img').cycle({ 
			fx		: 'scrollHorz', 
			next	: '.next',
			prev	: '.prev',
			timeout	: 10000, 
			speed:    500,
			pause	: 1,
			cleartypeNoBg	: true,
			random:  1 
		});
	}
	div_hover('#carousel_img a');
	div_hover('#table_parceiros a');
	div_hover('.next');
	div_hover('.prev');
	div_hover('.next_pq');
	div_hover('.prev_pq');
	
/*______________________________________________________________________________ jquery Cycle em categoria.php*/
	var tamanho_carousel_categoria = $('#lista_categoria li').length;
	if(tamanho_carousel_categoria>1){
		$('.next_pq, .prev_pq').css({'display':'block'});
		$('#lista_categoria').cycle({
			fx		: 'scrollHorz', 
			next	: '.next_pq',
			prev	: '.prev_pq',
			pager	: '#nav',
			timeout	: 20000, 
			speed	: 500,
			pause	: 1,
			cleartypeNoBg	: true
		});
	}
	
	$('.lista-img_holder div').hover(
		function(){
			$(this).find('img').stop(true).fadeTo(100, 0.6);
		},
		function(){
			$(this).find('img').stop(true).fadeTo(100, 1);
		}
	);
	
/*______________________________________________________________________________ scrol em quemsomos.php e parceiros.php*/

	$('#scrollbar').tinyscrollbar();
	
/*______________________________________________________________________________ Dados da modelo em modelos_desc.php*/
	var div_height = $('.dados_modelo').height();
	$('.dados_modelo').css({
		bottom: -div_height+35
	});
	$('.pic_modelo').hover(
		function(){
			$(this).find('.dados_modelo')
			.stop(true)
			.animate({
				bottom: 0
			}, 250);
		},
		function(){
			$(this).find('.dados_modelo')
			.stop(true)
			.animate({
				bottom: 35 -div_height
			}, 250);
		}
	);
	var tamanho_carousel_modelo = $('#carousel_fotos_modelo li').length;
	if(tamanho_carousel_modelo>1){
		$('.next_pq, .prev_pq').css({'display':'block'});
		$('#carousel_fotos_modelo').cycle({ 
			fx		: 'scrollHorz',			
			next	: '.next_pq',
			prev	: '.prev_pq',
			timeout	: 20000, 
			speed	: 500,
			pause	: 1,
			cleartypeNoBg : true
		});
	}
	
	$('#carousel_fotos_modelo a').fancybox({
		'titlePosition'		: 'inside',
		'transitionIn'		: 'elastic',
		'overlayColor'		: '#000000',
		'centerOnScroll'	: true,
		'overlayOpacity'	: 0.8,
		'scrolling'			: 'no',
		'cyclic'			: true,
		'centerOnScroll'	: true
	});
	
	$('#carousel_fotos_modelo div').hover(
		function(){
			$(this).find('img').stop(true).fadeTo(100, 0.6);
		},
		function(){
			$(this).find('img').stop(true).fadeTo(100, 1);
		}
	);
	
	$('#form_categoria input').each(function(){
		var valor = $(this).val();
		$(this).focus(function(){
			if($(this).val() == valor){
				$(this).val("");
			}
		});
		$(this).blur(function(){
			if($(this).val() == ""){
				$(this).val(valor);
			}
		});
	});
	$('.input_categoria')
		.find('select')
		.css('opacity',0)
		.each(function(){				
			var valorIni = $(this).find('option:selected').text();
			$(this).siblings('span').html(valorIni)
		})
		.change(function(){
			var str = $(this).find('option:selected').text();
			$(this).siblings('span').text(str);
		}
	);
});

/*______________________________________________________________________________ mascara de dados em inscreva.php*/
$(document).ready(function(){
	$('#data_nascimento').setMask('date');
	$('#fone').setMask('(99) 9999-9999');
	$('#cep').setMask('cep');
	$('#altura').setMask('2,99');
	$('#cintura').setMask('9999');
	$('#quadril').setMask('9999');
	$('#manequim').setMask('9999');
	$('#busto').setMask('9999');
	$('#sapatos').setMask('99');
});	

function div_hover(div){
	$(div).hover(
		function(){
			$(this).stop(true).fadeTo(100, 0.6);
		},
		function(){
			$(this).stop(true).fadeTo(100, 1);
		}
	);
}
