/***************************************/
/****** JResize by _moustach.net *******/
/***************************************/

JResize = function(){
};

JResize.prototype.resizeBackground = function (bgImg) {
	
	var w_w	= $(window).width(),
	w_h	= $(window).height(),
	r_w	= w_h / w_w,
	i_w	= $(bgImg).width(),
	i_h	= $(bgImg).height(),
	r_i	= i_h / i_w,
	new_w,new_h,
	new_left,new_top;

	if(r_w > r_i){
		new_h	= w_h;
		new_w	= w_h / r_i;
	}
	else{
		new_h	= w_w * r_i;
		new_w	= w_w;
	}
	
	$(bgImg).css({
		width	: new_w + 'px',
		height 	: new_h + 'px',
		left	: (w_w - new_w) / 2 + 'px',
		top		: (w_h - new_h) / 2 + 'px'
	});
};

/*
JResize.prototype.slideWallpapper = function(bgImg) {
	$(bgImg+' img.active').fadeOut(100, function() { $(this).removeClass('active'); });
	var bg = $(bgImg+' img.active').next('img');
	if(bg.html() == null) {
		bg = $(bgImg+' img:eq(0)');
	}
	bg.fadeIn(500, function() {
		$(this).addClass('active'); 
		var theme = $(this).attr('rel');
		var classRemove = (theme == 'clair') ? 'sombre' : 'clair';
		$('body').removeClass(classRemove);
		$('body').addClass(theme); 
	});
	setTimeout('JResize.prototype.slideWallpapper("'+bgImg+'")', 3000);
	
}
*/
