// JavaScript Document
function doResize(){	
	var hautimg = document.getElementById('fond').offsetHeight;
	var largimg = document.getElementById('fond').offsetWidth;

	if( typeof( window.innerWidth ) == 'number' ) {
    	//Non-IE
    	larg = window.innerWidth;
    	haut = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		larg = document.documentElement.clientWidth;
		haut = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		larg = document.body.clientWidth;
		haut = document.body.clientHeight;
	}

	document.getElementById('container-fond').style.width = larg + "px";
	document.getElementById('container-fond').style.height = haut + "px";
	if(document.getElementById('trame')){
		document.getElementById('trame').style.width = larg + "px";
		document.getElementById('trame').style.height = haut + "px";
	}
	if (larg > 960) {	
		
		var ratio1 = larg/ haut;
		var ratio = largimg/ hautimg;
		
		if (ratio1 < ratio) {
			document.getElementById('fond').style.height = haut + "px";	
			document.getElementById('fond').style.width = (haut*ratio) + "px";
			document.getElementById('fond').style.marginTop = "0px";
			document.getElementById('fond').style.marginLeft = ((larg-(haut*ratio))/2) + "px";
		}
		 else {
			document.getElementById('fond').style.width =  larg + "px";
			document.getElementById('fond').style.height = (larg/ratio) + "px";
			haut2 = (larg/ratio);
			document.getElementById('fond').style.marginLeft = "0px";
			document.getElementById('fond').style.marginTop = ((haut-haut2)/2) + "px";

		}
	}  
	$('#fond').animate({
    opacity: 1,
  }, 500, function() {
  });
}
function blog(){	
	doResize();
	var blog = document.getElementById("blog");
	var image = blog.getElementsByTagName("img")[0];
	image.style.width = "170px";
	image.style.height = "auto";
	if(image.offsetHeight<100){
		image.style.height = "100px";
		image.style.width = "auto";
	}
}
window.onresize = doResize;
