$(function(){
  $("#slides").slides({
    preload: false,
    preloadImage: '/gridpro-web/images/loading.gif',
    play: 5000,
    pause: 2500,
    hoverPause: true,
    generatePagination: false,
    animationStart: function(current){
      $(".menu").animate({
        opacity: 0
      },100);
      if (window.console && console.log) {
        // example return of current slide number
        console.log('animationStart on slide: ', current);
      };
    },
    animationComplete: function(current){
      $(".menu").animate({
        opacity: 0.6
      },500);
      if (window.console && console.log) {
        // example return of current slide number
        console.log('animationComplete on slide: ', current);
      };
    },
    slidesLoaded: function() {
      $(".menu").animate({
        opacity: 0.6
      },500);
    }
  });


  $("#slides-2").slides({
    preload: false,
    preloadImage: 'img/loading.gif',
    generatePagination: true
  });


  jQuery(".subFeatureContent").mouseenter(function(){
    var sfID = jQuery(this).attr('ID').split("_");
    switch(sfID[1]) {
      case "1":
        if (jQuery(this).css("top") != subFeaturePosition[1]) {
          jQuery("#"+sfID[0]+"_1").stop().animate({
            top: subFeaturePosition[1]
          }, subFeatureMovement);
          jQuery("#"+sfID[0]+"_2").stop().animate({
            top: subFeaturePosition[2]
          }, subFeatureMovement);
        }
        break;

      case "2":
        if (jQuery("#"+sfID[0]+"_1").css("top") != subFeaturePosition[1] && jQuery("#"+sfID[0]+"_2").css("top") == subFeaturePosition[2]) {
          break;
        }
        jQuery("#"+sfID[0]+"_1").stop().animate({
          top: "-110px"
        }, subFeatureMovement);
        jQuery("#"+sfID[0]+"_2").stop().animate({
          top: subFeaturePosition[2]
        }, subFeatureMovement);
        break;

      case "3":
        if (jQuery("#"+sfID[0]+"_1").css("top") == subFeaturePosition[1] || jQuery("#"+sfID[0]+"_2").css("top") == subFeaturePosition[2]) {
          jQuery("#"+sfID[0]+"_1").stop().animate({
            top: "-110px"
          }, subFeatureMovement);
          jQuery("#"+sfID[0]+"_2").stop().animate({
            top: "-220px"
          }, subFeatureMovement);
        }
        break;
    }
  });
  
});

