$(document).ready(function(){// run after page loads

// The following script makes the nav tab for the current page remain in active state
var filename = location.pathname.substr(location.pathname.lastIndexOf("/")+1,location.pathname.length);
	$('#nav a').each(function(){
		if (filename == $(this).attr('href')){
			$(this).attr('id','current');
                        $(this).css('color','#fff');
		}
	});
        
          $('ul.maintransition').innerfade({
            speed: 1000,
            timeout: 5000,
            type: 'sequence',
            containerheight: '274px'
    });
    $('ul.subtransition').innerfade({
            speed: 1000,
            timeout: 5000,
            type: 'sequence',
            containerheight: '170px'
    });
        
        //  The following is the script for the accordian divs
        $('#switchnav div').hide();
        $('#switchnav h2').append('<span class="clicker">click here</span>');
        $('#switchnav h2').click(function(){
            if($(this).next('div').is(":hidden")){
		$('#switchnav div:visible').hide();
		$(this).next('div').slideDown(); 
		} else {
		$(this).next('div').slideUp(); };
           
  });
  
	$(function() {
		$( "#datepicker" ).datepicker({
                    dateFormat:"dd/mm/yy"
                });
	});
	
	
	$('.featured_product div').hide();
	$('.featured_product h2').click(function(){
	    $(this).next('div').slideToggle();
	});
});
