
jQuery(document).ready(function() {
    jQuery('#inicial-slide').cycle({
		fx: 'fade',
		speed: 1500// choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});
	jQuery("#my-select").select_skin();
	jQuery("#estado_civil").select_skin();
	jQuery("#joias_categoria").select_skin();
	jQuery("#joias_subcategoria").select_skin();
	jQuery("#telefone").focus(function() {
		var id=jQuery("#telefone").attr("alt");
		if(id==0){
			jQuery("#telefone").mask("(99) 9999-9999");
			jQuery("#telefone").attr("alt", 1);
			id=jQuery("#telefone").attr("alt");
		};
		
	});
	jQuery("#cep").focus(function() {
		var id=jQuery("#cep").attr("alt");
		if(id==0){
			jQuery("#cep").mask("99999-999");
			jQuery("#cep").attr("alt", 1);
			id=jQuery("#cep").attr("alt");
		};
		
	});
		jQuery("#datadenas").focus(function() {
		var id=jQuery("#datadenas").attr("alt");
		if(id==0){
			jQuery("#datadenas").mask("99/99/9999");
			jQuery("#datadenas").attr("alt", 1);
			id=jQuery("#datadenas").attr("alt");
		};
		
	});
	jQuery("#cpf").focus(function() {
		var id=jQuery("#cpf").attr("alt");
		if(id==0){
			jQuery("#cpf").mask("999.999.999-99");
			jQuery("#cpf").attr("alt", 1);
			id=jQuery("#cpf").attr("alt");
		};
		
	});
	jQuery('#empresa_geral').fadeIn(2000);
	jQuery('li[class=empresa_menu_link]').click(function(e) {
		e.preventDefault();
		var tipoempresa = jQuery(this).attr('title');
		jQuery('#empresa_geral').fadeOut(700, function(){
			jQuery.ajax({
				type: "POST", 
				url: "empresa.php",
				data: "tipo="+tipoempresa,
				   success: function(txt) {
					jQuery('#empresa_geral').fadeIn(2000).html(txt);
				  }
				}
			 );
		});
	});
	jQuery('li[id="li_primeiro"]').css("cursor","default");
	jQuery('li[class="catalogo_li"]').click(function(){
		var valor = jQuery(this).attr('title');
		if (jQuery('#catalogo_texto').attr('title')!=valor) {
			jQuery('li[class="catalogo_li"]').css("cursor","pointer");
			jQuery(this).css("cursor","default");
			jQuery('#catalogo_texto, #catalogo_iframe').fadeOut(1000, function(){
				jQuery.post('catalogo_texto.php', 
				{ codigo: valor},
				function(data) {
					jQuery('#catalogo_iframe').fadeIn(2000).attr('src', "imagens/catalogo/"+valor);
					jQuery('#catalogo_texto').fadeIn(2000).html(data);
				},
				'html');
			});
			jQuery('#catalogo_texto').attr('title', valor);
		};
	});
	jQuery('img[alt="Anterior"]').css("cursor","default");
	if ((parseInt(jQuery('#numero_foto').text()))==(parseInt(jQuery('#numero_foto').attr('title')))) {
		jQuery('img[alt="Proxima"]').css("cursor","default");
	}
	jQuery('img[alt="Proxima"]').click(function(){
		var numero_foto = parseInt(jQuery('#numero_foto').text());
		var numeros_fotos = parseInt(jQuery('#numero_foto').attr('title'));
		var codigo_fotos = parseInt(jQuery('#numero_fot').attr('title'));
		if (numeros_fotos!=numero_foto) {
		jQuery('#joia_imagem').fadeOut(1000, function(){
		jQuery.post('imagem_joia.php', 
			{ n_d_foto: numero_foto, codigo: codigo_fotos},
			function(data) {
				jQuery('#joia_imagem').fadeIn(2000).html(data);
				jQuery('#numero_foto').text(numero_foto+1);
				numero_foto = numero_foto+1;
					if (numero_foto==numeros_fotos) {
						jQuery('img[alt="Proxima"]').css("cursor","default");
					}
				
			},
			'html');});
			jQuery('img[alt="Anterior"]').css("cursor","pointer");
		}
	});
	
	jQuery('img[alt="Anterior"]').click(function(){
		var numero_foto = parseInt(jQuery('#numero_foto').text());
		var numeros_fotos = parseInt(jQuery('#numero_foto').attr('title'));
		var codigo_fotos = parseInt(jQuery('#numero_fot').attr('title'));
		var enviarnumero = numero_foto-2;
		if (numero_foto!=1) {
		jQuery('#joia_imagem').fadeOut(1000, function(){
		jQuery.post('imagem_joia.php', 
			{ n_d_foto: enviarnumero, codigo: codigo_fotos},
			function(data) {
				jQuery('#joia_imagem').fadeIn(2000).html(data);
				jQuery('#numero_foto').text(numero_foto-1);
				numero_foto = numero_foto-1;
					if (numero_foto==1) {
						jQuery('img[alt="Anterior"]').css("cursor","default");
					}
				
			},
			'html');});
			jQuery('img[alt="Proxima"]').css("cursor","pointer");
		}
	});
	jQuery('img[alt="Proxima_col"]').click(function(){
		var numero_foto = parseInt(jQuery('#numero_foto').text());
		var numeros_fotos = parseInt(jQuery('#numero_foto').attr('title'));
		var codigo_fotos = parseInt(jQuery('#numero_fot').attr('title'));
		if (numeros_fotos!=numero_foto) {
		jQuery('#joia_imagem').fadeOut(1000, function(){
		jQuery.post('imagem_colecao.php', 
			{ n_d_foto: numero_foto, codigo: codigo_fotos},
			function(data) {
				jQuery('#joia_imagem').fadeIn(2000).html(data);
				jQuery('#numero_foto').text(numero_foto+1);
				numero_foto = numero_foto+1;
					if (numero_foto==numeros_fotos) {
						jQuery('img[alt="Proxima"]').css("cursor","default");
					}
				
			},
			'html');});
			jQuery('img[alt="Anterior"]').css("cursor","pointer");
		}
	});
	jQuery('img[alt="Anterior_col"]').css("cursor","default");
	if ((parseInt(jQuery('#numero_foto').text()))==(parseInt(jQuery('#numero_foto').attr('title')))) {
		jQuery('img[alt="Proxima_col"]').css("cursor","default");
	}
	jQuery('img[alt="Anterior_col"]').click(function(){
		var numero_foto = parseInt(jQuery('#numero_foto').text());
		var numeros_fotos = parseInt(jQuery('#numero_foto').attr('title'));
		var codigo_fotos = parseInt(jQuery('#numero_fot').attr('title'));
		var enviarnumero = numero_foto-2;
		if (numero_foto!=1) {
		jQuery('#joia_imagem').fadeOut(1000, function(){
		jQuery.post('imagem_colecao.php', 
			{ n_d_foto: enviarnumero, codigo: codigo_fotos},
			function(data) {
				jQuery('#joia_imagem').fadeIn(2000).html(data);
				jQuery('#numero_foto').text(numero_foto-1);
				numero_foto = numero_foto-1;
					if (numero_foto==1) {
						jQuery('img[alt="Anterior"]').css("cursor","default");
					}
				
			},
			'html');});
			jQuery('img[alt="Proxima"]').css("cursor","pointer");
		}
	});
		var id = jQuery('#modal_enviar_por_email');
	
		var maskHeight = jQuery(document).height();
		var maskWidth = jQuery(window).width();
	
		jQuery('#modal_mask').css({'width':maskWidth,'height':maskHeight});

		jQuery('#modal_mask').fadeIn(1000).fadeTo("slow",0.6);	
	
		var winH = jQuery(window).height();
		var winW = jQuery(window).width();
              
		jQuery('#modal_enviar_por_email').css('top',  winH/2-jQuery(id).height()/2);
		jQuery('#modal_enviar_por_email').css('left', winW/2-jQuery(id).width()/2);
	
		jQuery('#modal_enviar_por_email').fadeIn(2000); 
	
	
	jQuery('.modal_close').click(function () {
		jQuery('#modal_mask').fadeOut("slow");
		jQuery('#modal_enviar_por_email').fadeOut("slow");
	});		
	
	jQuery('#modal_mask').click(function () {
		jQuery(this).fadeOut("slow");
		jQuery('#modal_enviar_por_email').fadeOut("slow");
	});	
});

	
function clrcontato(a, b, c){
	if(a==c){
		document.getElementById(b).value="";
	}
	return true;
}
function precontato(a, b, c){
	if(document.getElementById(b).value==""){
		document.getElementById(b).value=c;
	}
	return true;
}
function precontato_tel(a, b, c, d){
	if(document.getElementById(b).value==d){
		document.getElementById(b).value=c;
	}
	return true;
}


if(typeof sIFR == "function"){

// This is the preferred "named argument" syntax
	sIFR.replaceElement(named({
			sSelector:"#contatotitulo",
			sFlashSrc:"letras/trajanpro.swf",
			sColor: null,
			sLinkColor: null,
			sBgColor:null,
			sHoverColor:null,
			nPaddingTop:0,
			nPaddingBottom:0,
			sFlashVars: null,
			sCase: null,
			sWmode:"transparent"
		}));

};

