/*function seltag(id) {
	alert(id);
	new Ajax.Request('/?pagina=ajax&action=seltag',
		{
			method: 'post',
			parameters: id=id,
			onSuccess: function(data) {
				alert('qui ci entro');
				var ogg = data.responseText.evalJSON();
				if (!ogg.error) {
					
					return true;
				}
				else {
					alert(ogg.text);
				}
			}
		}
	);
	return false;
}*/

function seltag(id) {
	//alert(id);
		jQuery.ajax({
			type: "get",
			url: "/?",
			data: {
				pagina: "ajax",
				action: "seltag",
				id: id
			},
			success: function(msg) {
			},
			error: function() {
				//alert("Errore di connessione. Riprovare.");
			}
		});
	return true;
}

function controllacampo(){
	var donazione = jQuery('#donazione').val();
	if(donazione=='-1'){
		jQuery('#donazionealtro').removeAttr('disabled');
	}
	else{
		jQuery('#donazionealtro').attr('disabled', 'disabled');
		jQuery('#donazionealtro').val('');
	}
	return false;
}

function controlladonazione() {
	var don = jQuery('#donazionealtro').val();
	don = don.replace(',','.');
	if(isNaN(don)){
		alert('Valore inserito non corretto. Inserire il valore nella forma: xxxx.yy');
	}
	else{
		jQuery('#donazionealtro').val(don);
	}
	return false;
}

function seltag2(id) {
	//alert(id);
		jQuery.ajax({
			type: "get",
			url: "/?",
			dataType: "json",
			data: {
				pagina: "ajax",
				action: "seltag2",
				id: id
			},
			success: function(msg) {
			},
			error: function() {
				//alert("Errore di connessione. Riprovare.");
			}
		});
	return true;
}

function seltag3() {
	var id = jQuery('#hid1').val();
		jQuery.ajax({
			type: "get",
			url: "/?",
			dataType: "json",
			data: {
				pagina: "ajax",
				action: "seltag3"
			},
			success: function(msg) {
				jQuery('#'+id).removeAttr('class');
			},
			error: function() {
				jQuery('#'+id).removeAttr('class');
				//alert("Errore di connessione. Riprovare.");
			}
		});
	return true;
}

function loadingImage() {
	return "<br /><br /><br /><br /><br /><br /><center><img src='/css/loading.gif' border='0' /></center><br /><br /><br /><br /><br /><br /><br />";
}

function caricaCal(mydiv, mese, anno) {
	$('div.'+mydiv).html(loadingImage());
	jQuery.ajax({
			type: "get",
			url: "/?",
			dataType: "json",
			data: {
				pagina: "ajax",
				action: "agenda",
				mese: mese, 
				anno: anno
			},
			success: function(data) {
				$('div.'+mydiv).html(data.responseText);
			},
			error: function(data) {
				$('div.'+mydiv).html(data.responseText);
			}
		});
	return false;
}
