
 	var stile = "top=10, left=10, width=720, height=370, status=no, menubar=no, toolbar=no scrollbar=no resize=no ";
    function Popup(apri) {
    	//alert (apri);
        window.open(apri, "", stile);
     }
    
    function addP(id){
    	
    	if (confirm("Desideri aggiungere la  foto?")){
    		var str =  document.form.photoToAdd.value;
    		var array = str.split("\\");
    	   		
    		if ( array[array.length-1].lastIndexOf("'") != -1){
    	  			alert ("Il nome file contiene un accento!!!! cambia il nome del file." );
    	  			return;
    		}
    	document.getElementById("operationPhoto").value="add";
    	document.form.id.value=id;
    	document.form.submit()
    	}
    }
    function addV(id){
    	
    	if (confirm("Desideri aggiungere un video?")){
    		var str =  document.form.videoToAdd.value;
    		var array = str.split("\\");
    	
    		
    		if ( array[array.length-1].lastIndexOf("'") != -1){
    	  			alert ("Il nome file contiene un accento!!!! cambia il nome del file." );
    	  			return;
    		}
    	document.form.operationVideo.value="add";
    	document.form.id.value=id;
    	document.form.submit()
    	}
    }
function aggiornaVideo(id){
    	
    	if (confirm("Desideri aggiornare il video?")){
    		var str =  document.form.videoToAdd.value;
    		var array = str.split("\\");
    	
    		
    		if ( array[array.length-1].lastIndexOf("'") != -1){
    	  			alert ("Il nome file contiene un accento!!!! cambia il nome del file." );
    	  			return;
    		}
    	document.form.operationVideo.value="update";
    	document.getElementById("ordinamentoVideo"+id);
    	//alert("ordinamentoVideo"+id);
    	//alert(document.getElementById("ordinamentoVideo"+id));
    	document.form.ordinamentoVideo.value = document.getElementById("ordinamentoVideo"+id).value;
    	document.form.idVideo.value=id;
    	document.form.submit()
    	}
    }

function aggiornaFoto(id){
	
	if (confirm("Desideri aggiornare la foto?")){
		
	
	document.form.operationFoto.value="update";
	document.getElementById("ordinamentoFoto"+id);
	//alert("ordinamentoVideo"+id);
	//alert(document.getElementById("ordinamentoVideo"+id));
	document.form.ordinamentoFoto.value = document.getElementById("ordinamentoFoto"+id).value;
	document.form.idFoto.value=id;
	document.form.submit()
	}
}
	function cancVideo(idVideo){
	if (confirm("Eliminare il video ?")) {
		document.form.operationVideo.value="del";
		document.form.idVideo.value=idVideo;
		document.form.submit();
    }
}
    function cancImmagineDefault(id,img,idMovie){
    	if (confirm("Eliminare l\'immagine \'"+img+"\'?")) {
    		document.form.del.value=id;
    		document.form.img.value=img;
    		//document.form.id.value=idMovie;
    		document.form.submit();
        }
    }
    
    function cancOneImg(id){
    	if (confirm("Eliminare l\'immagine ?")) {
    		document.form.del.value='yes';
    		document.form.id.value=id;
    		document.form.submit();
        }
    }
   /* function cancOneImg(id,index){
    	if (confirm("Eliminare l\'immagine ?")) {
    		document.form.del.value='yes';
    		document.form.id.value=id;
    		document.form.index.value=index;
    		document.form.submit();
        }
    }*/
    function cancmov(id,img,campo){
    	if (confirm("Eliminare il video \'"+img+"\'?")) {
    		document.form.delmov.value=id;
    		document.form.img.value=img;
    		document.form.campo.value=campo;
    		//document.form.id.value=id;
    		document.form.submit();
        }
    }
    function cancpres(id,img,campo){
    	if (confirm("Eliminare il pressbook \'"+img+"\'?")) {
    		document.form.delpres.value=id;
    		document.form.pres.value=img;
    		document.form.campo.value=campo;
    		
    		document.form.submit();
        }
    }
    function vaiAttori(){
    	Tipo=document.form.Tipo.value;
    	Lettera=document.form.lettera.value;
    	if(Tipo==""){
    		alert("Scegli una categoria!");
    		document.form.Tipo.focus();
    	}else{
    		if(Tipo=="Regista") location.href="/lista_registi/"+Lettera+"/";
    		if(Tipo=="Attore") location.href="/lista_attori/"+Lettera+"/";
    		if( Tipo=="Attrice") location.href="/lista_attrici/"+Lettera+"/";
    		if(Tipo=="Film") location.href="/lista_films/"+Lettera+"/";
    		if(Tipo=="Personaggio") location.href="personaggi.php?lettera="+Lettera;
    	}
    }
    function aggiungiFilmBozza(){
       	parameter={ titolo:$('#ID_film').val(),
    				act:1
    			
    	}; 
       	$.post("new_film_breve_bozza.php",parameter,  function(data){
    		if (data != 'ko'){
    			alert ("Film aggiunto corretamente!");
    			var tmp = $('#ID_film').val();
    			$('#IDFILM').val(data);
    			$('#addFilm').hide()
    			
    		}
    		
    		else ("Errore Generico");
       	});
    	
    	
    }
    
    
    // scatta foto sito .
    function salvaCopertina(){
       	parameter={ dataType: 'json'};
       		

       	
       	
       	$.post("./storico.php",parameter,  function(data){
       		var ret = jQuery.parseJSON(data);
    		if (ret.esito == "OK"){
    			alert ("Copertina salvata con successo");
    		}
    		else alert ("Errore generico.");
    	
       	
       	});
    	
    }
