/* SLIDESHOW BANNERS HOME */
/*jQuery(document).ready( 
	function(){ 
		jQuery('ul#banner-list').innerfade({
			speed: 1000,
			timeout: 5000,
			type: 'sequence',
			containerheight: '150px'
		});
} ); */
jQuery(document).ready(function() {
	jQuery(function() {
		jQuery('#banner-list').show();
		jQuery('#banner-list').cycle({
			fx:     'fade',
			timeout: 6000,
			speed: 500
		});
	});
});

jQuery(document).ready(function() {
	jQuery(function() {
		jQuery('#dicas-list').show();
		jQuery('#dicas-list').cycle({
			fx:     'turnRight',
			timeout: 6000,
			speed: 200
		});
	});
});


/* FORMULARIOS VALIDAÇÃO */
jQuery(document).ready(function() {
	jQuery(".dm_form input, .dm_form select, .dm_form textarea").focus(
		function() {
			jQuery(this).addClass("field-focus");
		}).blur(
		function() {
			jQuery(this).removeClass("field-focus");
		});
	jQuery(".dm_form").submit(function(){
			jQuery(".dm_form .error :input").each(function(){
				if(jQuery(this).val() != "") jQuery(this).parents('label').addClass('mandatory').removeClass('error');
			});
			jQuery(".dm_form .mandatory :input").each(function(){
				if(jQuery(this).val() == "") jQuery(this).parents('label').removeClass('mandatory').addClass('error');
			});
			jQuery(".dm_form .error :input").each(function(){
				jQuery(this).blur(function(){
					  if(jQuery(this).val() != "") jQuery(this).parents('label').addClass('mandatory').removeClass('error');
					});
			});
			if (jQuery(".dm_form .error :input").size() != 0)
			{
				alert("Antes de enviar é necessário preencher todos os campos obrigatórios (destacados em vermelho).");
				return false;
			}
		});
});

/* popups */
function popup(url)
{
	window.open(url,'popup','width=450,height=450');		
}

function popupimg(url,w,h)
{
	window.open(url,'imgmes','width='+w+',height='+h);		
}

/** visibilidade **/
var obj_visivel = "";

function visivel(objeto) {
	if(obj_visivel != "" && obj_visivel != objeto){
		document.getElementById(obj_visivel).style.display = "none";
	}
	
	var obj = document.getElementById(objeto);
	
	if (obj.style.display == 'block'){
		obj.style.display = 'none';
	}
	else {
		obj.style.display = 'block';
	}
	
	obj_visivel = objeto;
}

/* LISTA LOJAS */
jQuery(document).ready(function() {
   
	jQuery("#lojas-servico").click(function() {
		jQuery("#bloco-lojas-servico").toggle("slow");
		jQuery("#bloco-lojas-lojas").hide();
		jQuery("#bloco-lojas-entretenimento").hide();
		jQuery("#bloco-lojas-quiosque").hide();
		jQuery("#bloco-lojas-alimentacao").hide();
	});

	jQuery("#lojas-lojas").click(function() {
		jQuery("#bloco-lojas-lojas").toggle("slow");
		jQuery("#bloco-lojas-servico").hide();
		jQuery("#bloco-lojas-entretenimento").hide();
		jQuery("#bloco-lojas-quiosque").hide();
		jQuery("#bloco-lojas-alimentacao").hide();
	});

	jQuery("#lojas-entretenimento").click(function() {
		jQuery("#bloco-lojas-entretenimento").toggle("slow");
		jQuery("#bloco-lojas-lojas").hide('slow');
		jQuery("#bloco-lojas-servico").hide('slow');
		jQuery("#bloco-lojas-quiosque").hide('slow');
		jQuery("#bloco-lojas-alimentacao").hide('slow');
	});

	jQuery("#lojas-quiosque").click(function() {
		jQuery("#bloco-lojas-quiosque").toggle("slow");
		jQuery("#bloco-lojas-lojas").hide('slow');
		jQuery("#bloco-lojas-entretenimento").hide('slow');
		jQuery("#bloco-lojas-servico").hide('slow');
		jQuery("#bloco-lojas-alimentacao").hide('slow');
	});

	jQuery("#lojas-alimentacao").click(function() {
		jQuery("#bloco-lojas-alimentacao").toggle("slow");
		jQuery("#bloco-lojas-lojas").hide('slow');
		jQuery("#bloco-lojas-entretenimento").hide('slow');
		jQuery("#bloco-lojas-quiosque").hide('slow');
		jQuery("#bloco-lojas-servico").hide('slow');
	});

 });

