
// VARIABILI GLOBALI PLAY/STOP, DIMENSIONI SWF
var globalaudio = "globalaudio";

// FUNZIONI DI GESTIONE COOKIES
function getCookie( name ){
	var oCookie = document.cookie;
	if( !oCookie ) return null;
    var iS = oCookie.indexOf( name+'=' );
    if( iS==-1 ) return null;
    iS += name.length+1;
    var iE = oCookie.indexOf( ';', iS );
    if( iE==-1) iE = oCookie.length;
    return unescape( oCookie.substring(iS, iE) );
}
function setCookie( name, value ){
    if( value!=null && value!="" ) document.cookie = name+"="+escape( value );
}

// GESTIONE PAGINA
function go(){
	
	var p = getCookie( nomepagina );
	var g = getCookie( globalaudio );
	var pathSWF = nomepagina;
	
	p = (!p)?  1 : Number(p)
	
	if( g!='1' ){
		switch( p ){
			case 2:		pathSWF = nomepagina+'-back';	break;
			case 3:		pathSWF = 'globalback';			break;
			case 4:		pathSWF = 'noaudio';			break;
		}
	}
	//INIZIO CONTENUTO PER LA PRIMA VOLTA NELLA PAGINA		
	if( pathSWF!='' && g!='2' ){
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#3,0,0,0" ');
		document.write('width="'+swfWidth+'" height="'+swfHeight+'" id="mainMovie">')
		document.write('<param name="SRC" value="'+pathSWF+'.SWF">')
		document.write('<param name="BGCOLOR" value="#FFFFFF">')
		document.write('<embed name="mainMovie" src="'+pathSWF+'.SWF" pluginspage="http://www.macromedia.com/shockwave/download/" type="application/x-shockwave-flash" ');
		document.write('width="'+swfWidth+'" height="'+swfHeight+'" bgcolor="#FFFFFF">')
		document.write('</embed>')
		document.write('</object>')
		
		if( p<4 ) setCookie( nomepagina, p+1 );
	}
	
}
go();
					
//FUNZIONE PER CAMBIARE LA RIPRODUZIONE DEL FILE IN CORSO					
function chiamaMetodo(lev, mov) {
	var IE = navigator.appName.indexOf("Microsoft") != -1;
	var filmato = IE ? window.mainMovie : window.document.mainMovie;
	filmato.LoadMovie( lev, mov );
}

//FUNZIONE RESET
function reset(){
	setCookie( nomepagina,null );
	setCookie( globalaudio,null );
	window.location.reload();
}

//FUNZIONE DISATTIVA AUDIO
function disattiva(){
	if( getCookie( nomepagina )!='4' ){
		setCookie( nomepagina, '4' );
		window.location.reload();
	}
}



