$(document).ready(function() {
	$('#networks').hide();
	$('#newjamzbox').hide();
	$('#pastJamz').hide();
	
	$('a#networks-show').click(function() {
		$('#networks').slideDown(800);
		return false;
	});
	
	$('a#networks-hide').click(function() {
		$('#networks').slideUp(800);
		return false;
	});
	
		
	$("a#number1").click(function(event){
		event.preventDefault();
		$("div#number1box").show("slow");
		$("div#newjamzbox").hide("slow");
	});	

	$("a#newjamz").click(function(event){
		event.preventDefault();
		$("div#newjamzbox").show("slow");
		$("div#number1box").hide("slow");
	});
	
	$("a#currentJamzTab").click(function(event){
		event.preventDefault();
		$("div#currentJamz").show("slow");
		$("div#pastJamz").hide("slow");
	});	

	$("a#pastJamzTab").click(function(event){
		event.preventDefault();
		$("div#pastJamz").show("slow");
		$("div#currentJamz").hide("slow");
	});
	
	 jQuery('#mycarousel').jcarousel({
        auto: 3,
        wrap: 'last',
		scroll: 1,
        initCallback: mycarousel_initCallback
    });

	getNP();
	getLast10();
});

function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    /*carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });*/

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

function getNP() {	
$("#nowplaying").load("/includes/php/nowplaying.php?random=" + new Date().getTime(), '', callback);
}

function getLast10() {
$("#newjamzpage").load("/includes/php/last-10-played.php?random=" + new Date().getTime(), '', callbackLast10);
}

function callback() {
setTimeout("getNP();", 10000);
}

function callbackLast10() {
setTimeout("getLast10();", 10000);
}

function confirmDelete(delMsg, delUrl) {
	if (confirm(delMsg)) {
		document.location = delUrl;
	}
}