// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function destroy(id) {
	if(!confirm("Weet je zeker dat je dit album wilt verwijderen?")) return;
		new Ajax.Request('/admin/delete_yes?id='+id);
		new Ajax.Request('/admin/beheer');
}

function destroy_event(id) {
	if(!confirm("Weet je zeker dat je dit event wilt verwijderen?")) return;
		new Ajax.Request('/admin/event_delete?id='+id);
		parentObj = document.getElementById("event_" + id).parentNode;
    	childObj = document.getElementById("event_" + id); 
    	parentObj.removeChild(childObj);
}

function delete_pic(id) {
	if(!confirm("Weet je zeker dat je deze afbeelding wilt verwijderen?")) return;
		parentObj = document.getElementById("pic_" + id).parentNode;
    	childObj = document.getElementById("pic_" + id); 
    	parentObj.removeChild(childObj);
		new Ajax.Request('/admin/delete_pic/'+ id);
}

function active_pic(id)
{
	pic = document.getElementById("v_" + id);
	pic.src = "/images/v2.jpg";
	pic = document.getElementById("x_" + id);
	pic.src = "/images/x.jpg";
	new Ajax.Request('/admin/active_pic/'+ id);
	
}

function hotshot_pic(id)
{

	new Ajax.Request('/admin/hotshot/'+ id);
	
}
function deactive_pic(id)
{
	pic = document.getElementById("x_" + id);
	pic.src = "/images/x2.jpg";
	pic = document.getElementById("v_" + id);
	pic.src = "/images/v.jpg";
	new Ajax.Request('/admin/deactive_pic/'+ id);
	
}

function show_event(id){
	
if ($('open'))
{
	$('open').style.display = "none";
	id2 = $('open').name;
	$('open').id = "event_" + id2;
	$('item_' + id2).style.display = "";
}

	document.getElementById('item_' + id).style.display = "none";
	row = document.getElementById('event_' + id);
	row.style.display = "";
	row.id = "open";
	row.name = id;
	
}

function closeEvent(){
	
$('open').style.display = "none";
id = $('open').name;
$('open').id = "event_" + id;
$('item_' + id).style.display = "";
	
}
	function check1(){
		if ($('album') && $('status').innerHTML=='') {
			naam = $('album').value;
			setTimeout('new Ajax.Request("/admin/upload_state/" + naam)', 1500);
			setTimeout('check2()',1500);
		}
		}	
		function check2(){
			if ($('album' && $('status').innerHTML=='')) {
				naam = $('album').value;
				setTimeout('new Ajax.Request("/admin/upload_state/" + naam)', 1500);
				setTimeout('check1()',1500);
			}
			}

function complete() {
	
}