var statusmsg=""

function hidestatus(){
	window.status=statusmsg
	return true
}

function item_bewerken(module,actie,id){
	if (module=="projecten"){
		var url="/includes/project_wijzig.php";
	}else{
		if (module=="publicaties"){
			var url="/includes/publicatie_wijzig.php";
		}else{
			var url="/includes/nieuws_wijzig.php";
		}
	}
	if(actie < 3){
		newwindow=window.open(url+"?id="+id+'&module='+module+'&actie='+actie, 'wijzig', 'left=14,top=4,width=1023,height=520,menubar=0,resizable=0,toolbar=0,status=0,location=0');
		if (window.focus) {newwindow.focus()}
		return false;
	}else{
		if(actie==3){
			agree=confirm('Weet u zeker dat u de huidige item wilt verwijderen?');
			if(agree){
				$.ajax({
					url: url,
					type: 'get',
					data: { module: module, id: id, actie :"verwijderen", zomaar : Math.random()},
					success: function(message) {
						window.location=window.location;
					}
				});
			}
		}
	}
}

function uitloggen(){
	$.ajax({
		url: '/includes/set_login.php',
		type: 'get',
		data: { uitloggen :"1", zomaar : Math.random()},
		success: function() {
			window.location=window.location;
		}
	});
}

function verwijder_image(type,bestandsnaam){
    var tekst="Weet u zeker dat u deze foto wilt verwijderen?";
    var agree=confirm(tekst);
    if (agree){
		$.ajax({
			url: '/includes/verwijder_image.php',
			type: 'get',
			data: { type: type , bestand: bestandsnaam,zomaar : Math.random()},
			success: function(message) {
				if(message=="OK"){
					alert('Het bestand is verwijderd.');
				}else{
					alert('Het bestand wordt nog gebruikt en kan niet verwijderd worden.');
				}
				window.location=window.location;
			}
		});
	}
}
function verwijder_document(type,bestandsnaam){
    var tekst="Weet u zeker dat u dit document wilt verwijderen?";
    var agree=confirm(tekst);
    if (agree){
		$.ajax({
			url: '/includes/verwijder_document.php',
			type: 'get',
			data: { type: type , bestand: bestandsnaam,zomaar : Math.random()},
			success: function(message) {
				if(message=="OK"){
					alert('Het bestand is verwijderd.');
				}else{
					alert('Het bestand wordt nog gebruikt en kan niet verwijderd worden.');
				}
				window.location=window.location;
			}
		});
	}
}

function selecteer_foto(veldnaam,type){
	fotowindow=window.open("/includes/images.php?type="+type+"&veldnaam="+veldnaam, 'foto_selectie', 'left=14,top=4,width=620,height=335,menubar=0,resizable=1,toolbar=0,status=0,location=0');
	if (window.focus) {fotowindow.focus()}
	return false;
}

function selecteer_document(veldnaam,type){
	docwindow=window.open("/includes/document.php?type="+type+"&veldnaam="+veldnaam, 'foto_selectie', 'left=14,top=4,width=620,height=335,menubar=0,resizable=1,toolbar=0,status=0,location=0');
	if (window.focus) {docwindow.focus()}
	return false;
}

function wijzig_categorie(id){
		$.ajax({
			url: '/includes/wijzig_categorie.php',
			type: 'get',
			data: { categorie: id.value,zomaar : Math.random()},
			success: function(message) {
				window.location=window.location;
			}
		});
}
