// Sprite
$(document).ready(function(){						   
    $('#nav li a').append('<span class="hover"></span>')		   
	$('#nav li a').hover(function() {
	// Stuff that happens when you hover on + the stop()
	$('.hover', this).stop().animate({
		'opacity': 1
		}, 700,'easeOutSine')
	
	},function() {	
	// Stuff that happens when you unhover + the stop()
	$('.hover', this).stop().animate({
		'opacity': 0
		}, 1200, 'easeOutQuad')
	})
});


$(document).ready(function(){						   
    $('#mainnav li a').append('<span class="hover"></span>')		   
	$('#mainnav li a').hover(function() {
	// Stuff that happens when you hover on + the stop()
	$('.hover', this).stop().animate({
		'opacity': 1
		}, 700,'easeOutSine')
	
	},function() {	
	// Stuff that happens when you unhover + the stop()
	$('.hover', this).stop().animate({
		'opacity': 0
		}, 1200, 'easeOutQuad')
	})
});
	
	

// Fade In-Out Sprite Image
// From Soh Tanaka (http://www.sohtanaka.com/web-design/greyscale-hover-effect-w-css-jquery/)
$(document).ready(function(){
	$("ul.feidfx li").hover(function() { //On hover...
		var thumbOver = $(this).find("img").attr("src"); //Get image url and assign it to 'thumbOver'
		//Set a background image(thumbOver) on the <a> tag - Set position to bottom
		$(this).find("a.fadeinfadeout").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});
		//Animate the image to 0 opacity (fade it out)
		$(this).find("span").stop().fadeTo('slow', 0 , function() {
			$(this).hide() //Hide the image after fade
		});
	} , function() { //on hover out...
		//Fade the image to full opacity 
		$(this).find("span").stop().fadeTo('slow', 1).show();
	});
});












// Automatic Image Slider w/ CSS & jQuery by Tanaka
$(document).ready(function() {
//Show the paging and activate its first link
$(".paging").show();
$(".paging a:first").addClass("active");

//Get size of the image, how many images there are, then determin the size of the image reel.
var imageWidth = $(".window").width();
var imageSum = $(".image_reel img").size();
var imageReelWidth = imageWidth * imageSum;

//Adjust the image reel to its new size
$(".image_reel").css({'width' : imageReelWidth});

//Paging  and Slider Function
rotate = function(){
    var triggerID = $active.attr("rel") - 1; //Get number of times to slide
    var image_reelPosition = triggerID * imageWidth; //Determines the distance the image reel needs to slide

    $(".paging a").removeClass('active'); //Remove all active class
    $active.addClass('active'); //Add active class (the $active is declared in the rotateSwitch function)

    //Slider Animation
    $(".image_reel").animate({
        left: -image_reelPosition
    }, 500 );

}; 

//Rotation  and Timing Event
rotateSwitch = function(){
    play = setInterval(function(){ //Set timer - this will repeat itself every 7 seconds
        $active = $('.paging a.active').next(); //Move to the next paging
        if ( $active.length === 0) { //If paging reaches the end...
            $active = $('.paging a:first'); //go back to first
        }
        rotate(); //Trigger the paging and slider function
    }, 7000); //Timer speed in milliseconds (7 seconds)
};

rotateSwitch(); //Run function on launch

//On Hover
$(".image_reel a").hover(function() {
    clearInterval(play); //Stop the rotation
}, function() {
    rotateSwitch(); //Resume rotation timer
});	

//On Click
$(".paging a").click(function() {
    $active = $(this); //Activate the clicked paging
    //Reset Timer
    clearInterval(play); //Stop the rotation
    rotate(); //Trigger rotation immediately
    rotateSwitch(); // Resume rotation timer
    return false; //Prevent browser jump to link anchor
});

});





// Sliding Boxes
$(document).ready(function(){
	$(".cover", this).stop().animate({top:'150px'},{queue:false,duration:160});
	//Caption Sliding (Partially Hidden to Visible)
	$('.boxgrid.caption').hover(function(){
	$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:160});
	}, function() {
	$(".cover", this).stop().animate({top:'150px'},{queue:false,duration:160});
	});
});
$(document).ready(function(){
	$(".cover2", this).stop().animate({top:'310px'},{queue:false,duration:160});
	//Caption Sliding (Partially Hidden to Visible)
	$('.boxgrid2.caption').hover(function(){
	$(".cover2", this).stop().animate({top:'40px'},{queue:false,duration:160});
	}, function() {
	$(".cover2", this).stop().animate({top:'310px'},{queue:false,duration:160});
	});
});





// jQuery SmoothScroll | Version 09-11-02  - Source: http://blog.medianotions.de/en/articles/2009/smoothscroll-for-jquery
$(document).ready(function(){
$('a[href*=#]').click(function() {

   // duration in ms
   var duration=1000;

   // easing values: swing | linear
   var easing='swing';

   // get / set parameters
   var newHash=this.hash;
   var target=$(this.hash).offset().top;
   var oldLocation=window.location.href.replace(window.location.hash, '');
   var newLocation=this;

   // make sure it's the same location      
   if(oldLocation+newHash==newLocation)
   {
      // animate to target and set the hash to the window.location after the animation
      $('html:not(:animated),body:not(:animated)').animate({ scrollTop: target }, duration, easing, function() {

         // add new hash to the browser location
         window.location.href=newLocation;
      });

      // cancel default click action
      return false;
   }

});
});






$(document).ready(function(){
$('#sbmtbttn').hide();


$('#partes').hide();
    $('a#slick-partes').click(function() {
    $('#partes').slideToggle(400);
	$('#sbmtbttn').slideToggle(400);
	$('#maquinaria').hide();
	$('#leyenda').hide();
    return false;
    });
		$("#partes a").click(function(event) {
		event.preventDefault();
		$("#partes").slideUp();
		$('#sbmtbttn').slideUp();
		return false;
		});	
		
$('#maquinaria').hide();
    $('a#slick-maquinaria').click(function() {
    $('#maquinaria').slideToggle(400);
	$('#sbmtbttn').slideToggle(400);	
	$('#partes').hide();
	$('#leyenda').hide();
    return false;
    });
		$("#maquinaria a").click(function(event) {
		event.preventDefault();
		$("#maquinaria").slideUp();
		$('#sbmtbttn').slideUp();
		return false;
		});	


  });
  
  
  
//EOF
