/* Variables */

var is = new Is(); // Var de test du navigateur
var doc ; // Var de prefixe d'appel des objets
var sty ; // Var de suffixe pour le style
var htm ; // 
var available_width ; // largeur de fenetre
var available_width ; // hauteur de fenetre
var ballon ; // the ball yeah 
var i ;

/* Code d'assignement pour les variables doc sty et htm en fonction du navigateur */

if(is.ns4) {
    doc = "document";
    sty = "";
    htm = ".document"
} else if(is.ie4) {
    doc = "document.all";
    sty = ".style";
    htm = ""
}


/* Fonctions */
/* Objet Is de test du navigateur */

function Is() {
    var agent = navigator.userAgent.toLowerCase();
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);
    this.ns  = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1)));
    this.ns2 = (this.ns && (this.major == 2));
    this.ns3 = (this.ns && (this.major == 3));
    this.ns4b = (this.ns && (this.minor < 4.04));
    this.ns4 = (this.ns && (this.major >= 4));
    this.ie   = (agent.indexOf("msie") != -1);
    this.ie3  = (this.ie && (this.major == 2));
    this.ie4  = (this.ie && (this.major >= 4));
    this.op3 = (agent.indexOf("opera") != -1);
    this.win   = (agent.indexOf("win")!=-1);
    this.mac   = (agent.indexOf("mac")!=-1);
    this.unix  = (agent.indexOf("x11")!=-1);
}

function go(){
	if (is.ns4) {
   		window.resizeTo(screen.availWidth,screen.availHeight);
        available_width=innerWidth;
        available_height=innerHeight;
    } 
	else if(is.ie4) {
       	window.resizeTo(screen.availWidth,screen.availHeight);
        available_width=document.body.clientWidth;
        available_height=document.body.clientHeight;

}
i =  available_width - 200;
ballon = eval(doc+'["l1"]'+sty) 
ballon.left = available_width - 200;
animate() ;
}

function animate(){
if(i>-100){
	ballon.left = i ;
	i -= 15 ;
	var o = new rebond(i) ;
	ballon.top = o.y ;
	setTimeout("animate();",1) ;
}
}
function rebond(x){

var chgt = x - parseInt(available_height) ;

this.y = chgt ;
this.y = this.y * 4 *Math.PI ;
this.y = this.y / available_width ;
this.y = Math.sin(this.y) ;
this.y = Math.abs(this.y) ;
this.y = this.y * available_height ;

this.q = Math.abs(chgt) ;
this.q = this.q * 4 ;
this.q = this.q/available_width ; 
this.q = Math.pow(2,this.q) ;

this.y = available_height - 70 - this.y / this.q ;

}