
  function addMega(){
    $("div.link_content").slideDown("fast");
    $("#content").animate({
      marginTop: "1em"
    }, 250); 
  }

  function removeMega(){
  } 


  function addMega2(){
  }

  function removeMega2(){
    $('div.link_content').slideUp("fast");
    $("#content").animate({
      marginTop: "0px"
    }, 100); 
  } 


$(document).ready(function() {

  jQuery('#top-menu').before('<div id="blog-link"><a href="/_blog/JTAShop_Blog/">Visit our blog</a></div>');

  $("#nav_486837").addClass('spritesnav');

  $('.spritesnav').sprites({
    hide: { opacity: 'hide' }
  });

  var megaConfig = {
    interval: 50,
    sensitivity: 4,
    over: addMega,
    timeout: 1000,
    out: removeMega
  };
  
  $('.mega').hoverIntent(megaConfig);

  
  var megaConfig2 = {
    interval: 100,
    sensitivity: 1000,
    over: addMega2,
    timeout: 100,
    out: removeMega2
  };
  
  if(!$("#snproducts").hasClass('.active')) {
    $('.link_content').hoverIntent(megaConfig2);
  } else {
    $('.link_content').show();
  }
  

	$('.submitBtn').hover(
		function(){ $(this).addClass('submitBtnHover'); },
		function(){ $(this).removeClass('submitBtnHover'); }
	);	


	$('.smallBtn').hover(
		function(){ $(this).addClass('smallBtnHover'); },
		function(){ $(this).removeClass('smallBtnHover'); }
	);	

	$('#tabs li').hover(
		function(){ $(this).addClass('hover'); },
		function(){ $(this).removeClass('hover'); }
	);	

/* CAROUSEL */ 

  function mycarousel_initCallback(carousel)
  {
  
      // Disable autoscrolling if the user clicks the prev or next button.
      carousel.buttonNext.bind('click', function() {
          carousel.startAuto(0);
      });

      carousel.buttonPrev.bind('click', function() {
          carousel.startAuto(0);
      });

      // Pause autoscrolling if the user moves with the cursor over the clip.
      carousel.clip.hover(function() {
          carousel.stopAuto();
      }, function() {
          carousel.startAuto();
      });
      $('#carousel_loading').slideUp( function () {
        $('#carousel button').fadeIn();
      });
  };

    $('#carousel').jcarousel({
            size: 2,
            auto: 5,
            wrap: 'both',
            initCallback: mycarousel_initCallback
    });


// External links auto-styler

  $('p a').filter(function() {
    return this.hostname && this.hostname !== location.hostname;
  }).addClass('external');

  $('a.external').click(function(){
    window.open(this.href);
    return false;
  });

  $('#addthis').mouseover( function(){
    return addthis_open(this, '', '[URL]', '[TITLE]')
  });
  $('#addthis').mouseout(function(){ addthis_close(); });
  $('#addthis').click(function(){ return addthis_sendto(); });

  $("#pink-btn").hide();
  $("#pink-btn").css('display', 'none');
  
  $("#choose-color").change( function() {

    var index = $("#choose-color").val();
    if (index == 'Blue') {
      $("#blue-btn").show();
      $("#pink-btn").hide();
      $("img#product-2").fadeOut("fast", function () {
        $("img#product-1").fadeIn();   
      });
    } else {
      $("#blue-btn").hide();
      $("#pink-btn").show();
      $("img#product-1").fadeOut("fast", function () {
        $("img#product-2").fadeIn();
      });
    }


    
  });

  $("button.submitBtn").click( function () {
    $(this).parent().submit();
  });

  
});

window.onload = function(){ 
    jQuery('#atff').hide();
} 