 (function($) {

	var MARGINTOP = 20;
	

	$(document).ready(function ()
	{
			
	});
	
	$(window).bind("load resize", function()
	{ 
		resizeBkgHome();
	});
	
	
	/*  FONCTIONS
	-----------------------------------------------------------------------------------------------------------
	-----------------------------------------------------------------------------------------------------------
	----------------------------------------------------------------------------------------------------------- */
	
	/*  resize Bkg Home
	----------------------------------------------------------------------------- */	
	var resizeBkgHome = function()
	{
	//	var h = window.innerHeight;
	//	$("#home img").css("height",h-MARGINTOP+"px");
	
		var ww = $( window ).width(),
				wh = $( window ).height(),
				iw = $("#home img").width(),
				ih = $("#home img").height(),
				rw = wh / ww,
				ri = ih / iw,
				newWidth, newHeight,
				newLeft, newTop,
				properties;
			
		if ( rw > ri ) {
			newWidth = wh / ri;
			newHeight = wh;
		} else {
			newWidth = ww;
			newHeight = ww * ri;
		}
		
		properties = {
			'width':	newWidth + 'px',
			'height': 	newHeight + 'px',
			'left':		( ww - newWidth ) / 2 + 'px',
			'top':		( wh - newHeight ) / 2 + 'px'
		}
		
		$("#home img").css(properties);
	
	}
	
	
	


	
	
})(jQuery);


//--------------------
function log(msb) {
 	try {
 		console.log(msg);
 	} catch (e) {}
 }
