
var indice=0;
 var immagini = new Array();
 var stat = 1;


function conferma_operazione(url){
 if(confirm("Conferma operazione")){document.location.href=url;}}
 
function array_push(url)
	{
	indice=immagini.length;
	immagini[indice]=url;
	return immagini;
	}


  var stile = "top=10, left=10, width=500, height=300, status=no, menubar=no, toolbar=no scrollbar=no";
     function Popup(apri) {
        window.open(apri, "", stile);
     }

function showpic(img_name,move) {

if(move){
	if(indice>=immagini.length-1)
			{indice=0;}
	else	
			{indice++;}
		}
else{
	if(indice==0)
		{indice=immagini.length-1;}
	else
		{indice--;}
	}
	
document[img_name].src=immagini[indice];
document.getElementById('msg').value=indice;
}
function visualizza(stat){

if(stat){
document.getElementById("show_level").style.visibility='visible'; 
document['show_1'].src=immagini[indice];}
if(!stat)
{document.getElementById('show_level').style.visibility='hidden';
alert(ok);}

}

function toggleT(_w,_h)
{
  
    document.getElementById(_w).style.visibility='visible';
	document.getElementById(_h).style.visibility='hidden';
  
}
function validate_form(id_form)
{var i=10;
var form=document.forms[id_form];
for(i=0; i<=form.elements.length;i++)
	{

	
					if(!form.elements["e_mail"].value.match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/))
			{
			
				alert( 'E_mail non valida');
				
				return false;
			}
			
			if(typeof form.elements["password1"]!='undefined')
			{
				if(!form.elements["password1"].value.match(/[A-Za-z0-9_]{6,}/))
				{
				
					alert( 'La password non puo contenere caratteri di punteggiatura [.*?\! / , etc...]. Immettere una sequenza di almeno 6 caratteri, alfabetici A-Z a-z, numerici 0-9 es(PaSs123)');
					form.elements["password1"].value='';
					form.elements["password2"].value='';
					form.elements['password1'].focus();
					return false;
				}
			}
			if(typeof form.elements["password1"]!='undefined')
			{
				if(form.elements["password1"].value!=form.elements["password2"].value)
					{
					var nome= form.elements[i].name;
						alert( 'I campi password non coincidono');
						form.elements["password1"].value='';
						form.elements["password2"].value='';
						form.elements[password1].focus();
						return false;
					}
			}
			
			
			if((form.elements[i].value==''||form.elements[i].value==null))
			{
			var nome= form.elements[i].name;
			if(nome!='part_iva'&&nome!='cod_fisc'){
				
				alert(nome + ' è vuoto');
				form.elements[i].focus();
				return false;
				}
			}
}
return true;
}

function prova()
{
document.write('prova');
}

function creatediv(id, html, width, height, left, top) {
   var newdiv = document.createElement("div");
   newdiv.setAttribute("id", id);   
   
   if ((left || top) || (left && top)) {
       newdiv.style.position = "absolute";
       
       if (left) {
           newdiv.style.left = left;
       }
       
       if (top) {
           newdiv.style.top = top;
       }
   }   
  
   if (html) {
       newdiv.innerHTML = html;
   } else {
       newdiv.innerHTML = "<a href=punteggi.php?action=disiscrivi&cod_arciere="+id+"&ins=1>DISISCRIVI DALLA GARA</a><br><a href=arcieri.php?mod=1&cod_arciere="+id+">MODIFICA DATI</a><br><a href=#"+id+"_td onClick=\"Javascript: cRemoveElement('"+id+"');\">CHIUDI MENU ARCIERE</a>";
   }
   newdiv.style.background = "#ec6";
   newdiv.style.border = "1px solid #e96";   
   newdiv.style.height = 50;
   newdiv.style.width = 300;
   newdiv.style.margin=0;
   newdiv.style.zIndex=0;
   newdiv.style.clear="both";
   newdiv.style.display="block";
   document.getElementById( id + "_td").appendChild(newdiv);
}

function cRemoveElement(id) {
   var node = document.getElementById(id);
   var removed = node.parentNode.removeChild(node); 
   return removed;
}