/* ---------------------
title: Snugburys site specific Jquery
author: Simon Tweedale
created: 11/04/11
version: 1.0
--------------------- */


/* --------------------- fades an image swap on hover --------------------- */

$(document).ready(function(){

    //Set opacity on each span to 0%
    $(".rollover").css({'opacity':'0'});

	$('a.hoverfade').hover(
		function() {
			$(this).find('.rollover').stop().fadeTo(500, 1);
		},
		function() {
			$(this).find('.rollover').stop().fadeTo(500, 0);
		}
	)

});	


/* --------------------- controls settings on image slideshows --------------------- */
/* requires jquery.cycle.js */

$(document).ready(function() {
    $('.slideshow').cycle({
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});
});



/* --------------------- controls settings on custom scrolling divs --------------------- */
/* requires jquery.jscrollpane.js */

$(document).ready(function()
			{
				$('.scroll-pane').jScrollPane(
					{
						showArrows: true,
						arrowScrollOnHover: true
					}
				);
			});
			
	
/* --------------------- applies classes so that it works on legacy browsers --------------------- */
			
$(document).ready(function(){
  		$('#news-block ul li:nth-child(odd)').addClass('alternate');
  		$('ul.highlights li:nth-child(odd)').addClass('alternate');
  		$('ul.gallery li:nth-child(odd)').addClass('odd');
  		$('ul.gallery li:nth-child(even)').addClass('even');
		});

/* --------------------- loads in news teasers block on each page --------------------- */	

$(document).ready(function() {
			$('#news-block').load('/content/newsblock');
		});

/* --------------------- rotates images on hover on gallery page --------------------- */		
		
$(document).ready(function()
   {
   		$(".gallery li.odd").rotate({ 
   bind: 
     { 
        mouseover : function() { 
            $(this).rotate({animateTo:5})
        },
        mouseout : function() { 
            $(this).rotate({animateTo:-5})
        }
     } 
   
});
   }); 
   
$(document).ready(function()
   {
   		$(".gallery li.even").rotate({ 
   bind: 
     { 
        mouseover : function() { 
            $(this).rotate({animateTo:-5})
        },
        mouseout : function() { 
            $(this).rotate({animateTo:5})
        }
     } 
   
});
   }); 
