JS_SONGS = {
	vote: function (song_id) {
		if (song_id == 0) {
			if (document.getElementById("title").value == "") {
				alert("You must fill in the song title.");
				document.getElementById("title").focus();
				return false;
			}
		}
		document.getElementById("song_id").value = song_id;
		document.getElementById("ACTION").value = "VOTE";		
		document.getElementById("vote_form").submit();
	},
	
	add: function () {
		document.getElementById("ACTION").value = "ADD";		
		document.getElementById("admin_form").submit();		
	},
	
	edit: function (song_id) {
		document.getElementById("song_id").value = song_id;
		document.getElementById("ACTION").value = "EDIT";		
		document.getElementById("admin_form").submit();
	},
	
	save: function () {
		document.getElementById("ACTION").value = "SAVE";
		document.getElementById("admin_form").action = "update_song.php";		
		document.getElementById("admin_form").submit();
	},
	
	update: function () {
		document.getElementById("ACTION").value = "UPDATE";
		document.getElementById("admin_form").action = "update_song.php";		
		document.getElementById("admin_form").submit();
	},
	
	remove: function () {
		document.getElementById("ACTION").value = "DELETE";
		document.getElementById("admin_form").action = "update_song.php";		
		document.getElementById("admin_form").submit();
	},
	
	cancel: function() {
		document.location = "panel.php";
	},
	
	download: function() {
		document.getElementById("admin_form").action = "download.php";		
		document.getElementById("admin_form").submit();		
		document.getElementById("admin_form").action = "";
	},
	
	vote_reset: function() {
		document.getElementById("ACTION").value = "RESET";
		document.getElementById("admin_form").action = "update_song.php";		
		document.getElementById("admin_form").submit();		
	}
}
