
$(document).ready(function(){
    //Controls the Carousel plugin 
    $(function(){
        $("div#carousel_inner").carousel({
            loop: true,
            effect: "fade",
            autoSlide: true,
            autoSlideInterval: 6000
        });
    });
    
    //Check if the link matches the URL and add a class if true
    $("div#nav li a").each(function(index){
        var hyperlink = $(this).attr("href");
        var browserURL = window.location.pathname;
        if (hyperlink == browserURL){
            $(this).addClass("selected");
        }
    });
    
	//Check if the link matches the URL and add a class if true for the Potters World nav
    $("div#nav_pottersworld li a").each(function(index){
        var hyperlink = $(this).attr("href");
        var browserURL = window.location.pathname;
        if (hyperlink == browserURL){
            $(this).addClass("selected");
        }
    });
	
	//Check if the link matches the URL and add a class if true for the baby nav
    $("div#nav_baby li a").each(function(index){
        var hyperlink = $(this).attr("href");
        var browserURL = window.location.pathname;
        if (hyperlink == browserURL) {
            $(this).addClass("selected");
        }
    });
    
    //Clear from fields when in focus
    $('.clearme').focus(function(){
        $(this).val("");
    });
	
	/*$(function(){
        $(".accordion").accordion({
			autoHeight: false,
			navigation: true,
			active: false,
			collapsible: true
		});
	});*/
});
