// JavaScript Document

///////////////////////////
//
// DIAPORAMA
//
///////////////////////////

function taille_fenetre(){
	
	/* vers le div qui se redimensionne */
	this.div = new Array();
	this.largeur = 0;
	this.hauteur = 0;
	
	/* Tableau */
	this.insert = function ( num , value ){
		this.div[num] = [value];
	}
	
	this.largeur_fenetre = function (){
		 if (window.innerWidth){
			 this.largeur = window.innerWidth;
		 } else if (document.body && document.body.offsetWidth){
			 this.largeur = document.body.offsetWidth;
		 } 
	}
	
	this.hauteur_fenetre = function (){
	 	if (window.innerHeight){
		 	this.largeur = window.innerHeight  ;
		}else if (document.body && document.body.offsetHeight){
			this.largeur = document.body.offsetHeight;
	 	}
	}

	
	/* Redimensionnement */
	this.redimensionne = function () {
		if (window.innerWidth){
			 this.largeur = window.innerWidth;
		 } else if (document.body && document.body.offsetWidth){
			 this.largeur = document.body.offsetWidth;
		 } 
		 
		 if (window.innerHeight){
		 	this.hauteur = window.innerHeight  ;
		}else if (document.body && document.body.offsetHeight){
			this.hauteur = document.body.offsetHeight;
			
	 	}
		
		document.getElementById(this.div[ 0 ]).style.width = document.getElementById(this.div[ 1 ]).style.width = this.largeur+"px" ; 
			document.getElementById(this.div[ 0 ]).style.height = document.getElementById(this.div[ 1 ]).style.height = ( document.getElementById(this.div[ 0 ]).offsetWidth*0.74 )+"px" ;
			
			if ( document.getElementById(this.div[ 0 ]).offsetHeight < this.hauteur ) {
				
				document.getElementById(this.div[ 0 ]).style.height = document.getElementById(this.div[ 1 ]).style.height = this.hauteur+"px" ;
				document.getElementById(this.div[ 0 ]).style.width = document.getElementById(this.div[ 1 ]).style.width = ( document.getElementById(this.div[ 0 ]).offsetHeight *1.33 )+"px" ;
				document.getElementById(this.div[ 0 ]).style.marginTop = document.getElementById(this.div[ 1 ]).style.marginTop = "0px";
				

			}else {
				document.getElementById(this.div[ 0 ]).style.marginTop = document.getElementById(this.div[ 1 ]).style.marginTop = (this.hauteur-document.getElementById(this.div[ 0 ]).offsetHeight)+"px";
			}
		
	}
		
}
