$(document).ready(function(){
  
     $("table tr:even").addClass("alt");
     $("table tr").hover(
       function()
       {
         $(this).removeClass("alt");
         $(this).addClass("highlight");
       },function()
       {
         $(this).removeClass("highlight");
         $("tr:even").addClass("alt");
       });
               
    //$('.row').stop().animate({height: '130px'}, 300);  
    
    $('.row').height(215);     
    $('.item','.row').css( { backgroundColor: 'transparent' });   
    $('.row').hover(
        function() {
      $(this).stop().animate({backgroundColor:'#f1f1f1',height: $('.container960',this).height()+'px'}, 300);
      $('.item',this).height($('.container960',this).height()+'px');
      $('.item',this).css({backgroundColor:'transparent'});  
      // $('.item',this).stop().animate({backgroundColor:'#f1f1f1'}, 500);  
         }, function () {
      $(this).stop().animate({backgroundColor:'#ffffff',height: '215px'}, 300);
      $('.item',this).stop().animate({backgroundColor:'#ffffff'}, 500);  
      $('.item',this).css("height", "auto");
      //$('.item',this).css( { backgroundColor: 'transparent' });  
    
        });    
    
       $('.item').hover(
        function() {
             $(this).stop().animate({backgroundColor:'#f1eee5'}, 500);
             //$(this).stop().animate({backgroundColor:$(this).attr('id')}, 500);
         }, function () {
             $(this).stop().animate({backgroundColor:'#f1f1f1'}, 500);        
        });  
  
               
    //Hide (Collapse) the toggle containers on load
    $(".toggle_container").hide(); 
    
    //Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
    $(".trigger").click(function(){
      $(this).toggleClass("active").next().slideToggle("slow");
      event.preventDefault();
      $('html, body').animate({ scrollTop: $("#sitemap").offset().top }, 500);
      return false; //Prevent the browser jump to the link anchor
    });
                 
  //Accordion Product Page
    $('.product').hover(function() {
              
    $(this).animate({
        height: '280px',
    backgroundColor: '#1e1852'
    }, 'slow');
  
  
  
},function() {
    $(this).animate({
        height: '200px',
    backgroundColor: '#CCC'
    }, 'slow');
});

$('.product a').hover(function() {              
    $(this).animate({
    color: '#fff'
    }, 'slow');    
},function() {
    $(this).animate({ 
    color: '#999'
    }, 'slow');
});
    

  //$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)

  $("ul.topnav .menu-item a").hover(function() { //When trigger is clicked...

    //Following events are applied to the subnav itself (moving subnav up and down)
    $(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click

    $(this).parent().hover(function() {
    }, function(){
      $(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
    });

    //Following events are applied to the trigger (Hover events for the trigger)
    }).hover(function() {
      $(this).addClass("subhover"); //On hover over, add class "subhover"
    }, function(){  //On Hover Out
      $(this).removeClass("subhover"); //On hover out, remove class "subhover"
  });
  
  
   $('#slider').nivoSlider({
        effect: 'fade', // Specify sets like: 'fold,fade,sliceDown'
        slices: 15, // For slice animations
        boxCols: 8, // For box animations
        boxRows: 4, // For box animations
        animSpeed: 700, // Slide transition speed
        pauseTime: 10000, // How long each slide will show
        startSlide: 0, // Set starting Slide (0 index)
        directionNav: true, // Next & Prev navigation
        directionNavHide: true, // Only show on hover
        controlNav: false, // 1,2,3... navigation
        controlNavThumbs: false, // Use thumbnails for Control Nav
        controlNavThumbsFromRel: false, // Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', // Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
        keyboardNav: true, // Use left & right arrows
        pauseOnHover: false, // Stop animation while hovering
        manualAdvance: false, // Force manual transitions
        captionOpacity: 0.8, // Universal caption opacity
        prevText: 'Prev', // Prev directionNav text
        nextText: 'Next', // Next directionNav text
        beforeChange: function(element){
  
    }, // Triggers before a slide transition
        afterChange: function(){
  
      elrel = $('#slider').data('nivo:vars').currentImage.attr('rel');    
    
      $('#mid').animate({backgroundColor:elrel},700);
    
      
    }, // Triggers after a slide transition
        slideshowEnd: function(){}, // Triggers after all slides have been shown
        lastSlide: function(){}, // Triggers when last slide is shown
        afterLoad: function(){
    
    } // Triggers when slider has loaded
    });
   
      var inrel = $('#slider').data('nivo:vars').currentImage.attr('rel');
     $('#mid').animate({backgroundColor:inrel}, 700);   
     
     $('.bar').mosaic({
          animation  :  'slide',
          speed : 400,
          opacity : 0.5,
     });
     
     
  
    
    //news slider
    $('#newsSlider').bxSlider({
      auto: true, speed:800, prevText:"",nextText:"", autoHover:true, pause:5000
     });
    
    //photo
    $("a[rel^='prettyPhoto']").prettyPhoto({
      animation_speed: 'slow',
      autoplay: false,
      deeplinking: false,
      theme: 'light_square',
      social_tools: ''
    });

});

