﻿// Fichier JavaScript

var angle=0;
var timer;
var FlgDefilement = "Non";

function Affichage ()
{	
    for(i=1;i<15;i++)
    {
	var Gauche = 200+300*(Math.cos(angle+i*Math.PI/6));
        document.getElementById("i"+i).style.left=Gauche+"px";
	var Hauteur = 10+50*(Math.sin(angle+i*Math.PI/6))+
    document.getElementById("i"+i).width/2; 
        document.getElementById("i"+i).style.top=Hauteur*i/8+"px";
        agl=angle+i*Math.PI/6;
        document.getElementById("i"+i).width=20*(Math.sin(agl))+50;
        document.getElementById("i"+i).style.zIndex=60*(Math.sin(agl))+120;
        document.getElementById("i"+i).style.opacity=(Math.sin(agl)+1)*0.50;
        document.getElementById("i"+i).style.filter="alpha(opacity="+(Math.sin(agl)+1)*50+")";
	    }  
}
function Defilement()
{
    switch (FlgDefilement)
    {
        case "Droite" :
             angle=angle-0.015; // vites defilement
            break;
        case "Gauche" :
             angle=angle+0.015;
            break;            
        default :
            angle=angle;
    }
    Affichage (); 
}
function DefilementDroite()
{
    if (FlgDefilement!="Droite")
    {
        FlgDefilement="Droite";
        timer=setInterval("Defilement()",20);
    }   
}
function DefilementGauche()
{
    if (FlgDefilement!="Gauche")
    {
        FlgDefilement="Gauche";
        timer=setInterval("Defilement()",20);
    }   
}

function ArretDefilement()
{
    clearInterval(timer);
    FlgDefilement="Non";
}

function Lien (LienRedirection)
{
    switch(LienRedirection.id)
    {
        case "i1" :
            document.location="abstrait1/visite.html"
            break;
        case "i2" :
            document.location="abstrait2/visite.html"
            break;
        case "i3" :
            document.location="abstrait3/visite.html"
            break;
        case "i4" :
            document.location="portraits1/visite.html"
            break;
        case "i5" :
            document.location="portraits2/visite.html"
            break;
        case "i6" :
            document.location="insectes/visite.html"
            break;
        case "i7" :
            document.location="animaux/visite.html"
            break;
        case "i8" :
            document.location="sculpture/visite.html"
            break;
        case "i9" :
            document.location="peinture/visite.html"
            break;
        case "i10" :
            document.location="livres/visite.html"
            break;
        case "i11" :
            document.location="fusain/visite.html"        
            break;            
        case "i12" :
			document.location="poemes/visite.html"
			break; 
	    case "i13" :
			document.location="chansons/visite.html"	
			break; 
		case "i14" :
			document.location="contact/visite.html"
            break;
    }
}