function startFlash(id,url){
	str="";
	str +="<object width='260' height='200'>";
	str +="	<param name='movie' value='+url+'></param>";
	str +="	<param name='allowFullScreen' value='true'></param>";
	str +="	<param name='allowscriptaccess' value='always'></param>";
	str +="	<param name='LOOP' value='false'></param>";
	str +="	<embed src='"+url+"' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' LOOP='false'  width='260' height='200'></embed>";
	str +="</object>";

	document.getElementById(id).innerHTML=str;
	setTimeout("resetFlash('myFlash');",220000);
}

function resetFlash(id){
	document.getElementById(id).innerHTML="<img src='web/images/accademiadanza.png'>";
}



// GESTIONE CAROUSEL 
///////////////////////////////

var slideFlash=0;
var maxSlide=6;
var nSlide=3;
var winPhoto=141;
var margBoxPhoto=10;

var stepPhoto=1;

var posInitPh=10;
var posFinPh=-((winPhoto+margBoxPhoto)*nSlide);
var refTrasl=0;
idInt=setInterval("moveRoll();",7000);
ref=setTimeout("checkArrow();",1000);


function checkArrow(){
	//document.getElementById("arrowNewsL").style.display="inline";
	//document.getElementById("arrowNewsR").style.display="inline";
	if (!document.getElementById("newsflash3")) {
		if (document.getElementById("arrowNewsL")) document.getElementById("arrowNewsL").style.display="none";
		if (document.getElementById("arrowNewsR")) document.getElementById("arrowNewsR").style.display="none";	
	}
}
function moveRoll(){
	if (document.getElementById("NewsRoll")){
		posRoll=document.getElementById("NewsRoll").style.left;
		//alert(posRoll);
		posRoll=posRoll.replace("px","");
		
		if (posRoll==posInitPh){
			nextPos=posFinPh*stepPhoto;
		} else {
			nextPos=posInitPh;
		}
		if (document.getElementById("newsflash3")) {
			
			if (nextPos==posInitPh) verso=0;
			if (nextPos==posFinPh) verso=0;
			//alert(verso);
			traslNewsRoll(nextPos,verso);
			
			//document.getElementById("NewsRoll").style.left=nextPos + "px";
		} 
			
		clearInterval(idInt);
		idInt=setInterval("moveRoll();",10000);
	}
}

function traslNewsRoll(nextPos,verso){
	posRoll=document.getElementById("NewsRoll").style.left;
	//alert(posRoll);
	posRoll=posRoll.replace("px","");
	stop=0;
	if (verso=="1") {
		
		posRoll=posRoll -(-8);
		//alert("a "+posRoll);
	} else {
		
		posRoll=posRoll - 8;
		//alert("b "+posRoll);
	}
	//alert(posRoll);
	myPos=posFinPh*stepPhoto-(-6*(stepPhoto));
	if (posRoll<myPos){
		posRoll=myPos;
		stop=1;
		stepPhoto=stepPhoto+1;
	}
	if (posRoll>posInitPh){
		posRoll=posInitPh;
		stop=1;
		stepPhoto=stepPhoto+1;
	}	
	
	document.getElementById("NewsRoll").style.left=posRoll + "px";
	clearInterval(refTrasl);
	if (stop==0) refTrasl=setInterval("traslNewsRoll("+nextPos+","+verso+");",10);
	if (stepPhoto==3) {
		setTimeout("resetNewsPhoto()",100);
		stepPhoto=1;
	}
	
}

function resetNewsPhoto(){
	document.getElementById("NewsRoll").style.left=posInitPh+"px";

}

/////////////////////////////////////////////////////
/*


ref=setTimeout("openFlash();",1000);
ref2=setTimeout("nextFlash();",5000);

function nextFlash(){

	slideFlash=slideFlash+1;
	checkSlideFlash(slideFlash);

	openFlash();

}	
function previousFlash(){

	slideFlash=slideFlash-1;
	checkSlideFlash(slideFlash);

	openFlash();

}	
function checkSlideFlash(s){
	if (s>maxSlide) slideFlash=0;
	if(!document.getElementById("newsflash"+s)){
		slideFlash=0;
	}
	if (s<0) slideFlash=nSlide-1;

}


function openFlash(){
	for (j=0; j<maxSlide; j++){
		if(oFlash=document.getElementById("newsflash"+j)){
			oFlash.style.display="none";
			nSlide=j+1;
		} 
	}
	//alert(slideFlash);
	document.getElementById("newsflash"+slideFlash).style.display="inline";
	clearTimeout(ref2);
	ref2=setTimeout("nextFlash();",5000);	
	
}
*/

