$(document).ready(function() {
		$('#slider').nivoSlider({
			effect:						'boxRain,boxRainReverse,boxRainGrow,boxRainGrowReverse', //Specify sets like: 'fold,fade,sliceDown'
			animSpeed:				1000, //Slide transition speed
			pauseTime:				5000,
			startSlide:				0, //Set starting Slide (0 index)
			directionNav:			false, //Next & Prev
			controlNav:				true, //1,2,3...
			pauseOnHover:			true, //Stop animation while hovering
			manualAdvance:		false, //Force manual transitions
			keyboardNav:			false //Use left & right arrows
		});
})

function updateLivePreview(inst) {
	$("#live-preview").html(inst.getBody().innerHTML);
}

function rebuildGallery() {
	$.ajax({
		url: "rebuildGallery.php",
		success: function(){
			alert("Gallery rebuilt.");
		}
	});
}

function deleteImage(id) {
	if (confirm("Are you sure you want to delete this image?")) {
		$.ajax({
			url: "deleteImage.php?id=" + id,
			success: function(data){
				if (data) {
					$("span#" + id).hide(500);
				} else {
					alert("Error: Could not delete image.  Plase try again.");
				}
			}
		});
	}
}
