var bloccato = null;
var esterna = null;

function grande(nome){
	nome.height = (nome.height + 20);
	nome.width = (nome.width + 30);
	/*
	nome.style.marginBottom = (nome.style.marginBottom - 10) + 'px';
	nome.style.marginRight = (nome.style.marginRight - 10) + 'px';
	nome.style.marginLeft = (nome.style.marginLeft - 10) + 'px';
	*/
}

function piccola(nome){
	nome.height = (nome.height - 20);
	nome.width = (nome.width - 30);
	/*
	nome.style.marginBottom = (nome.style.marginBottom + 10) + 'px';
	nome.style.marginRight = (nome.style.marginRight + 10) + 'px';
	nome.style.marginLeft = (nome.style.marginLeft + 10) + 'px';
	*/
}

function dentro(nome){
	var oggetto = document.getElementById(nome);
	if (bloccato!=nome) oggetto.src = "./jpg/" + nome + "up.jpg";
}

function fuori(nome){
	var oggetto = document.getElementById(nome);
	if (bloccato!=nome) oggetto.src = "./jpg/" + nome + ".jpg";
}

function blocca(nome){

if (nome!=bloccato)	{	
	var oggetto = document.getElementById(bloccato);
	oggetto.src = "./jpg/" + bloccato + ".jpg";
	bloccato = nome;
}

}

function invia(pagina, evento){
if(esterna && !esterna.closed) {esterna.close();esterna=null;}
URL= "invia.php?evento=" + evento;
P = 'width=' + 400 + ',height=' + 300 + ' , ';
P+= 'left=' + ((screen.width/2)-(200)) + ', top=' + ((screen.height/2)-(150)) + ', ';
P+= 'toolbar=no, location=no, status=no, menubar=no, scrollbars=no, resizable=no';
esterna = window.open(URL,'Finestra',P);
esterna.window.focus();
}

function galleria(galleria){
if(esterna && !esterna.closed) {esterna.close();esterna=null;}
URL= "galleria.php?galleria=" + galleria;
P = 'width=' + 600 + ',height=' + 490 + ' , ';
P+= 'left=' + ((screen.width/2)-(300)) + ', top=' + ((screen.height/2)-(225)) + ', ';
P+= 'toolbar=no, location=no, status=no, menubar=no, scrollbars=no, resizable=no';
esterna = window.open(URL,'Finestra',P);
esterna.window.focus();
}

function scheda(artista){
if(esterna && !esterna.closed) {esterna.close();esterna=null;}
URL= "scheda.php?artista=" + artista;
P = 'width=' + 800 + ',height=' + 500 + ' , ';
P+= 'left=' + ((screen.width/2)-(300)) + ', top=' + ((screen.height/2)-(225)) + ', ';
P+= 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=yes';
esterna = window.open(URL,'Finestra',P);
esterna.window.focus();
return false;
}

var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// Handle all the FSCommand messages in a Flash movie.
function Newsletter_DoFSCommand(command, args) {
	var NewsletterObj = isInternetExplorer ? document.all.Newsletter : document.Newsletter;
	//
	//richiesta('newsletter.php'); 
	$.ajax( {	url: 'newsletter.php', cache: false, success: function(html){Carica(html);}	});
	blocca('nessuno');
	//
}

// Hook for Internet Explorer.
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<script language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub Newsletter_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call Newsletter_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}

function visualizza(id){
	var oggetto = document.getElementById(id);
	if (oggetto.style.visibility=="hidden")
		{oggetto.style.visibility= "visible"; oggetto.style.height="100%";}
	else
		{oggetto.style.visibility= "hidden"; oggetto.style.height="0px";}
		
}

function controllo(){
	var nome = document.getElementById('nome');
	var cognome = document.getElementById('cognome');
	var email = document.getElementById('email');
	var privacy = document.getElementById('privacy');
	var azienda = document.getElementById('azienda');
	var indirizzo = document.getElementById('indirizzo');
	var telefono = document.getElementById('telefono');
	var fax = document.getElementById('fax');
	var cellulare = document.getElementById('cellulare');
	var motivazione = document.getElementById('motivazione');
	var categorie = document.getElementById('categorie');
	if ((nome.value=="")||(cognome.value=="")||(email.value=="")||(privacy.checked==false))
		{alert("Campi obbligatori non rispettati."); return 0;}
	else
		{
			richiesta('iscrizione.php?nome='+ nome.value +'&cognome='+ cognome.value +'&email='+ email.value +'&azienda='+ azienda.value +'&indirizzo='+ indirizzo.value +'&telefono='+ telefono.value +'&fax='+ fax.value +'&cellulare='+ cellulare.value +'&motivazione='+ motivazione.value +'&categorie0='+ categorie.options[0].value+'&categorie1='+ categorie.options[1].value+'&categorie2='+ categorie.options[2].value+'&categorie3='+ categorie.options[3].value);
		}
}

// Funzione che richiama la creazione delle chiamate ajax
function IniAjax(valore){
	$("#contenitore").ajaxStart(function(){ Carica('<img src="./jpg/barra.jpg" witdh="450" heigth="50"><br><div class="elaborazione"></div>'); });
	
	$("#contenitore").ajaxError(function(){ Carica('<img src="./jpg/barra.jpg" witdh="450" heigth="50"><br><div class="elaborazione"></div>'); });
	
	$('.AjaxReq').each(function(){
		$(this).click(function(){
			//alert($(this).attr("href"));
			$.ajax( {	url: $(this).attr("href"), cache: false, success: function(html){Carica(html);}	});
			return false;
		});
	});

}
 
// Funzione che richiama un caricamento delle chiamate ajax
function CarAjax(valore){
	//alert($(this).attr("href"));
	$.ajax( {	url: valore, cache: false, success: function(html){Carica(html);}	});
	return false;
}


//funzione che inserisce la risposta Ajax del calendario
function Carica(html){
	$("#contenitore").html(html);
}

// Funzione che richiama la creazione delle chiamate ajax
function ApriScheda(){
	$('.ApriScheda').each(function(){
		$(this).click(function(){
			//alert('');
			
			if(esterna && !esterna.closed) {esterna.close();esterna=null;}
			URL= $(this).attr("href");
			P = 'width=' + 800 + ',height=' + 500 + ' , ';
			P+= 'left=' + ((screen.width/2)-(300)) + ', top=' + ((screen.height/2)-(225)) + ', ';
			P+= 'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=yes';
			esterna = window.open(URL,'Finestra',P);
			esterna.window.focus();
			return false;

		});
	});

}
