/*

Ray Wade Catering (custom) Javascript
===============================================

Author:			John Metcalfe - john@discoverydesign.co.uk
Copyright:		2010 Discovery Design Ltd.
Description: 	Various effects for Ray Wade Catering
Last Edit:		04/10/2010 by John Metcalfe

*/

/* SMOOTH SCROLL
=============================================== */
$(function() {
   $('a[href*=#]').click(function() {
      if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var $target = $(this.hash); $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']'); if ($target.length) { var targetOffset = $target.offset().top; $('html,body').animate({scrollTop: targetOffset}, 450); return false; } } }); });
	  
	  
/* HEADER FADE
=============================================== */
function slideSwitch(){var $active=$('#header_photogallery img.active');if($active.length==0)$active=$('#header_photogallery img:last');var $next=$active.next().length?$active.next():$('#header_photogallery img:first');var $sibs=$active.siblings();var rndNum=Math.floor(Math.random()*$sibs.length);var $next=$($sibs[rndNum]);$active.addClass('last-active');$next.css({opacity:0.0}).addClass('active').animate({opacity:1.0},1000,function(){$active.removeClass('active last-active')})}$(function(){setInterval("slideSwitch()",5000)});

/* PHOTOGALLERY
=============================================== */
$(document).ready(function(){$("#photogallery a,").fancybox({'titlePosition':'over'})});
