﻿var radiotraining = false;
var radiotraining = false;
var checktraining = false;
var array_numeri = new Array()

function check_login(){
	if (document.logon.username.value == ''){
		alert ('Username Assente');
		return false;
	}
	if (document.logon.password.value == ''){
		alert ('Password Assente');
		return false;
	}
	document.logon.action="./include/logon.php";
	document.logon.submit();
}
function check_dati(){
	if (document.registra.username.value == ''){
		alert ('Username Assente');
		return false;
	}
	//	if (document.registra.password.value == ''){
	//		alert ('Passwprd Assente');
	//		return false;
	//	}
	if (document.registra.email.value == ''){
		alert ('E-Mail Assente');
		return false;
	}
	//	}else if(document.registra.email.){
	//		alert ('E-Mail inserita non corretta');
	//		return false;
	//	}
	if (document.registra.rules.checked == false){
		alert ('Bisogna accettare le regole per continuare');
		return false;
	}
	document.registra.action="./include/registra.php";
	document.registra.submit();
}
function accept_lavoro() {
	//alert ('dddd');
	msg = "Sei sicuro di volere accettare il lavoro?";
	if (confirm(msg)){
		document.accrif_lavoro.accrif.value='accetta';
		document.accrif_lavoro.action='./index.php?main=CCRFLAV';
		document.accrif_lavoro.submit();
		return;
	}


	//	alert(document.accetta_lavoro.accetta.value);
	//	alert(document.accetta_lavoro.rifiuta.value);
}
function rifiuta_lavoro() {
	msg = "Sei sicuro di volere rifiutare il lavoro?";
	if (confirm(msg)){
		document.accrif_lavoro.accrif.value='rifiuta';
		document.accrif_lavoro.action='./index.php?main=CCRFLAV';
		document.accrif_lavoro.submit();
		return;
	}
}
function cerca_giocatore(){
	document.cerca_gioc.action='./index.php?main=RSLTDT';
	document.cerca_gioc.submit();
	return;
}
function cerca_giocatore_federazione(){
	if (document.cerca_gioc_federazione.nome.value==''){
		alert('Inserisci il nome');
		return false;
	}
	if (document.cerca_gioc_federazione.cognome.value==''){
		alert('Inserisci il cognome');
		return false;
	}
	document.cerca_gioc_federazione.action='./index.php?main=RSLTGCFED';
	document.cerca_gioc_federazione.submit();
	return;
}

function offerta_gioc(){
	document.opz_giocatore.action='./popup.php?main=CQGC';
	document.opz_giocatore.submit();
	return;
}
function offerta_gioc_pres(){
	document.opz_giocatore.action='./popup.php?main=PRSTGC';
	document.opz_giocatore.submit();
	return;
}
function shortlist_gioc(){
	//document.opz_giocatore.action='./shortlist_gioc.php';
	document.opz_giocatore.action='./popup.php?main=SHRTLST';
	document.opz_giocatore.submit();
	return;

}
function unshortlist_gioc(){
	//document.opz_giocatore.action='./unshortlist_gioc.php';
	document.opz_giocatore.action='./popup.php?main=UNSHRTLST';
	document.opz_giocatore.submit();
	return;

}
function sel_nazione(){
	document.scegli_camp.action='./index.php?main=CRCMPNT'
	document.scegli_camp.submit();
}

function crea_campionato(){
	document.scegli_camp.action='./index.php?main=LBRTRN'
	document.scegli_camp.submit();
}
function controlla_form(convocazioni){
	var pos1 = document.imposta_form.pos1.value;
	var pos2 = document.imposta_form.pos2.value;
	var pos3 = document.imposta_form.pos3.value;
	var pos4 = document.imposta_form.pos4.value;
	var pos5 = document.imposta_form.pos5.value;
	var pos6 = document.imposta_form.pos6.value;
	var pos7 = document.imposta_form.pos7.value;
	//	var battpos1 = document.imposta_form.battuta1;//[0].value;
	//	alert(battpos1.length);
	//	var battpos2 = document.imposta_form.battuta2[0].value;
	//	var battpos3 = document.imposta_form.battuta3[0].value;
	//	var battpos4 = document.imposta_form.battuta4[0].value;
	//	var battpos5 = document.imposta_form.battuta5[0].value;
	//	var battpos6 = document.imposta_form.battuta6[0].value;
	//var battpos7 = document.imposta_form.pos7.value;
	/*var pos8 = document.imposta_form.pos8.value;
	var pos9 = document.imposta_form.pos9.value;
	var pos10 = document.imposta_form.pos10.value;
	var pos11 = document.imposta_form.pos11.value;
	var pos12 = document.imposta_form.pos12.value;*/
	//if(convocazioni!=0){
		if ((pos1=='')||(pos2=='')||(pos3=='')||(pos4=='')||(pos5=='')||(pos6=='')){
			alert ('Non e\' stato messo un giocatore titolare, impossibile continuare');
			return false;
		}
		if(document.getElementById("battuta1").selectedIndex == -1){
			alert("Devi indicare almeno un tipo di battuta per il posto 4.");
			document.getElementById("battuta1").focus();
			return false;
		}
		if(document.getElementById("battuta2").selectedIndex == -1){
			alert("Devi indicare almeno un tipo di battuta per il posto 3.");
			document.getElementById("battuta2").focus();
			return false;
		}
		if(document.getElementById("battuta3").selectedIndex == -1){
			alert("Devi indicare almeno un tipo di battuta per il posto 2.");
			document.getElementById("battuta3").focus();
			return false;
		}
		if(document.getElementById("battuta4").selectedIndex == -1){
			alert("Devi indicare almeno un tipo di battuta per il posto 5.");
			document.getElementById("battuta4").focus();
			return false;
		}
		if(document.getElementById("battuta5").selectedIndex == -1){
			alert("Devi indicare almeno un tipo di battuta per il posto 6.");
			document.getElementById("battuta5").focus();
			return false;
		}
		if(document.getElementById("battuta6").selectedIndex == -1){
			alert("Devi indicare almeno un tipo di battuta per il posto 1.");
			document.getElementById("battuta6").focus();
			return false;
		}
//	}else{
//		alert ("Visto che siamo in fase di nazionali puoi non mettere titolari... NON PUOI SALVARE FORMAZIONI PRIVE DI TITOLARI");
//	}		

	//if (pos7==''){
	//	alert ('Non e\' stato inserito il libero, quindi nessun Libero entrer� in campo nella partita')
	//	return false;
	//}
	//if (battpos1==''){
	//	alert ('Non e\' stata selezionata alcun tipo di battuta per il Posto 4, Inseriscine almeno una')
	//	return false;
	//}
	//if (battpos2==''){
	//	alert ('Non e\' stata selezionata alcun tipo di battuta per il Posto 3, Inseriscine almeno una')
	//	return false;
	//}
	//if (battpos3==''){
	//	alert ('Non e\' stata selezionata alcun tipo di battuta per il Posto 2, Inseriscine almeno una')
	//	return false;
	//}
	//if (battpos4==''){
	//	alert ('Non e\' stata selezionata alcun tipo di battuta per il Posto 5, Inseriscine almeno una')
	//	return false;
	//}
	//if (battpos5==''){
	//	alert ('Non e\' stata selezionata alcun tipo di battuta per il Posto 6, Inseriscine almeno una')
	//	return false;
	//}
	//if (battpos6==''){
	//	alert ('Non e\' stata selezionata alcun tipo di battuta per il Posto 1, Inseriscine almeno una')
	//	return false;
	//}
	//if (pos9==''){
	//	//alert ('Non e\' stato messo nessun giocatore come Sostituto 3, verra\' inserito un giocatore primavera a sostituzione.')
	//}
	//if (pos10==''){
	//	//alert ('Non e\' stato messo nessun giocatore come Sostituto 4, verra\' inserito un giocatore primavera a sostituzione.')
	//}
	//if (pos11==''){
	//	//alert ('Non e\' stato messo nessun giocatore come Sostituto 5, verra\' inserito un giocatore primavera a sostituzione.')
	//}
	//if (pos12==''){
	//	//alert ('Non e\' stato messo nessun giocatore come Sostituto 6, verra\' inserito un giocatore primavera a sostituzione.')
	//}
	//	alert('OK');
	//document.imposta_form.flag_match.value=1;
	document.imposta_form.action='./index.php?main=RGSTRFRMZ';
	document.imposta_form.submit();
}
function modifica_nomesponsor1(){
	//document.nome_sponsor.action='./modnome_sponsor.php';
	document.nome_sponsor.action='./popup.php?main=MDNMSPNSR';
	document.nome_sponsor.submit();
}
function accetta_sponsor1(){
	//document.opz_sponsor.action='./accofferta_sponsor.php';
	document.opz_sponsor.action='./popup.php?main=ACCSPNSR';
	document.opz_sponsor.submit();
}
function acquista_gioc(ingaggio){
	//acquista
	if ((document.acquista.valore.value =='')||(document.acquista.valore.value ==0)){
		alert('Non e\' possibile effettuare un\'offerta d\'acquisto a ZERO, ripetere l\'operazione inserendo parametri corretti');
		return false;
	}
	if ((document.acquista.ingaggio.value =='')||(document.acquista.ingaggio.value ==0)){
		alert('Non e\' possibile offrire ZERO come ingaggio al giocatore, ripetere l\'operazione inserendo parametri corretti');
		return false;
	}
	if (ingaggio>document.acquista.ingaggio.value){
		alert('Messaggio dal giocatore:Preferisco rimanere dove sono, l\'ingaggio che percepisco e\' piu alto');
		return false;
	}
	var appoingaggio=ingaggio*3;
	if (document.acquista.ingaggio.value>appoingaggio){
		alert('Messaggio dalla dirigenza:Siamo impazziti?!?!? non ti permettiamo di offrire un ingaggio cosi\' alto!!!');
		return false;
	}
	//	if (document.acquista.anni_ctr.value ==1){
	//		if(confirm('ATTENZIONE si e\' scelto di offrire un contratto di 1 anno solamente, sei sicuro di volere continuare?'));//{
	//			document.acquista.action='./acquista_gioc.php';
	//			document.acquista.submit();
	//			return;
	////		}else{
	////			return false;
	////		}
	//	}
	//document.acquista.action='./acquista_gioc.php';
	document.acquista.action='./popup.php?main=CQGC';
	document.acquista.submit();
	return;
}
function presta_gioc(){
	//acquista
	//	if ((document.acquista.valore.value =='')||(document.acquista.valore.value ==0)){
	//		alert('Non e\' possibile effettuare un\'offerta d\'acquisto a ZERO, ripetere l\'operazione inserendo parametri corretti');
	//		return false;
	//	}
	//	if ((document.acquista.ingaggio.value =='')||(document.acquista.ingaggio.value ==0)){
	//		alert('Non e\' possibile offrire ZERO come ingaggio al giocatore, ripetere l\'operazione inserendo parametri corretti');
	//		return false;
	//	}
	//	if (document.acquista.anni_ctr.value ==1){
	//		if(confirm('ATTENZIONE si e\' scelto di offrire un contratto di 1 anno solamente, sei sicuro di volere continuare?'));//{
	//			document.acquista.action='./acquista_gioc.php';
	//			document.acquista.submit();
	//			return;
	////		}else{
	////			return false;
	////		}
	//	}
	document.presta.action='./popup.php?main=PRSTGC';//presta_gioc.php';
	document.presta.submit();
	return;
}
function mod_prezzobigl(){
	document.palazzetto.operazione.value="biglietto";
	document.palazzetto.action='./index.php?main=MDPLZZTT';
	document.palazzetto.submit();
	return;
}
function mod_palazzetto(){
	document.palazzetto.operazione.value="costruisci";
	document.palazzetto.action='./index.php?main=MDPLZZTT';
	document.palazzetto.submit();
	return;
}
function part_amichev(sqd,dataamic){
	if(confirm('Sei sicuro di accettare l\'amichevole selezionata? non potrai annullare l\'operazione il giorno stesso della partita...')){
		document.amichevoli.sqd_amich.value = sqd;
		document.amichevoli.data_amich.value = dataamic;
		document.amichevoli.action='./index.php?main=LBMCH';
		document.amichevoli.submit();
		return true;
	}else{
		return false;
	}
}
function org_amichevole(){
	if (document.amichevoli.data.value==''){
		alert('Inserisci la Data');
		return false;
	}
	var oggi = new Date();
	var giorno = oggi.getDate();
	var mese = oggi.getMonth() + 1;
	var anno = oggi.getYear();
	if (giorno<10){
		appo=0;
	}else{
		appo='';
	}
	if (mese<10){
		appom=0;
	}else{
		appom='';
	}
	var datacompleta = anno + "" + appom+mese + "" +appo+giorno;
	//alert (datacompleta);
	if (document.amichevoli.data.value < datacompleta) {
		alert("Non puoi organizzare un amichevole prima di OGGI!");
		return false;
	}
	//alert(datacompleta);
	if (isNaN(parseInt(document.amichevoli.ora.value))) {
		alert('Ora assente o non formattata correttamente');
		return false;
	}
	if ((parseInt(document.amichevoli.ora.value)) > 23) {
		alert('Ora non formattata correttamente');
		return false;
	}
	if(confirm('Sei sicuro di volere organizzare l\'amichevole nella data prescelta?')){
		document.amichevoli.sqd_amich.value = 'org';
		document.amichevoli.action='./index.php?main=LBMCH';//elab_amich.php';
		document.amichevoli.submit();
		return true;
	}else{
		return false;
	}
}
function annulla_amichev(partita){
	if(confirm('Sei sicuro di volere annullare la proposta di amichevole?')){
		document.amichevoli.sqd_amich.value = 'ann';
		document.amichevoli.id_amich.value = partita;
		document.amichevoli.action='./index.php?main=LBMCH';//elab_amich.php';
		document.amichevoli.submit();
		return true;
	}else{
		return false;
	}
}
function ritofferta_gioc(){
	if(confirm('Sei sicuro di voler ritirare l\'offerta?')){
		document.opz_giocatore.opz_gioc.value = 'ritiro';
		document.opz_giocatore.action='./popup.php?main=PZFFRT';
		document.opz_giocatore.submit();
		return true;
	}else{
		return false;
	}
}
function modofferta_gioc(){
	document.opz_giocatore.opz_gioc.value = 'modifica';
	document.opz_giocatore.action='./popup.php?main=PZFFRT';//./opz_offerta.php';
	document.opz_giocatore.submit();
	return true;
}
function offerta_newctr(){
	document.opz_giocatore_self.opzione.value = 'newctr';
	document.opz_giocatore_self.action='./popup.php?main=GCSLF';//./giocatore_self.php';
	document.opz_giocatore_self.submit();
	return true;
}
function svinc_gioc(){
	if(confirm('SEI SICURO DI VOLERTI DISFARE DEL GIOCATORE!!! PAGHERAI UNA PENALE DI 10M&euro; PIU\' L\'INGAGGIO ATTUALE MOLTIPLICATO PER GLI ANNI DI CONTRATTO RESIDUI. VUOI CONTINUARE?????')){
		document.opz_giocatore_self.opzione.value = 'svincola';
		document.opz_giocatore_self.action='./popup.php?main=GCSLF';//./giocatore_self.php';
		document.opz_giocatore_self.submit();
		return true;
	}else{
		return false;
	}
}
function lista_tras(){
	if(confirm('IL GIOCATORE VERRA\' MESSO NELLA LISTA TRASFERIMENTI. VUOI CONTINUARE?')){
		document.opz_giocatore_self.opzione.value = 'vendita';
		document.opz_giocatore_self.action='./popup.php?main=GCSLF';//./giocatore_self.php';
		document.opz_giocatore_self.submit();
		return true;
	}else{
		return false;
	}
}
function lista_pres(){
	if(confirm('IL GIOCATORE VERRA\' MESSO NELLA LISTA PRESTITI. VUOI CONTINUARE?')){
		document.opz_giocatore_self.opzione.value = 'pres';
		document.opz_giocatore_self.action='./popup.php?main=GCSLF';//./giocatore_self.php';
		document.opz_giocatore_self.submit();
		return true;
	}else{
		return false;
	}
}
function coppa_naz(){
	//crea_coppa
	document.crea_coppa.tipo_coppa.value = 'naz';
	document.crea_coppa.action='./index.php?main=CRCPP';
	document.crea_coppa.submit();
	return true;
}
function coppa_cont(){
	document.crea_coppa.tipo_coppa.value = 'cont';
	document.crea_coppa.action='./index.php?main=CRCPP';
	document.crea_coppa.submit();
	return true;
}
function coppa_mondiale(){
	document.crea_coppa.tipo_coppa.value = 'mondiale';
	document.crea_coppa.action='./index.php?main=CRCPP';
	document.crea_coppa.submit();
	return true;
}
//function aggiungi_cod()
//{
//	var form = document.getElementById("creacoppa");
//	//alert (form);
////	var terr= form.crea_coppa;
////	alert (terr);
////	limite=0;
////	for (el = 0; el < terr.length; el++){
////	         if (terr[el].checked==true && (terr[el].value == 1 || terr[el].value == 2 || terr[el].value == 3)){
////	         	limite=1;
////	         }
////Andrea 25/1/2006 ricerca per gruppo di uffici non normata, abilito solamente il controllo per altro ufficio
////  da scommentare in caso venga normata la ricerca per gruppo di uffici ed eliminare la seg. stringa dalla if precedente"|| terr[el].value == 3"
////	         } else if(terr[el].checked==true && terr[el].value == 3){
////	         	limite=15;
////	         }
// //   }
//
//	num_cod_cons= document.getElementById("squadre_sel").options.length;
//	optinValue = document.getElementById("squadre").value;
//
//	if (optinValue != '') {
//		//if (ctr_cod_cons(optinValue, limite)){
//			optionIndex = document.getElementById("squadre").selectedIndex;
//			optionText = document.getElementById("squadre").options[optionIndex].text;
//			nuovaOption = document.createElement("OPTION");
//			nuovaOption.text = optionText;
//			nuovaOption.value = optinValue;
//			document.getElementById("squadre_sel").options.add(nuovaOption);
//		//}
//	} else {
//		msgerror(163);
//		return false;
//	}
//	return true;
//}
//
//function elimina_cod()
//{
//	i = document.getElementById("squadre_sel").selectedIndex;
//	if (i!= -1) {
//		document.getElementById("squadre_sel").options.remove(i);
//	} else {
//		msgerror(163);
//	}
//}
function chpassword (){
	var oldpass = document.chpwd.oldpwd.value;
	var newpass = document.chpwd.newpwd.value;
	var newpass1 = document.chpwd.newpwd_conf.value;

	if (oldpass ==''){
		alert('Campo vecchia password vuoto');
		return false;
	}
	if ((newpass=='')||(newpass.length<8)){
		alert('Campo Nuova password vuoto o di lunghezza insufficiente');
		return false;
	}
	if (newpass1!=newpass){
		alert('La password di conferma non coincide con quella fornita');
		return false;
	}
	document.chpwd.action='./index.php?main=MDPWD';
	document.chpwd.submit();
}
function accrifofferta_gioc(tipo){
	var controp='';
//	if (document.getElementById('controprop').checked==true){
//		controp=prompt('Inserisci la motivazione del rifiuto o la tua controproposta','Attenzione, messaggi offensivi saranno passibili di multa');
//		//return false;
//		document.opz_giocatore_vendita.msg_rif.value=controp;
//	}
	//alert (controp);
	//return false;
	document.opz_giocatore_vendita.opz_gioc.value=tipo;
	document.opz_giocatore_vendita.action='./popup.php?main=MRCGC'
	document.opz_giocatore_vendita.submit();

}
function accrifofferta_giocpres(tipo){
	var controp='';
//	if (document.getElementById('controprop').checked==true){
//		controp=prompt('Inserisci la motivazione del rifiuto o la tua controproposta','Attenzione, messaggi offensivi saranno passibili di multa');
//		//return false;
//		document.opz_giocatore_vendita.msg_rif.value=controp;
//	}
	//alert (controp);
	//return false;
	document.opz_giocatore_vendita.opz_gioc.value=tipo;
	document.opz_giocatore_vendita.action='./popup.php?main=MRCGCPRS'
	document.opz_giocatore_vendita.submit();

}
function mod_biglietto(){
	//alert('e');
	if (document.modbiglietto.prezzo.value==0){
		alert('Non puoi mettere il prezzo del biglietto a zero');
		return false;
	}else{
		if (document.modbiglietto.prezzo.value>30){
			alert('Ok, l\'inflazione e le mancate entrate, ma la cifra che hai messo e\' troppo alta. Inseriscine una piu\' bassa');
			return false;
		}else{
			document.modbiglietto.azione.value='biglietto';
			document.modbiglietto.action='./index.php?main=UPDPLZZTT'
			//	alert(document.modbiglietto.action);
			document.modbiglietto.submit();
		}
	}
}
function set_training(step){
	if (step=='conferma'){
		if ((document.getElementById('intensita0').checked==false)&&
		(document.getElementById('intensita1').checked==false)&&
		(document.getElementById('intensita2').checked==false)&&
		(document.getElementById('intensita3').checked==false)){
			alert('Impostare l\'intensita\'di allenamento');
			return false;
		}
		//alert (document.getElementById('ritiropre').checked);
		if 	((document.getElementById('ritiropre').checked==true)){
			//alert ('1');
			if (document.training.ggpre.value==''){
				//alert ('2');
				alert ('Se si e\' scelto di mandare la squadra in ritiro Impostare i giorni di Ritiro');
				return false;
			}else if ((document.training.ggpre.value>=7)||(document.training.ggpre.value==0)){
				//alert ('3');
				alert ('Impossibile mandare la squadra in ritiro per 0 o 7 giorni');
				return false;
			}
			//alert ('4');
		}
		//alert('dd')
		if 	(document.getElementById('ritirocamp').checked==true){
			if (document.training.ggcamp.value==''){
				alert ('Se si e\' scelto di mandare la squadra in ritiro, impostare i giorni di Ritiro');
				return false;
			}else if ((document.training.ggpre.value>=7)||(document.training.ggpre.value==0)){
				//alert ('3');
				alert ('Impossibile mandare la squadra in ritiro per 0 o 7 giorni');
				return false;
			}
		}
		document.training.hiddenval.value=step;
		document.training.action='./index.php?main=STTRNNG';
		document.training.submit();
	}else if(step=='primavera'){
		fisico = parseFloat(document.primavera.fisico.value);
		tattico = parseFloat(document.primavera.tattico.value);
		palla = parseFloat(document.primavera.palla.value);
		stelle_tot=fisico+tattico+palla;
		if (stelle_tot>10){
			alert('Hai impostato piu\' di 10 stelle di allenamento, selezionarne di meno e riprovare');
			return false;
		}
		document.primavera.hiddenval.value=step;
		document.primavera.action='./index.php?main=STTRNNG';
		document.primavera.submit();
		//		checcato=false;
		//		for (i = 0; i < document.primavera.id_gioc.length; i++){
		//			if (document.primavera.id_gioc[i].checked){
		//				checcato=true;
		//			}
		//		}
		////		if (checcato==false){
		////			alert('Seleziona almeno un giocatore a cui impostare l\'allenamento e riprova');
		////			return false;
		////		}
	}else if(step=='prima_squadra'){
		//alert(document.training.fisico.value);
//		fisico = parseFloat(document.training.fisico.value);
//		tattico = parseFloat(document.training.tattico.value);
//		palla = parseFloat(document.training.palla.value);
//		stelle_tot=fisico+tattico+palla;
//		//alert(stelle_tot);
//		if (stelle_tot>10){
//			alert('Hai impostato piu\' di 10 stelle di allenamento, selezionarne di meno e riprovare');
//			return false;
	//	}
		//		checcato=false;
		//		//alert(document.training.id_gioc.length);
		//		for (i = 0; i < document.training.id_gioc.length; i++){
		//			if (document.training.id_gioc[i].checked){
		//				checcato=true;
		//			}
		//		}
		////		if (checcato==false){
		////			alert('Seleziona almeno un giocatore a cui impostare l\'allenamento e riprova');
		////			return false;
		////		}
		document.training.hiddenval.value=step;
		document.training.action='./index.php?main=STTRNNG';
		document.training.submit();
	}else if(step=='partitella'){
		alert('Partitella');
	}else if(step=='forma'){
		flag_pre = document.getElementById("ritiropre").checked;
		//		if (document.training.intensita.value==''){
		//			alert('Impostare l\'intensita\' dell\'allenamento ');
		//			return false;
		//		}
		if (flag_pre==true){
			if (document.training.ggpre.value==''){
				alert('Se si e\' impostato di volere fare il ritiro impostare il numero dei giorni');
				return false;
			}
		}else{
			flag_camp = document.getElementById("ritirocamp").checked;
			if (flag_camp==true){
				if (document.training.ggcamp.value==''){
					alert('Se si e\' impostato di volere fare il ritiro impostare il numero dei giorni');
					return false;
				}
			}
		}
		document.training.hiddenval.value=step;
		document.training.action='./index.php?main=STTRNNG';
		document.training.submit();
	}
	//documen
}
function check_num(id_gioc){
	num=document.getElementById("numeri_"+id_gioc).value;
	//alert (num);
	//alert (array_numeri);
	var flag_change=true;
	var str_appo ='';
	for (var x=0;x<array_numeri.length;x++){
		//alert ('ciao1');
		arr_appo=array_numeri[x].split('@');
		if (arr_appo[0]==id_gioc){
			//alert ('ciao2');
			//sto cambiando il numero ad un giocatore quindi sovrascrivo....
			arr_appo[1]=num;
			str_appo=arr_appo[0]+'@'+arr_appo[1];
			array_numeri[x]=str_appo;
			return true;
		}else{
			//alert ('ciao3');
			flag_change=false;
		}
	}
	if (flag_change==false){
		//alert ('ciao4');
		str_appo=id_gioc+'@'+num;
		for (var x=0;x<array_numeri.length;x++){
			//alert ('ciao5');
			arr_appo=array_numeri[x].split('@');
			if (arr_appo[1]==num){
				//alert ('ciao6');
				alert('Numero Gia\' inserito impossibile continuare');
				document.getElementById("numeri_"+id_gioc).value=0;
				//document.getElementById("numeri_"+id_gioc).onchange();
				str_appo='';
				return true;
			}
			//alert ('ciao7');
		}
	}
	if (array_numeri.length==0){
		str_appo=id_gioc+'@'+num;
	}
	//alert (str_appo);
	array_numeri.push(str_appo);



	return true;
}
function check_formNum(){
	//document.training.hiddenval.value=step;
	document.gest_num.action='./index.php?main=NSRTNMR';
	document.gest_num.submit();

}
function palazzetto(){
	//alert('cao');
	if (document.modpalazzetto.nome_palazzetto.value==''){
		alert('Devi mettere un nome al Palazzetto');
		return false;
	}else{
		//alert('cao1');
		document.modpalazzetto.azione.value='palazzetto';
		//alert('cao2');
		document.modpalazzetto.action='./index.php?main=UPDPLZZTT'
		//alert(document.modpalazzetto.action);
		document.modpalazzetto.submit();
	}
}
function crea_primavera(){
	//if (document.primavera.nome.value==''){
	//	alert('Nome del Giocatore Assente, ne verrà impostato uno di default');
	//}
	//if (document.primavera.cognome.value==''){
	//	alert('Cognome del Giocatore Assente, ne verrà impostato uno di default');
	//}
	//alert ('In lavorazione');
	//document.primavera.azione.value='palazzetto';
	document.primavera.action='./index.php?main=CRPRMVR'
	document.primavera.submit();

}
function cambia_all(){
	tipo_all=document.training.tipo_train.value;
	document.training.action='./index.php?main=ALNMN&id='+tipo_all;
	document.training.submit();
}
function cerca_matches(){
	if (document.cerca_match.data.value==''){
		alert('Inserisci la Data');
		return false;
	}
	document.cerca_match.action='./index.php?main=AWED';
	document.cerca_match.submit();
}
function cerca_matchescronaca(){
	if (document.cerca_matchcrn.data.value==''){
		alert('Inserisci la Data');
		return false;
	}
	document.cerca_matchcrn.action='./index.php?main=PRTCRN';
	document.cerca_matchcrn.submit();
}

function cerca_matchesnaz(){
	if (document.cerca_matchnaz.data.value==''){
		alert('Inserisci la Data');
		return false;
	}
	document.cerca_matchnaz.action='./index.php?main=PRTNAZ';
	document.cerca_matchnaz.submit();
}
function ann_amichevole(partita){
	if(confirm('Sei sicuro di volere annullare l\'amichevole selezionata?')){
		document.partite.sqd_amich.value = 'annulla';
		document.partite.id_partita.value = partita;
		document.partite.action='./index.php?main=LBMCH';
		document.partite.submit();
		return true;
	}else{
		return false;
	}
}
function ann_amichevole_main(partita){
	if(confirm('Sei sicuro di volere annullare l\'amichevole selezionata?')){
		document.principale.sqd_amich.value = 'annulla';
		document.principale.id_partita.value = partita;
		document.principale.action='./index.php?main=LBMCH';
		document.principale.submit();
		return true;
	}else{
		return false;
	}
}
function disable_libero(){
	if (document.imposta_form.util_libero.checked==false){
		document.imposta_form.opz_libero_in.disabled=true;
		document.imposta_form.opz_libero_out.disabled=true;
		//document.imposta_form.util_libero.checked=false;
	}else{
		document.imposta_form.opz_libero_in.disabled=false;
		document.imposta_form.opz_libero_out.disabled=false;
		//document.imposta_form.util_libero.checked=true;
	}
	//return true;
	//document.imposta_form.util_libero.checked=false;
}
//function rigioca_match(partita){
//	if(confirm('Sei sicuro di volere rigiocare la partita selezionata?')){
//		document.partite.sqd_amich.value = 'rigioca';
//		document.partite.id_partita.value = partita;
//		document.partite.action='./index.php?main=.php';
//		document.partite.submit();
//		return true;
//	}else{
//		return false;
//	}
//}
function operaz_utente(operaz){
	//document.partite.sqd_amich.value = 'rigioca';
	document.mod_user.operazione.value = operaz;
	document.mod_user.action='./index.php?main=MDUSR';
	document.mod_user.submit();
}
function reset_pwd(operaz){
	//document.partite.sqd_amich.value = 'rigioca';
	document.mod_user.operazione.value = operaz;
	document.mod_user.action='./index.php?main=USRDT';
	document.mod_user.submit();
}
//reset_pwd
function elabora_coppa(){
	document.crea_coppa.action='./index.php?main=LBCPP';
	document.crea_coppa.submit();
}
function elabora_coppa_manuale(){
	document.crea_coppa.action='./index.php?main=LBCPPMNL';
	document.crea_coppa.submit();
}
function elabora_coppa_naz(){
	document.crea_coppa.action='./index.php?main=LBCPPNZ';
	document.crea_coppa.submit();
}
function visual_coppa(id_coppa,flag_comp){
	if (flag_comp=='3'){
		document.coppa.action='./index.php?main=VSLCPRR&id='+id_coppa;
		document.coppa.submit();
	}else{		
		document.coppa.action='./index.php?main=VSLCP&id='+id_coppa;
		document.coppa.submit();
	}
}
function visual_coppa_naz(id_coppa,flag_comp){
	if (flag_comp=='3'){
		document.coppa.action='./index.php?main=VCPRRNAZ&id='+id_coppa;
		document.coppa.submit();
	}else{		
		document.coppa.action='./index.php?main=VSLCPNAZ&id='+id_coppa;
		document.coppa.submit();
	}
}
//function cont_coppa(id_coppa){
//		document.coppa.action='./index.php?main=contcoppa.php&id='+id_coppa;
//		document.coppa.submit();
//}
function vis_allnews(){
	document.principale.limit.value = 0;
	document.principale.action='./index.php';
	document.principale.submit();
}
function vis_sqdnews(){
	document.principale.limit.value = 0;
	document.principale.action='./index.php?main=FEASD';
	document.principale.submit();
}
function gopagina(pag){
	document.cerca_gioc.pagina.value = pag;
	document.cerca_gioc.action='./index.php?main=RSLTDT';
	document.cerca_gioc.submit();
}
function gopaginat(pag){
	document.cerca_gioc.pagina.value = pag;
	document.cerca_gioc.action='./index.php?main=LSTTRSMNT';
	document.cerca_gioc.submit();
}
function gopaginanz(pag){
	document.cerca_gioc.pagina.value = pag;
	document.cerca_gioc.action='./index.php?main=RSLTDTNZ';
	document.cerca_gioc.submit();
}
function opzassconn(opz){
	document.opz_assconn.opzioni.value = opz;
	document.opz_assconn.action='./popup.php?main=LBSSCNN';//elabassconn.php';
	document.opz_assconn.submit();
}
//Till Here------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//Till Here------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function offerta_gioc_annullapres(){
	if(confirm('Sei sicuro di voler terminare il prestito? se il giocatore non ha terminato le sue partite da giocare pagherai la multa di 5M piu il suo ingaggio!')){
		//document.opz_giocatore.opz_gioc.value = 'ritiro';
		document.opz_giocatorepres.action='./popup.php?main=PZPRS';
		document.opz_giocatorepres.submit();
		return true;
	}else{
		return false;
	}

}
function giocpres(){
	if(confirm('Attenzione, questa operazione non obbliga l\'altro mister a restituire il giocatore indietro, e\' solo una richiesta vuoi continuare?')){
		document.opz_giocatore_self.opzione.value = 'messaggio';
		document.opz_giocatore_self.action='./popup.php?main=GCSLF';
		document.opz_giocatore_self.submit();
		return true;
	}else{
		return false;
	}
}
function ins_news(){
	if (document.news.messaggio.value==''){
		alert('Inserisci un messaggio');
		return false;
	}
	//document.cerca_gioc.pagina.value = pag;
	document.news.action='./index.php?main=NSNWSDB';
	document.news.submit();
}
function invia_mail(){
	if (document.mailfed.oggetto.value==''){
		alert('Manca l\'oggetto della E-Mail');
		return false;
	}
	if (document.mailfed.messmail.value==''){
		alert('Manca il Messaggio della E-Mail');
		return false;
	}
	//document.cerca_gioc.pagina.value = pag;
	document.mailfed.action='./index.php?main=NVML';
	document.mailfed.submit();
}
function shortlist_giocpres(){
	document.opz_giocatorepres.action='./popup.php?main=SHTRL';
	document.opz_giocatorepres.submit();
	return;

}
function penuserrank(operaz){
	alert('ATTENZIONE FUNZIONA SOLO CON FIREFOX o I.E. 6.0 o inferiore');
	if(confirm('Sei sicuro di volere Penalizzare l\'utente togliendogli punti dal rank?')){
		puntirank=prompt('Inserisci di quanti punti l\'utente deve essere penalizzato nel rank','');
		if (isNaN(puntirank)){
			alert('attenzione! inserire un numero!');
			return false;
		}
		document.mod_user.operazione.value = operaz;
		//document.opz_giocatore_self.opzione.value = 'messaggio';
		document.mod_user.action='./index.php?main=SRCTNS&param='+puntirank;
		document.mod_user.submit();
	}else{
		return false;
	}
}
function esonero(operaz){
	if(confirm('Sei sicuro di volere Esonerare il mister?')){
//	alert('W.I.P. funzione da completare e testare BENE vista la sua importanza');
//	return false;
	//document.mod_user.opzione.value = 'messaggio';
	document.mod_user.operazione.value = operaz;
	//document.mod_user.action='./giocatore_self.php';
	//document.mod_user.action='./index.php?main=useredit.php&param='+puntirank;
	document.mod_user.action='./index.php?main=SRCTNS';
	document.mod_user.submit();
	return true;
	}else{
		return false;
	}
	//	}else{
	//		return false;
	//	}
}
function esonero(operaz){
//	alert('W.I.P. funzione da completare e testare BENE vista la sua importanza');
//	return false;
	if(confirm('Sei sicuro di volere esonerare l utente?')){
	//document.mod_user.opzione.value = 'messaggio';
	document.mod_user.operazione.value = operaz;
	//document.mod_user.action='./giocatore_self.php';
	//document.mod_user.action='./index.php?main=useredit.php&param='+puntirank;
	document.mod_user.action='./index.php?main=SRCTNS';
	document.mod_user.submit();
	return true;
	}else{
		return false;
	}
}
function finesquad(operaz){
	alert('ATTENZIONE FUNZIONA SOLO CON FIREFOX o I.E. 6.0 o inferiore')
	if(confirm('Sei sicuro di volere Multare la squadra?')){
		multa=prompt('Inserisci quanti M� di multa ricever� la squadra ','');
		if (isNaN(multa)){
			alert('attenzione! inserire un numero!');
			return false;
		}
		if(confirm('La squadra verr� multata di '+multa+'M�, vuoi continuare?')){
			document.mod_user.operazione.value = operaz;
			//document.opz_giocatore_self.opzione.value = 'messaggio';
			document.mod_user.action='./index.php?main=SRCTNS&param='+multa;
			document.mod_user.submit();
		}else{
			return false;
		}
	}else{
		return false;
	}
}
function pensquad(operaz){
	alert('ATTENZIONE FUNZIONA SOLO CON FIREFOX o I.E. 6.0 o inferiore')
	if(confirm('Sei sicuro di volere Penalizzare la squadra togliendogli punti in classifica?')){
		punticlass=prompt('Inserisci di quanti punti la squadra deve subire in penalizzazione','');
		if (isNaN(punticlass)){
			alert('attenzione! inserire un numero!');
			return false;
		}
		if(confirm('La squadra verr� penalizzata di '+punticlass+' punti, vuoi continuare?')){
			document.mod_user.operazione.value = operaz;
			//document.opz_giocatore_self.opzione.value = 'messaggio';
			document.mod_user.action='./index.php?main=SRCTNS&param='+punticlass;
			document.mod_user.submit();
		}else{
			return false;
		}
	}else{
		return false;
	}
}
function monitortras(operaz){
	alert('W.I.P. solo visualizzazione per ora, la funzione � da completare e testare BENE vista la sua importanza');
	//return false;
	//document.mod_user.opzione.value = 'messaggio';
	document.mod_user.operazione.value = operaz;
	//document.mod_user.action='./giocatore_self.php';
	//document.mod_user.action='./index.php?main=useredit.php&param='+puntirank;
	document.mod_user.action='./index.php?main=TRSFMNCHK&param='+operaz;
	document.mod_user.submit();
	return true;
	//	}else{
	//		return false;
	//	}
}
function refundsquad(operaz){
	alert('ATTENZIONE FUNZIONA SOLO CON FIREFOX o I.E. 6.0 o inferiore')
	if(confirm('Sei sicuro di volere rimborsare la squadra?')){
		imprimb=prompt('Inserisci quanti M� devono essere restituiti alla squadra.','');
		if (isNaN(imprimb)){
			alert('attenzione! inserire un numero!');
			return false;
		}
		if(confirm('La rimborsata di '+imprimb+' M�, vuoi continuare?')){
			document.mod_user.operazione.value = operaz;
			//document.opz_giocatore_self.opzione.value = 'messaggio';
			document.mod_user.action='./index.php?main=SRCTNS&param='+imprimb;
			document.mod_user.submit();
		}else{
			return false;
		}
	}else{
		return false;
	}
}
function modprimavera(operaz){
	//alert('W.I.P. funzione da completare e testare BENE vista la sua importanza');
	//return false;
	//document.mod_user.opzione.value = 'messaggio';
	document.opz_modificaprim.operazione.value = operaz;
	//document.mod_user.action='./giocatore_self.php';
	//document.mod_user.action='./index.php?main=useredit.php&param='+puntirank;
	document.opz_modificaprim.action='./popup.php?main=CTNPZPRMV';
	document.opz_modificaprim.submit();
	return true;
	//	}else{
	//		return false;
	//	}
}
function salva_formaz(){
	var pos1 = document.imposta_form.pos1.value;
	var pos2 = document.imposta_form.pos2.value;
	var pos3 = document.imposta_form.pos3.value;
	var pos4 = document.imposta_form.pos4.value;
	var pos5 = document.imposta_form.pos5.value;
	var pos6 = document.imposta_form.pos6.value;
	var pos7 = document.imposta_form.pos7.value;
	/*var pos8 = document.imposta_form.pos8.value;
	var pos9 = document.imposta_form.pos9.value;
	var pos10 = document.imposta_form.pos10.value;
	var pos11 = document.imposta_form.pos11.value;
	var pos12 = document.imposta_form.pos12.value;*/


	if ((pos1=='')||(pos2=='')||(pos3=='')||(pos4=='')||(pos5=='')||(pos6=='')){
		alert ('Non e\' stato messo un giocatore titolare, impossibile continuare');
		return false;
	}
	if (pos7==''){
		alert ('Non e\' stato inserito il libero, quindi nessun Libero entrer� in campo nella partita')
	}
	alert('Salvando la formazione NON VERRA\' IMPOSTATA PER LA PARTITA! ma solamente memorizzata per un uso successivo, per impostare la formazione per la partita cliccare su Imposta');
	//if (pos8==''){
	//	//alert ('Non e\' stato messo nessun giocatore come Sostituto 2, verra\' inserito un giocatore primavera a sostituzione.')
	//}
	//if (pos9==''){
	//	//alert ('Non e\' stato messo nessun giocatore come Sostituto 3, verra\' inserito un giocatore primavera a sostituzione.')
	//}
	//if (pos10==''){
	//	//alert ('Non e\' stato messo nessun giocatore come Sostituto 4, verra\' inserito un giocatore primavera a sostituzione.')
	//}
	//if (pos11==''){
	//	//alert ('Non e\' stato messo nessun giocatore come Sostituto 5, verra\' inserito un giocatore primavera a sostituzione.')
	//}
	//if (pos12==''){
	//	//alert ('Non e\' stato messo nessun giocatore come Sostituto 6, verra\' inserito un giocatore primavera a sostituzione.')
	//}
	//	alert('OK');
	document.imposta_form.action='./index.php?main=SLVFRMZ';
	document.imposta_form.submit();
}
function carica_formaz(){
	document.imposta_form.action='./index.php?main=FRMAZ';
	document.imposta_form.submit();
}
function newctr_gioc(){
	document.opz_giocatore_self.opzione.value = 'rinnova';
	document.opz_giocatore_self.action='./popup.php?main=PZNWCTRRSC';//./opz_offerta.php';
	document.opz_giocatore_self.submit();
	return true;
}
function resccons_gioc(){
	document.opz_giocatore_self.opzione.value = 'rescindicons';
	document.opz_giocatore_self.action='./popup.php?main=PZNWCTRRSC';//./opz_offerta.php';
	document.opz_giocatore_self.submit();
	return true;
}
function rinnovactr_gioc(operaz){
	if (operaz=='resccons'){
		if(confirm('Il giocatore dara\' una risposta immediata, l\'operazione non e\' reversibile, vuoi continuare?')){
			document.rinnovarescctr.opzione.value = operaz;
			document.rinnovarescctr.action='./popup.php?main=NWCTRRSC';//./opz_offerta.php';
			document.rinnovarescctr.submit();
			return true;
		}else{
			return false;
		}
	}else{
		document.rinnovarescctr.opzione.value = operaz;
		document.rinnovarescctr.action='./popup.php?main=NWCTRRSC';
		document.rinnovarescctr.submit();
		return true;
	}
}
function chpalazznaz(){
	document.chpalaznaz.opzione.value='cambiapalazz';
	document.chpalaznaz.action='./index.php?main=ELBNAZ';
	document.chpalaznaz.submit();
	return true;
}
function cerca_giocatorenaz(under){
	if (under==1){
		if (document.cerca_giocnaz.etamax.value==''){
			document.cerca_giocnaz.etamax.value=21;
		}
		if (document.cerca_giocnaz.etamax.value>21){
			alert('Attenzione alleni l\'under 21 non puoi convocare giocatori piu grandi di 18 anni');
			return false;
		}
		if (document.cerca_giocnaz.etamin.value>document.cerca_giocnaz.etamax.value){
			alert('Attenzione l\'eta minima inserita e\' piu\' grande di quella massima ricontrollare');
			return false;
		}
		if (document.cerca_giocnaz.etamin.value>21){
			alert('Attenzione alleni l\'under 21 non puoi convocare giocatori piu grandi di 18 anni');
			return false;
		}
	}
	document.cerca_giocnaz.action='./index.php?main=RSLTDTNZ';
	document.cerca_giocnaz.submit();
	return;
}
function convocanaz(tipoaz){
	document.opz_giocatorenaz.opzione.value=tipoaz;
	document.opz_giocatorenaz.action='./popup.php?main=CNVCNZ';
	document.opz_giocatorenaz.submit();
	return true;
}
function imposta_sceltenaz(){
	alert('ATTENZIONE! non viene controllato se hai scelto due nazionali identiche nelle tue scelte, ricontrolla bene.');
	//document.accrif_lavoronaz.opzione.value=tipoaz;
	document.accrif_lavoronaz.action='./index.php?main=NSRSCLTNZ';
	document.accrif_lavoronaz.submit();
	return true;
}
function ritofferta_giocpres(){
	if(confirm('Sei sicuro di voler ritirare l\'offerta?')){
		document.opz_giocatore.opz_gioc.value = 'ritiro';
		document.opz_giocatore.action='./popup.php?main=PZFFRTPRS';
		document.opz_giocatore.submit();
		return true;
	}else{
		return false;
	}
}
function accept_lavoronaz() {
	//alert ('dddd');
	msg = "Sei sicuro di volere accettare il lavoro?";
	if (confirm(msg)){
		document.accrif_lavoronaz.accrif.value='accetta';
		document.accrif_lavoronaz.action='./index.php?main=CCRFLAVNZ';
		document.accrif_lavoronaz.submit();
		return;
	}


	//	alert(document.accetta_lavoro.accetta.value);
	//	alert(document.accetta_lavoro.rifiuta.value);
}
function rifiuta_lavoronaz() {
	msg = "Sei sicuro di volere rifiutare il lavoro?";
	if (confirm(msg)){
		document.accrif_lavoronaz.accrif.value='rifiuta';
		document.accrif_lavoronaz.action='./index.php?main=CCRFLAVNZ';
		document.accrif_lavoronaz.submit();
		return;
	}
}
function shortlist_giocnaz(){
	//document.opz_giocatore.action='./shortlist_gioc.php';
	document.opz_giocatorenaz.action='./popup.php?main=SHRTGCNAZ';
	document.opz_giocatorenaz.submit();
	return;

}
function unshortlist_giocnaz(){
	//document.opz_giocatore.action='./unshortlist_gioc.php';
	document.opz_giocatorenaz.action='./popup.php?main=UNSHRTNAZ';
	document.opz_giocatorenaz.submit();
	return;

}
function salva_formaznaz(){
	var pos1 = document.imposta_form.pos1.value;
	var pos2 = document.imposta_form.pos2.value;
	var pos3 = document.imposta_form.pos3.value;
	var pos4 = document.imposta_form.pos4.value;
	var pos5 = document.imposta_form.pos5.value;
	var pos6 = document.imposta_form.pos6.value;
	var pos7 = document.imposta_form.pos7.value;
	/*var pos8 = document.imposta_form.pos8.value;
	var pos9 = document.imposta_form.pos9.value;
	var pos10 = document.imposta_form.pos10.value;
	var pos11 = document.imposta_form.pos11.value;
	var pos12 = document.imposta_form.pos12.value;*/


	if ((pos1=='')||(pos2=='')||(pos3=='')||(pos4=='')||(pos5=='')||(pos6=='')){
		alert ('Non e\' stato messo un giocatore titolare, impossibile continuare');
		return false;
	}
	if (pos7==''){
		alert ('Non e\' stato inserito il libero, quindi nessun Libero entrer� in campo nella partita')
	}
	alert('Salvando la formazione NON VERRA\' IMPOSTATA PER LA PARTITA! ma solamente memorizzata per un uso successivo, per impostare la formazione per la partita cliccare su Imposta');
	//if (pos8==''){
	//	//alert ('Non e\' stato messo nessun giocatore come Sostituto 2, verra\' inserito un giocatore primavera a sostituzione.')
	//}
	//if (pos9==''){
	//	//alert ('Non e\' stato messo nessun giocatore come Sostituto 3, verra\' inserito un giocatore primavera a sostituzione.')
	//}
	//if (pos10==''){
	//	//alert ('Non e\' stato messo nessun giocatore come Sostituto 4, verra\' inserito un giocatore primavera a sostituzione.')
	//}
	//if (pos11==''){
	//	//alert ('Non e\' stato messo nessun giocatore come Sostituto 5, verra\' inserito un giocatore primavera a sostituzione.')
	//}
	//if (pos12==''){
	//	//alert ('Non e\' stato messo nessun giocatore come Sostituto 6, verra\' inserito un giocatore primavera a sostituzione.')
	//}
	//	alert('OK');
	document.imposta_form.action='./index.php?main=SLVFRMZNZ';
	document.imposta_form.submit();
}
function carica_formaznaz(){
	document.imposta_form.action='./index.php?main=FRMNAZ';
	document.imposta_form.submit();
}
function controlla_formnaz(){
	var pos1 = document.imposta_form.pos1.value;
	var pos2 = document.imposta_form.pos2.value;
	var pos3 = document.imposta_form.pos3.value;
	var pos4 = document.imposta_form.pos4.value;
	var pos5 = document.imposta_form.pos5.value;
	var pos6 = document.imposta_form.pos6.value;
	var pos7 = document.imposta_form.pos7.value;
	//	var battpos1 = document.imposta_form.battuta1;//[0].value;
	//	alert(battpos1.length);
	//	var battpos2 = document.imposta_form.battuta2[0].value;
	//	var battpos3 = document.imposta_form.battuta3[0].value;
	//	var battpos4 = document.imposta_form.battuta4[0].value;
	//	var battpos5 = document.imposta_form.battuta5[0].value;
	//	var battpos6 = document.imposta_form.battuta6[0].value;
	//var battpos7 = document.imposta_form.pos7.value;
	/*var pos8 = document.imposta_form.pos8.value;
	var pos9 = document.imposta_form.pos9.value;
	var pos10 = document.imposta_form.pos10.value;
	var pos11 = document.imposta_form.pos11.value;
	var pos12 = document.imposta_form.pos12.value;*/

	if ((pos1=='')||(pos2=='')||(pos3=='')||(pos4=='')||(pos5=='')||(pos6=='')){
		alert ('Non e\' stato messo un giocatore titolare, impossibile continuare');
		return false;
	}
	if(document.getElementById("battuta1").selectedIndex == -1){
		alert("Devi indicare almeno un tipo di battuta per il posto 4.");
		document.getElementById("battuta1").focus();
		return false;
	}
	if(document.getElementById("battuta2").selectedIndex == -1){
		alert("Devi indicare almeno un tipo di battuta per il posto 3.");
		document.getElementById("battuta2").focus();
		return false;
	}
	if(document.getElementById("battuta3").selectedIndex == -1){
		alert("Devi indicare almeno un tipo di battuta per il posto 2.");
		document.getElementById("battuta3").focus();
		return false;
	}
	if(document.getElementById("battuta4").selectedIndex == -1){
		alert("Devi indicare almeno un tipo di battuta per il posto 5.");
		document.getElementById("battuta4").focus();
		return false;
	}
	if(document.getElementById("battuta5").selectedIndex == -1){
		alert("Devi indicare almeno un tipo di battuta per il posto 6.");
		document.getElementById("battuta5").focus();
		return false;
	}
	if(document.getElementById("battuta6").selectedIndex == -1){
		alert("Devi indicare almeno un tipo di battuta per il posto 1.");
		document.getElementById("battuta6").focus();
		return false;
	}

	//if (pos7==''){
	//	alert ('Non e\' stato inserito il libero, quindi nessun Libero entrer� in campo nella partita')
	//	return false;
	//}
	//if (battpos1==''){
	//	alert ('Non e\' stata selezionata alcun tipo di battuta per il Posto 4, Inseriscine almeno una')
	//	return false;
	//}
	//if (battpos2==''){
	//	alert ('Non e\' stata selezionata alcun tipo di battuta per il Posto 3, Inseriscine almeno una')
	//	return false;
	//}
	//if (battpos3==''){
	//	alert ('Non e\' stata selezionata alcun tipo di battuta per il Posto 2, Inseriscine almeno una')
	//	return false;
	//}
	//if (battpos4==''){
	//	alert ('Non e\' stata selezionata alcun tipo di battuta per il Posto 5, Inseriscine almeno una')
	//	return false;
	//}
	//if (battpos5==''){
	//	alert ('Non e\' stata selezionata alcun tipo di battuta per il Posto 6, Inseriscine almeno una')
	//	return false;
	//}
	//if (battpos6==''){
	//	alert ('Non e\' stata selezionata alcun tipo di battuta per il Posto 1, Inseriscine almeno una')
	//	return false;
	//}
	//if (pos9==''){
	//	//alert ('Non e\' stato messo nessun giocatore come Sostituto 3, verra\' inserito un giocatore primavera a sostituzione.')
	//}
	//if (pos10==''){
	//	//alert ('Non e\' stato messo nessun giocatore come Sostituto 4, verra\' inserito un giocatore primavera a sostituzione.')
	//}
	//if (pos11==''){
	//	//alert ('Non e\' stato messo nessun giocatore come Sostituto 5, verra\' inserito un giocatore primavera a sostituzione.')
	//}
	//if (pos12==''){
	//	//alert ('Non e\' stato messo nessun giocatore come Sostituto 6, verra\' inserito un giocatore primavera a sostituzione.')
	//}
	//	alert('OK');
	document.imposta_form.flag_match.value=1;
	document.imposta_form.action='./index.php?main=REGFRMZNZ';
	document.imposta_form.submit();
}
function visualgruppo(idgruppo,idtorneo){
	document.viscopparoundrobin.guppoid.value=idgruppo;
	document.viscopparoundrobin.action='./index.php?main=VSLCPRR2&id='+idtorneo;
	document.viscopparoundrobin.submit();
	return true;
}
//function visualgruppo_naz(idgruppo,idtorneo){
//	document.viscopparoundrobin.guppoid.value=idgruppo;
//	document.viscopparoundrobin.action='./index.php?main=VCPRRNAZ&id='+idtorneo;
//	document.viscopparoundrobin.submit();
//	return true;
//}
function set_trainingnaz(step){
	if(step=='forma'){
//		flag_pre = document.getElementById("ritiropre").checked;
		//		if (document.training.intensita.value==''){
		//			alert('Impostare l\'intensita\' dell\'allenamento ');
		//			return false;
		//		}
//		if (flag_pre==true){
//			if (document.training.ggpre.value==''){
//				alert('Se si e\' impostato di volere fare il ritiro impostare il numero dei giorni');
//				return false;
//			}
//		}else{
//			flag_camp = document.getElementById("ritirocamp").checked;
//			if (flag_camp==true){
//				if (document.training.ggcamp.value==''){
//					alert('Se si e\' impostato di volere fare il ritiro impostare il numero dei giorni');
//					return false;
//				}
//			}
//		}
		document.training.hiddenval.value=step;
		document.training.action='./index.php?main=STTRNNG';
		document.training.submit();
	}
	//documen
}
function operazformaz(chiave,operazione){
	if (operazione=='cancella') {
		document.imposta_form.id_formaz.value=chiave;
		document.imposta_form.operazione.value=operazione;
		document.imposta_form.action='./index.php?main=OPRZFRMZ';
		document.imposta_form.submit();	
	} else if(operazione=='modifica'){
		//deprecated
		nuovonome=prompt('Inserisci il nuovo nome della formazione ','');
		if (nuovonome==''){
			alert('attenzione! inserire un dato!');
			return false;
		}
		document.imposta_form.testo_formaz.value=nuovonome;
		document.imposta_form.id_formaz.value=chiave;
		document.imposta_form.operazione.value=operazione;
		document.imposta_form.action='./index.php?main=OPRZFRMZ';
		document.imposta_form.submit();
	}else if(operazione=='carica'){
		document.imposta_form.id_formaz.value=chiave;
		document.imposta_form.action='./index.php?main=FRMAZ';
		document.imposta_form.submit();
	}			
}	
function impostaformazmatch(casatras,idpartita,idtorneo){
	document.partite.id_partita.value=idpartita;
	document.partite.id_torneo.value=idtorneo;
	document.partite.casatras.value=casatras;
	document.partite.action='./index.php?main=SVFRMZGG';
	document.partite.submit();
	
}	
function coppa_cont_naz(){
	document.crea_coppa.tipo_coppa.value = 'cont';
	document.crea_coppa.action='./index.php?main=CRCPPNZ';
	document.crea_coppa.submit();
	return true;
}
function coppa_mondiale_naz(){
	document.crea_coppa.tipo_coppa.value = 'mondiale';
	document.crea_coppa.action='./index.php?main=CRCPPNZ';
	document.crea_coppa.submit();
	return true;
}
function amichevoli_nazionali(){
	document.crea_coppa.tipo_coppa.value = 'am_nazionale';
	document.crea_coppa.action='./index.php?main=LBCPPNZ';
	document.crea_coppa.submit();
	return true;
}
function coppa_club_naz(){
	//crea_coppa
	document.cont_coppa.tipo_coppa.value = 'clubnaz';
	document.cont_coppa.action='./index.php?main=CONTCPPNZ';
	document.cont_coppa.submit();
	return true;
}
function coppaplayoff(){
	//crea_coppa
	document.cont_coppa.tipo_coppa.value = 'playoff';
	document.cont_coppa.action='./index.php?main=CONTCPPNZ';
	document.cont_coppa.submit();
	return true;
}
function elaboracoppa2(){
	//crea_coppa
	//alert('ciao');
	document.elaboracoppaform2.action='./index.php?main=CONTCPP3';
	document.elaboracoppaform2.submit();
	return true;
}
function elaboracoppa3(){
	//crea_coppa
//	alert('ciao');
if (document.comp_manuale.datago.value=='yyyymmdd'){
	alert('impostare data');
	return false;
}
	document.comp_manuale.action='./index.php?main=CONTCPP4';
	document.comp_manuale.submit();
	return true;
}

function coppa_club(){
	document.cont_coppa.tipo_coppa.value = 'contclub';
	document.cont_coppa.action='./index.php?main=CONTCPPNZ';
	document.cont_coppa.submit();
	return true;
}
function coppa_nazionali(){
	document.cont_coppa.tipo_coppa.value = 'nazionali';
	document.cont_coppa.action='./index.php?main=CONTCPPNZ';
	document.cont_coppa.submit();
	return true;
}
function gocoppa(){
	//document.cont_coppa.tipo_coppa.value = 'nazionali';
	document.cont_coppa.action='./index.php?main=CONTCOPPA2';
	document.cont_coppa.submit();
	return true;
	
}
function bilanci_commiss(){
	//document.cont_coppa.tipo_coppa.value = 'nazionali';
	document.bilancicommiss.action='./index.php?main=VISBILANC';
	document.bilancicommiss.submit();
	return true;
	
}
function verifica_cambio(id_giocatore){
	msg = "Sei sicuro di volere Cambiare il Ruolo al giocatore?";
	if (confirm(msg)){
		msg2 = "Il giocatore perder� TUTTO il suo Adattamento, e l\'operazione non � Reversibile, Continuare?";
		if (confirm(msg2)){
			document.formcambioruolotesserati.idgiocatore.value=id_giocatore;
			document.formcambioruolotesserati.action='./index.php?main=DOCHNGRLO';
			document.formcambioruolotesserati.submit();
			return;
		}
	}
}
function resign_lavoro() {
	//alert ('dddd');
	msg = "Sei sicuro di volerti dimettere?";
	if (confirm(msg)){
		//verpwd=prompt('Inserisci la tua password per confermare le dimissioni, ATTENZIONE l\'operazione NON e\' reversibile!');
		document.accrif_lavoro.accrif.value='resign';
	//	document.accrif_lavoro.pwdctr.value=verpwd;
		document.accrif_lavoro.action='./index.php?main=CCRFLAV';
		document.accrif_lavoro.submit();
		return;
	}


	//	alert(document.accetta_lavoro.accetta.value);
	//	alert(document.accetta_lavoro.rifiuta.value);
}
function propose_lavoro() {
	//alert ('dddd');
	msg = "Sei sicuro di volerti proporre per questa squadra? le possibilit� di proporsi sono limitate...";
	if (confirm(msg)){
		document.accrif_lavoro.accrif.value='propose';
		document.accrif_lavoro.action='./index.php?main=CCRFLAV';
		document.accrif_lavoro.submit();
		return;
	}


	//	alert(document.accetta_lavoro.accetta.value);
	//	alert(document.accetta_lavoro.rifiuta.value);
}
function loadtipotatt(){
	msg = "La tattica di gioco verr� cambiata, vuoi continuare? Ricordati di verificare le posizioni dei giocatori, onde evitare Fuori-ruolo...";
	if (confirm(msg)){
//		document.accrif_lavoro.accrif.value='propose';
		document.imposta_form.action='./index.php?main=FRMAZ';
		document.imposta_form.submit();
		return;
	}
	
}
function loadtipotatt_naz(){
	msg = "La tattica di gioco verr� cambiata, vuoi continuare? Ricordati di verificare le posizioni dei giocatori, onde evitare Fuori-ruolo...";
	if (confirm(msg)){
//		document.accrif_lavoro.accrif.value='propose';
		document.imposta_form.action='./index.php?main=FRMNAZ';
		document.imposta_form.submit();
		return;
	}
	
}
function carica_vecchformaz(){
	msg = "Sei sicuro di voler caricare una vecchia formazione?";
	if (confirm(msg)){
//		document.accrif_lavoro.accrif.value='propose';
		document.imposta_form.action='./index.php?main=FRMAZ';
		document.imposta_form.submit();
		return;
	}
	
}
function carica_vecchformaz_sos(){
	msg = "Sei sicuro di voler caricare una vecchia formazione?";
	if (confirm(msg)){
//		document.accrif_lavoro.accrif.value='propose';
		document.imposta_form.action='./index.php?main=FRMAZEGY';
		document.imposta_form.submit();
		return;
	}
	
}
function carica_vecchformaz_naz(){
	msg = "Sei sicuro di voler caricare una vecchia formazione?";
	if (confirm(msg)){
//		document.accrif_lavoro.accrif.value='propose';
		document.imposta_form.action='./index.php?main=FRMNAZ';
		document.imposta_form.submit();
		return;
	}
	
}

function deleteproposta(utente1,squadra1){
	//ction cari1ca_vecchformaz(){
	//alert(utente1);
	msg = "Sei sicuro?";
	if (confirm(msg)){
//		document.accrif_lavoro.accrif.value='propose';
		document.chkpropsqd.utente.value=''+utente1+'';
		document.chkpropsqd.squadra.value=squadra1;
		document.chkpropsqd.action='./index.php?main=PRPSQDACT';
		document.chkpropsqd.submit();
		return;
	}
}
function visualgruppo_naz(idgruppo,idtorneo){
	document.viscopparoundrobinnaz.gruppoid.value=idgruppo;
	document.viscopparoundrobinnaz.action='./index.php?main=VSLCPRRNZ2&id='+idtorneo;
	document.viscopparoundrobinnaz.submit();
	return true;
}
function visualturno(idgruppo,idtorneo){
	document.viscopparoundrobin.guppoid.value=idgruppo;
	document.viscopparoundrobin.action='./index.php?main=VSLCPTF&id='+idtorneo;
	document.viscopparoundrobin.submit();
	return true;
}
function visualturno_naz(idgruppo,idtorneo){
	document.viscopparoundrobinnaz.gruppoid.value=idgruppo;
	document.viscopparoundrobinnaz.action='./index.php?main=VSLCPTFNZ&id='+idtorneo;
	document.viscopparoundrobinnaz.submit();
	return true;
}
function risp_msg(tipo_oper,idmsg){
	msg = "Sei sicuro di voler procedere con l'operazione?";
	if (confirm(msg)){
//		switch(tipo_oper){
//			case 'rispondi'
				document.messaggi.action='./index.php?main=TBGGR&opzmess='+tipo_oper+'&idmess='+idmsg+'';
				document.messaggi.submit();
				return;
//			break;
//			case 'cancella'
//			break;
//			case 'segnala'
//			break;
//			case 'ins_nuovo'
//			break;
	//	}
	}
}
function viscrcpart(){
	document.crcformazutenti.action='./index.php?main=VISFRMZ';
	document.crcformazutenti.submit();
	return;
}
function palazzetto_negozio(){
	//alert('cao');
	
		//alert('cao1');
		document.modpalazzetto.azione.value='palazzetto_negozio';
		//alert('cao2');
		document.modpalazzetto.action='./index.php?main=NEGPLZZTT';
		//alert(document.modpalazzetto.action);
		document.modpalazzetto.submit();
		return true;
}
function palazzetto_build(){
	//alert('cao');
		//alert('cao1');
		document.modpalazzetto.azione.value='palazzetto_costruisci';
		//alert('cao2');
		document.modpalazzetto.action='./index.php?main=CSTPLZZTT';
		//alert(document.modpalazzetto.action);
		document.modpalazzetto.submit();
		return true;
}
function sposta_gara(fase){
	//alert('cao');
		//alert('cao1');
		if (document.spostagara.cod_torneo.value==''){
			alert('Codice torneo non impostato');
			return false;	
		}
		if (document.spostagara.cod_torneo.value=='0'){
			alert('non si possono spostare amichevoli');
			return false;				
		}
		if (document.spostagara.cod_gara.value==''){
			alert('Codice gara non impostato');
			return false;	
		}
		document.spostagara.azione.value=fase;
		//alert('cao2');
		document.spostagara.action='./index.php?main=SPSTGARA';
		//alert(document.spostagara.azione.value);
		document.spostagara.submit();
		return true;
}

function simula_gara(){
	//alert('cao');
		//alert('cao1');
//		if (document.simulagara.cod_torneo.value==''){
//			alert('Codice torneo non impostato');
//			return false;	
//		}
//		if (document.simulagara.cod_gara.value==''){
//			alert('Codice gara non impostato');
//			return false;	
//		}
//		document.simulagara.azione.value=fase;
//		alert('Work in progress');
		document.simulagara.action='./index.php?main=SMLGARA2';
		//alert(document.spostagara.azione.value);
		document.simulagara.submit();
		return true;
}
var perline = 9;
     var divSet = false;
     var curId;
     var colorLevels = Array('0', '3', '6', '9', 'C', 'F');
     var colorArray = Array();
     var ie = false;
     var nocolor = 'none';

function pickColor(id) {
     	if (!divSet) { setDiv(); }
     	var picker = getObj('colorpicker');     	
		if (id == curId && picker.style.display == 'block') {
			picker.style.display = 'none';
			return;
		}
     	curId = id;
     	var thelink = getObj(id);
     	picker.style.top = getAbsoluteOffsetTop(thelink) + 20;
     	picker.style.left = getAbsoluteOffsetLeft(thelink);     
	picker.style.display = 'block';
     }
function relateColor(id, color) {
     	var link = getObj(id);
     	if (color == '') {
	     	link.style.background = nocolor;
	     	link.style.color = nocolor;
	     	color = nocolor;
     	} else {
	     	link.style.background = color;
	     	link.style.color = color;
	    }
	    eval(getObj(id + 'field').title);
     }
function getObj(id) {
		if (ie) { return document.all[id]; } 
		else {	return document.getElementById(id);	}
	 }
function ctr_form(){
	var str1=document.uffsquad.pickerfield1.value;
	var str2=document.uffsquad.pickerfield2.value;
	var str3=document.uffsquad.pickerfield3.value;
	var str4=document.uffsquad.pickerfield4.value;


	(str1.substr(0,1));
	if (document.uffsquad.pickerfield1.value==''){
			alert('Colore 1 non impostato');
			return false;	
		}
	if (str1.substr(0,1)!='#'){
		alert('Colore 1 non impostato correttamente');
	}
		if (document.uffsquad.pickerfield2.value==''){
			alert('Colore 2 non impostato');
			return false;				
		}
		if (str2.substr(0,1)!='#'){
		alert('Colore 2 non impostato correttamente');
	}
	if (document.uffsquad.pickerfield4.value==''){
			alert('Colore testo non impostato');
			return false;	
		}
		if (str4.substr(0,1)!='#'){
		alert('Colore TESTO non impostato correttamente');
	}
	if (document.uffsquad.pickerfield3.value==''){
			alert('Colore del Libero non impostato');
			return false;	
		}
		if (str3.substr(0,1)!='#'){
		alert('Colore libero non impostato correttamente');
	}
		if (document.uffsquad.tipomagle.checked==''){
			alert('Tipo Maglie non impostato');
			return false;	
		}
		document.uffsquad.azione.value='esegui_cambi';
		//alert('cao2');
		document.uffsquad.action='./index.php?main=UFFPLZZTT';
		//alert(document.spostagara.azione.value);
		document.uffsquad.submit();
		return true;
}
function calcampl(){
	
	document.palazzettosquad.action='./index.php?main=CSTPLZZTT';
	//alert(document.spostagara.azione.value);
	document.palazzettosquad.submit();
	return true;
}
function dobuilt(palazzetto){
	if (document.palazzettosquad.amplposti.value==0){
		alert('Attenzione il numero di posti inserito e zero');
		return false;
	}
	if (document.palazzettosquad.amplposti.value<100){
		alert('Attenzione il numero di posti inserito � minore alla capacit� minima consentita');
		return false;
	}
	msg = "Sei sicuro di voler procedere con l'operazione? l'azione non � reversibile";
	if (confirm(msg)){
		document.palazzettosquad.id_palazzetto.value=palazzetto;
		document.palazzettosquad.action='./index.php?main=CSTPLZZTT2';
		//alert(document.spostagara.azione.value);
		document.palazzettosquad.submit();
		return true;
	}
}
function assumi_staff() {
	document.hire_staff.action='./index.php?main=STFH';
	document.hire_staff.submit();
	return true;
}
function hire_conf(){
		msg = "Sei sicuro di voler procedere con l'operazione?";
	if (confirm(msg)){
		document.hirestaff.action='./index.php?main=STFH2';
		document.hirestaff.submit();
		return true;
	}
}
function massagg(){
		msg = "Sei sicuro di voler procedere con l'operazione?";
	if (confirm(msg)){
		document.massaggiatore.action='./index.php?main=ALLMSG2';
		document.massaggiatore.submit();
		return true;
	}
}
function ass_conn(tipo) {
	if (tipo=='usersosp'){
		document.user_sosp.action='./index.php?main=USRSPS';
		document.user_sosp.submit();
		return true;
	}else if (tipo=='assconnip'){
		document.ipassconn.action='./index.php?main=IPSSCNN';
		document.ipassconn.submit();
		return true;
	}
}
function set_investimento(step){
	msg = "Sei sicuro di voler procedere con l'operazione?";
	if (confirm(msg)){
		document.primavera.hiddenval.value=step;
		document.primavera.action='./index.php?main=STTRNNG';
		document.primavera.submit();
		return true;
	}
}
function svinc_gioc_prim(){
	if(confirm('SEI SICURO DI VOLERTI DISFARE DEL GIOCATORE? UNA VOLTA LICENZIATO NON SI PUO TORNARE INDIETRO, VUOI CONTINUARE?????')){
		document.opz_giocatore_primavera.opzione.value = 'svincolap';
		document.opz_giocatore_primavera.action='./popup.php?main=GCSLFP';//./giocatore_self.php';
		document.opz_giocatore_primavera.submit();
		return true;
	}else{
		return false;
	}
}
function set_allpsy(){
	msg = "Sei sicuro di voler procedere con l'operazione?";
	if (confirm(msg)){
		//document.allpsycologo.hiddenval.value=step;
		document.allpsycologo.action='./index.php?main=ALLPSY2';
		document.allpsycologo.submit();
		return true;
	}
}
function licenzia_staff(tipolic){
	msg = "Sei sicuro di voler procedere con l'operazione? Perderai tutte le impostazioni! inoltre pagherai una penale di 5M";
	if (confirm(msg)){
		document.hire_staff.tipo_lic.value=tipolic;
		document.hire_staff.action='./index.php?main=STFFLIC';
		document.hire_staff.submit();
		return true;
	}
}
function prom_gioc_prim(){
	msg = "Sei sicuro di voler procedere con l'operazione?";
	if (confirm(msg)){
		document.opz_giocatore_primavera.opzione.value = 'promprim';
		document.opz_giocatore_primavera.action='./popup.php?main=GCSLFP';
		document.opz_giocatore_primavera.submit();
		return true;
	}
}
function cura_gioc(id_gioca){
	msg = "Sei sicuro di voler procedere con l'operazione?";
	if (confirm(msg)){
		document.infer.id_gioc.value = id_gioca;
		document.infer.action='./index.php?main=NFRMC';
		document.infer.submit();
		return true;
	}
}
function soprannome(){
		msg = "Il numero massimo di caratteri assegnabili � di 12, ogni soprannome ritenuto offensivo o ritenuto poco opportuno verra rimosso e potrebbe essere sanzionabile, vuoi continuare?";
	if (confirm(msg)){
		//sopr=prompt('Il numero massimo di caratteri assegnabili � di 12','ATTENZIONE! ogni soprannome ritenuto offensivo o ritenuto poco opportuno verra rimosso e potrebbe essere sanzionabile');
		//return false;
		//document.opz_giocatore_self.soprann.value=sopr;
		document.opz_giocatore_self.opzione.value = 'soprannome';
		document.opz_giocatore_self.action='./popup.php?main=GCSLF';
		document.opz_giocatore_self.submit();
		return true;
	}
}
function conf_latlong(){
	document.latlong.action='./index.php?main=INSLALO';
	document.latlong.submit();
	return true;
}
function conf_citta(){
	document.cittaconf.action='./index.php?main=CHCTT';
	document.cittaconf.submit();
	return true;
}
function chngnome(){
	document.opz_giocatore_primavera.action='./popup.php?main=CNGNOME';
	document.opz_giocatore_primavera.submit();
	return true;
}
function chngnome2(){
	alert('Il nome del giocatore dovr� essere confermato dalla FEDERAZIONE, nomi offensivi o assurdi potrebbero essere passabili di multa')
	document.cambioname.action='./popup.php?main=GCSLFP';;
	document.cambioname.submit();
	return true;
}
function controllaoperadmin(azzione) {
	//alert ('dddd');
	msg = "Sei sicuro di volere procedere?";
	if (confirm(msg)){
		document.operazammini.azzionne.value=azzione;
		document.operazammini.action='./index.php?main=OPRZDMN2';
		document.operazammini.submit();
		return;
	}


	//	alert(document.accetta_lavoro.accetta.value);
	//	alert(document.accetta_lavoro.rifiuta.value);
}
function insertcup() {
	//alert ('dddd');
	msg = "Sei sicuro di volere procedere?";
	if (confirm(msg)){
	//	document.bachecca.azzionne.value=azzione;
		document.bachecca.action='./index.php?main=NSRTCPP2';
		document.bachecca.submit();
		return;
	}


	//	alert(document.accetta_lavoro.accetta.value);
	//	alert(document.accetta_lavoro.rifiuta.value);
}
function crea_torneo(){
	if (document.creatorneo.nsquadre.value<4){
		alert('Hai scelto meno di 4 squadre selezionane almeno 4 e riprova');
		return false;
	}
	
	if (document.creatorneo.nsquadre.value>16){
		alert('Hai scelto piu di 16 squadre selezionane almeno 16 e riprova');
		return false;
	}
	document.creatorneo.action='./index.php?main=CRATRN2';
	document.creatorneo.submit();
	
}
function crea_part(val,id){
	if (val=='crea'){
		document.partite.part.value='A';
		document.partite.action='./index.php?main=CRATRN3';
		document.partite.submit();
	}else if (val=='canc'){
		if (id==0){
			alert('nessuna partita selezionata, riprova');
			return false;
		}else{
			document.partite.part.value=id;
			document.partite.action='./index.php?main=CRATRN3';
			document.partite.submit();			
		}
	}else{
		msg = "Sei sicuro di volere chiudere il torneo? Non potrai piu organizzare altre partite";
		if (confirm(msg)){
			document.partite.part.value='B';
			document.partite.action='./index.php?main=CRATRN3';
			document.partite.submit();
		}
	}
}
function cerca_matches(){
	if (document.cerca_match.data.value==''){
		alert('Inserisci la Data');
		return false;
	}
	document.cerca_match.action='./index.php?main=AWED';
	document.cerca_match.submit();
}
function cerca_matches_schedina(){
	if (document.cerca_match.data.value==''){
		alert('Inserisci la Data');
		return false;
	}
	document.cerca_match.action='./index.php?main=CRASCH';
	document.cerca_match.submit();
}
function compila_sch(){
	document.cerca_match.action='./index.php?main=CRASCH2';
	document.cerca_match.submit();
}
function conf_schedina(){
	document.schedina.action='./index.php?main=GCSCH2';
	document.schedina.submit();
}
function crea_part_wl(val,id){
	if (val=='crea'){
		document.partite.part.value='A';
		document.partite.action='./index.php?main=CRAWL2';
		document.partite.submit();
	}else if (val=='canc'){
		if (id==0){
			alert('nessuna partita selezionata, riprova');
			return false;
		}else{
			document.partite.part.value=id;
			document.partite.action='./index.php?main=CRAWL2';
			document.partite.submit();			
		}
	}else{
		msg = "Sei sicuro di volere chiudere il torneo? Non potrai piu organizzare altre partite";
		if (confirm(msg)){
			document.partite.part.value='B';
			document.partite.action='./index.php?main=CRAWL2';
			document.partite.submit();
		}
	}
}
function visualgruppo_naz_wl(idgruppo,idtorneo){
	document.coppa.gruppoid.value=idgruppo;
	document.coppa.action='./index.php?main=VSLCPRRNZ2&id='+idtorneo;
	document.coppa.submit();
	return true;
}
function set_allpsynz(){
	msg = "Sei sicuro di voler procedere con l'operazione?";
	if (confirm(msg)){
		//document.allpsycologo.hiddenval.value=step;
		document.allpsycologo.action='./index.php?main=ALLPSYNZ2';
		document.allpsycologo.submit();
		return true;
	}
}
function massaggnaz(){
		msg = "Sei sicuro di voler procedere con l'operazione?";
	if (confirm(msg)){
		document.massaggiatore.action='./index.php?main=ALLMSGNZ2';
		document.massaggiatore.submit();
		return true;
	}
}
function resign_lavoro_naz() {
	//alert ('dddd');
	msg = "Sei sicuro di volerti dimettere?";
	if (confirm(msg)){
		//verpwd=prompt('Inserisci la tua password per confermare le dimissioni, ATTENZIONE l\'operazione NON e\' reversibile!');
		document.accrif_lavoronaz.accrif.value='resign';
	//	document.accrif_lavoronaz.pwdctr.value=verpwd;
		document.accrif_lavoronaz.action='./index.php?main=CCRFLAVNZ';
		document.accrif_lavoronaz.submit();
		return;
	}


	//	alert(document.accetta_lavoro.accetta.value);
	//	alert(document.accetta_lavoro.rifiuta.value);
}
function loadtipotatt_sos(){
	msg = "La tattica di gioco verrï¿½ cambiata, vuoi continuare? Ricordati di verificare le posizioni dei giocatori, onde evitare Fuori-ruolo...";
	if (confirm(msg)){
//		document.accrif_lavoro.accrif.value='propose';
		document.imposta_form.action='./index.php?main=FRMAZEGY';
		document.imposta_form.submit();
		return;
          }
}
function svuota_short(){
msg = "ATTENZIONE! procedendo con l\' operazione tutta la tua shortlist verra\' svuotata! sei sicuro di voler procedere? L'\azione non e\'  reversivile!";
	if (confirm(msg)){
		document.formshort.action='./index.php?main=ALLUNSHRT';
		document.formshort.submit();
		return;
}else{return false;}
}
function svuota_short_naz(){
msg = "ATTENZIONE! procedendo con l\' operazione tutta la tua shortlist verra\' svuotata! sei sicuro di voler procedere? L'\azione non e\'  reversivile!";
	if (confirm(msg)){
		document.formshort.action='./index.php?main=ALLUNSHRTN';
		document.formshort.submit();
		return;
}else{return false;}
}
	