function slideSwitch() {
    var $active = $('#slideshow div.active');

    if ( $active.length == 0 ) $active = $('#slideshow div:last');

    // use this to pull the divs in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow DIV:first');

    // uncomment below to pull the divs randomly
    // 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}, 3000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
	$('#logo').click(function(){
  window.location = '/default.aspx';
});


	if($("h1").text() == "Restaurant-Menu"){
		//$("h1").addClass('fixed');
		//$("h1").prepend('<a class="printIcon" href="/App_Themes/bindiatheme/pdf/bindiaCatering.pdf"></a>')
		for(n=1; n<5; n++){
			$("#slideshow").append('<div><img src="/App_Themes/bindiatheme/images/restaurant/item'+n+'.jpg" alt="" /></div>');
		}
		$(".addToCart").each(function(){
			$(this).remove();
		});
	}
	if($("h1").text() == "Catering-Evening"){
		$("h1").prepend('<a class="printIcon" href="/App_Themes/bindiatheme/pdf/bindiaCatering.pdf"></a>')
		for(n=1; n<7; n++){
			$("#slideshow").append('<div><img src="/App_Themes/bindiatheme/images/ca_evening/item'+n+'.jpg" alt="" /></div>');
		}
	}
	if($("h1").text() == "Catering-Lunch"){
		$("h1").prepend('<a class="printIcon" href="/App_Themes/bindiatheme/pdf/bindiaCatering.pdf"></a>')
		for(n=1; n<7; n++){
			$("#slideshow").append('<div><img src="/App_Themes/bindiatheme/images/ca_lunch/item'+n+'.jpg" alt="" /></div>');
		}
	}
	if($("h1").text() == "Takeaway-Lunch"){
		$("h1").prepend('<a class="printIcon" href="/App_Themes/bindiatheme/pdf/bindiaLunch.pdf"></a>')
		for(n=1; n<7; n++){
			$("#slideshow").append('<div><img src="/App_Themes/bindiatheme/images/ta_lunch/item'+n+'.jpg" alt="" /></div>');
		}
	}
	if($("h1").text() == "Takeaway-Evening"){
		$("h1").prepend('<a class="printIcon" href="/App_Themes/bindiatheme/pdf/bindiaTakeaway.pdf"></a>')
		for(n=1; n<7; n++){
			$("#slideshow").append('<div><img src="/App_Themes/bindiatheme/images/ta_evening/item'+n+'.jpg" alt="" /></div>');
		}
	}
	if($("h1").text() == "Table Reservation"){
			$("#slideshow").removeClass("meetTheChef");
		for(n=1; n<9; n++){
			$("#slideshow").append('<div><img src="/App_Themes/bindiatheme/images/table/item'+n+'.jpg" alt="" /></div>');
		}
	}
	if($("h1").text() == "Locations"){
			$("#slideshow").removeClass("meetTheChef");
			$("#slideshow").addClass("locationspage");
	}
	if($("h1").text() == "Contact Us"){
			$("#slideshow").removeClass("meetTheChef");
			$("#slideshow").addClass("contactus");
	}

	if($("h1:first").text() == "Jobs - Kitchen Helper"){
			$("#slideshow").removeClass("meetTheChef");
			$("#slideshow").addClass("kitchenhelper");
	}

	if($("h1:first").text() == "Jobs - Bar Staff"){
			$("#slideshow").removeClass("meetTheChef");
			$("#slideshow").addClass("contactus");
	}

	if($("h1:first").text() == "UNDERSTANDING INDIAN COOKING"){
			$("#slideshow").removeClass("meetTheChef");
		for(n=1; n<18; n++){
			$("#slideshow").prepend('<div><img src="/App_Themes/bindiatheme/images/spices/item'+n+'.jpg" alt="" /></div>');
		}

	}
	if($("h1:first").text() == "And so it began"){
			$("#slideshow").removeClass("meetTheChef");
		for(n=1; n<18; n++){
			$("#slideshow").prepend('<div><img src="/App_Themes/bindiatheme/images/spices/item'+n+'.jpg" alt="" /></div>');
		}

	}
	
	$("span.addToCart > input.button").click(function(){
		console.log("clicked");
	});

	$("#slideshow div:first-child").addClass("active");

    setInterval( "slideSwitch()", 7000 );
});
