var g_nAutoTimerSpeed = 4;		// number of seconds
var g_bUseAuto = false;
var g_nAutoTimer;

$(document).ready(function () {
	$(document).pngFix();
});

function onBodyLoad() {
	$("#ajaxLoader").fadeOut();
	$(".slideshowText, .prevnextbutton").css({opacity:.85});
	$("#slideshow_holder").jCarouselLite({
		btnNext: ".next",
		btnPrev: ".prev",
		auto:6000,
		speed:800,
		visible:1
	});
};



/*

function initCallbackCarousel(p_carousel) {
	g_carousel = p_carousel;

	$('#prevBtn, #nextBtn, #pauseBtn, #playBtn').mouseover(function(){
		$(this).fadeTo("fast", 0.8);
	}).mouseout(function(){
		$(this).fadeTo("fast", 1);
	});

	$(window).keydown(function(e){
		if (e.keyCode == '39') {
			nextClicked();
		} else if (e.keyCode == '37') {
			prevClicked();
		}
	});

	$('#prevBtn').bind('click', function() {
		prevClicked();
        return false;
    });

	$('#nextBtn').bind('click', function() {
		nextClicked();
        return false;
    });

	$('#playBtn').bind('click', function() {
		g_bUseAuto = true;
		doNextButton();
		g_nAutoTimer = setInterval(doNextButton, g_nAutoTimerSpeed * 1000);
		$(this).hide();
		$('#pauseBtn').show();
		return false;
    });

	$('#pauseBtn').bind('click', function() {
		g_bUseAuto = false;
		clearInterval(g_nAutoTimer);
		$(this).hide();
		$('#playBtn').show();
		return false;
    });
	
};

function prevClicked() {
	if(g_bUseAuto) {
		clearInterval(g_nAutoTimer);
		g_nAutoTimer = setInterval(doNextButton, g_nAutoTimerSpeed * 1000);
		doPrevButton();
	} else {
		doPrevButton();
	}	
}

function nextClicked() {
	if(g_bUseAuto) {
		clearInterval(g_nAutoTimer);
		g_nAutoTimer = setInterval(doNextButton, g_nAutoTimerSpeed * 1000);
		doNextButton();
	} else {
		doNextButton();
	}
}

function doNextButton() {
	g_carousel.next();
};


function doPrevButton() {
	g_carousel.prev();
};


function onBodyLoad() {
	jQuery('#slideShowDIV').jcarousel({
        wrap: 'last',
		scroll: 1,
		buttonNextHTML: null,
		buttonPrevHTML: null,
		initCallback: initCallbackCarousel
	});
	$("#ajaxLoader").fadeOut();
	setTimeout(beginAutoplay, 1000);
};

function beginAutoplay() {
	g_bUseAuto = true;
	g_nAutoTimer = setInterval(doNextButton, g_nAutoTimerSpeed * 1000);
}

*/
