// fontes
Cufon.replace('h1,h2,h3', { hover:true, fontFamily: 'Helvetica Neue' });	
Cufon.replace('h3', { hover:true, fontFamily: 'Helvetica Neue', textShadow: '#fff 0px 1px' });	
Cufon.replace('h3.titulo_pagina', { hover:true, fontFamily: 'Helvetica Neue', textShadow: '#fff 0px 1px' });	
Cufon.replace('#featured h3', { hover:true, fontFamily: 'Helvetica Neue', textShadow: '#fff 0px 1px' });	
Cufon.replace('h4', { hover:true, fontFamily: 'Helvetica Neue', textShadow: '#fff 0px 1px' });	
Cufon.replace('h5.campanha', { hover:true, fontFamily: 'Helvetica Neue', textShadow: '#fff 0px 1px' });	


/*Cufon.replace('h5', { hover:true, fontFamily: 'Klavika Light' });+/
/*
Cufon.replace('#top-menu ul li a', { hover:false, fontFamily: 'aller-light-italic' });	
Cufon.replace('#top-menu ul li a.selected', { hover:false, fontFamily: 'aller-light-bold-italic' });
*/
Cufon.replace('.headlink', { hover:false, fontFamily: 'Helvetica Neue', textShadow: '#333 0px 1px' });	
Cufon.replace('.headlink.selected', { hover:false, fontFamily: 'Helvetica Neue', textShadow: '#333 0px 1px' });


// slider
function onAfterCycle(curr, next, opts){
			var i = opts.currSlide;
			
			$("#cycle-control .button").removeClass("current");
			$("#cycle-control .button:eq("+i+")").addClass("current");
		}
		
		$(function() {
			
			var speed = 400,
				timeout = 5000;
			
			$("#featured").cycle ({
				fx: 'scrollDown',
				cleartype:  true,
				cleartypeNoBg:  true,
				speed: speed,
				timeout: timeout,
				after: onAfterCycle
			});
			
			$("#featured-images").cycle({
				fx: 'fade',
				cleartype:  true,
				cleartypeNoBg:  true,
				speed: speed,
				timeout: timeout
			});
			//build the feature showcase control
			var count = $("#featured-images li").size()+1;
			var ctrlAnchors = "";
			for(i=1; i<count; i++)
			{
				ctrlAnchors += '<div class="button">'+i+'</div>';
			}
			$('#cycle-control').html(ctrlAnchors);
			$('#cycle-control .button:first-child').addClass('current');
			
			var controls = $('#cycle-control .button');
			var slides = $('#featured, #featured-images');
			
			controls.click(function(){
				slides.cycle(controls.index(this));
			});
			
			slides.hover(
				function(){
					slides.cycle('pause');
				},
				function(){
					slides.cycle('resume');
				}				
			);
        });


// valor search textbox
swapValues = [];
$(".swap_value").each(function(i){
	swapValues[i] = $(this).val();
	$(this).focus(function(){
		if ($(this).val() == swapValues[i]) {
			$(this).val("");
		}
	}).blur(function(){
		if ($.trim($(this).val()) == "") {
			$(this).val(swapValues[i]);
		}
	});
});

				
// galeria
$("a[rel^='gallery']").prettyPhoto({
	theme: 'light_rounded'
});


// produtos
//$("#chained").scrollable({circular: true, mousewheel: true}).navigator();	
$("#chained").scrollable().navigator();	
$("#chained2").scrollable().navigator();	
$("#chained3").scrollable().navigator();


// produtos detalhes contactar 
$(".bt_contact").click(function(){
	//obter o y do form
	/*
	yform = $("#form").offset().top;
	$("html, body").animate({scrollTop:yform}, 400);
	return false;
	*/

	if ($("#contactForm").is(":hidden")){
		$("#contactForm").slideDown("slow");
		
		$(".bt_contact").addClass("invisivel");
		
		yform = $("#contactForm").offset().top;
		$("html, body").animate({scrollTop:yform}, 500);
	}
	else{
		$("#contactForm").slideUp("slow");
	}
	
	return false;

});
/*
	$("#contactLink").click(function(){
	});
*/

// activar o banner
$(document).ready(function(){
	$("#featured-wraper").removeClass("invisivel");
});


// thumbnails nas marcas
$("ul.thumb li").hover(function() {
	$(this).css({'z-index' : '10'}); /*Add a higher z-index value so this image stays on top*/ 
	$(this).find('div').addClass("hover").stop() /* Add class of "hover", then stop animation queue buildup*/
		.animate({
			marginTop: '-60px', /* The next 4 lines will vertically align this image */ 
			marginLeft: '-60px',
			top: '50%',
			left: '50%',
			width: '120px', /* Set new width */
			height: '120px', /* Set new height */
			padding: '5px'
		}, 400); /* this value of "200" is the speed of how fast/slow this hover animates */

	} , function() {
	$(this).css({'z-index' : '0'}); /* Set z-index back to 0 */
	$(this).find('div').removeClass("hover").stop()  /* Remove the "hover" class , then stop animation queue buildup*/
		.animate({
			marginTop: '0', /* Set alignment back to default */
			marginLeft: '0',
			top: '0',
			left: '0',
			width: '75px', /* Set width back to default */
			height: '75px', /* Set height back to default */
			padding: '2px'
		}, 400);
});

/*
$("ul.thumb li").hover(function() {
	$(this).css({'z-index' : '10'});
	$(this).find('img').addClass("hover").stop()
		.animate({
			marginTop: '-80px',
			marginLeft: '-80px',
			top: '50%',
			left: '50%',
			width: '125px',
			height: '125px',
			padding: '20px'
		}, 200); 

	} , function() {
	$(this).css({'z-index' : '0'});
	$(this).find('img').removeClass("hover").stop()
		.animate({
			marginTop: '0',
			marginLeft: '0',
			top: '0',
			left: '0',
			width: '75px', 
			height: '75px', 
			padding: '5px'
		}, 400);
});
*/
