// Show confirmation box before deleting item
function confirm_delete(thing,message) {
	var message = (message == null) ? "" : message;
	the_message = "Are you sure you want to delete this " + thing + "?";
	if (message!="") {
		the_message += "\n\n" + message;
	}
	var answer = confirm(the_message);
	if (answer) {
		return true;
	} else {
		return false;
	}
}

// Hide status message after few seconds
function status_message() {
	$("#status-message").animate({opacity: 1.0}, 3000);
	$("#status-message").fadeOut('slow', function() { 
		$(this).css({'display' : 'none'});
	});
}

$(document).ready(function() { 
	$("#orders-table").dataTable({
		"aaSorting": [[ 1, "desc" ]],
		"bSort": true,
		"sPaginationType": "full_numbers"
	});
	
	$("#giftcards-table").dataTable({
		"bSort": true,
		"sPaginationType": "full_numbers"
	});
	
	$("#galleries").dataTable( {
		"bSort": true,
		"sPaginationType": "full_numbers"
	});
	
	var path = location.href
	path = path.split('/');
	path = path[(path.length-1)];
	
	if (path == 'home')
		 RotateBg();
});

function RotateBg() {
if (typeof count == 'undefined') {
	count = 0;
}

if (count == 0) {
	$('#hidden3').fadeOut("slow")
	$('#hidden0').fadeIn("slow");
	count++;
} else if (count == 3) {
	$('#hidden2').fadeOut("slow");
	$('#hidden3').fadeIn("slow");
	count = 0;
} else {
	$('#hidden'+(count-1)).fadeOut("slow");
	$('#hidden'+(count)).fadeIn("slow");
	count++;
}

movement = setTimeout("RotateBg()",2500);
}
