function setActive(id, controller, field) {
	advAJAX.get({
		unique: false,
		url: "/admin/"+controller+"/setActive/"+id,
		onSuccess : function(obj) { 
			var ikonka 	= document.getElementById('ikona-rekord-id-'+id);
			var record	= document.getElementById('pole-rekord-id-'+id);
			if(obj.responseText == 1) {
				//alert('Włączyłeś kategorie.');
				ikonka.src = "/images/admin/16-em-check.png";
			} else {
				//alert('Wyłączyłeś kategorie');
				ikonka.src = "/images/admin/16-em-cross.png";
			}
			Effect.Highlight(record, {startcolor:'#f76600', endcolor:'#ffffff', duration: 1.2});
		},
		onError : function(obj) { alert("Error: " + obj.status); }
	});
}

function setActive2(id, controller, field) {
	var url = "/admin/"+controller+"/setActive/"+id;
	new Ajax.Request(url, {
		method: get,
		onSuccess : function(transporter) { 
			if(obj.responseText == 1) {
				//alert('Włączyłeś kategorie.');
				$('ikona-rekord-id-'+id).src = "/images/admin/16-em-check.png";
			} else {
				//alert('Wyłączyłeś kategorie');
				$('ikona-rekord-id-'+id).src = "/images/admin/16-em-cross.png";
			}
			Effect.Highlight($('pole-rekord-id-'+id), {startcolor:'#f76600', endcolor:'#ffffff', duration: 1.2});
		},
		onError : function(transporter) { alert("Error: " + transporter.status); }
	});
}

function setSequence(id, controller, direction, where) {
	advAJAX.get({
		unique: false,
		url: "/admin/"+controller+"/setSequence/"+id+"/"+direction+"/"+where,
		onSuccess : function(obj) { 
			//var ikonka 	= document.getElementById('ikona-rekord-id-'+id);
			var record	= document.getElementById('pole-rekord-id-'+id);
			if(obj.responseText == 1) {
				//alert('Włączyłeś kategorie.');
				ikonka.src = "/images/admin/16-em-cross.png";
			} else {
				//alert('Wyłączyłeś kategorie');
				ikonka.src = "/images/admin/16-em-check.png";
			}
			new Effect.Highlight(record, {startcolor:'#f76600', endcolor:'#ffffff', duration: 1.2});
		},
		onError : function(obj) { alert("Error: " + obj.status); }
	});
}
function sendActivationLink(id) {
	var answer = confirm('Jesteś pewien że chcesz wysłać link aktywujący do tej osoby?');
	if (answer){
		advAJAX.get({
			unique: false,
			url: "/admin/sklep/sendActivationLink/"+id,
			onSuccess : function(obj) { 
				var record	= document.getElementById('pole-rekord-id-'+id);
				if(obj.responseText != 0) {
					alert('Wysłano e-mail z linkiem na adres: '+obj.responseText);
				} else {
					alert('Bład. Sprawdź czy podano właściwy adres email. Ew. sprawdź czy twoje konto SMTP działa poprawnie.');
				}
				new Effect.Highlight(record, {startcolor:'#f76600', endcolor:'#ffffff', duration: 1.2});
			},
			onError : function(obj) { alert("Error: " + obj.status); }
		});
	}
}

function deletePicture(id) {
		advAJAX.get({
		url: "http://www.strona.manga.pl/admin/galleriesPictures/deletePicture/"+id,
		onSuccess : function(obj) { 
			var link = document.getElementById('image_'+id);
			if(obj.responseText == 'error') {
				alert('Error!');	
			}
			alert('Zdjęcie zostało odrzucone.');
			new Effect.DropOut('image_'+id);

		},
		onError : function(obj) { alert("Error: " + obj.status); }
	});	
}

function confirmSubmit(message) 
{
var agree=confirm(message);
if (agree)
	return true ;
else
	return false ;
}
