var myValue;
random_number= Math.floor(Math.random()* 7+1 );
if (random_number==1) {
myValue="./public/images/backgrounds/01.jpg";
}
if (random_number==2) {
myValue="./public/images/backgrounds/02.jpg";
}
if (random_number==3) {
myValue="./public/images/backgrounds/03.jpg";
}
if (random_number==4) {
myValue="./public/images/backgrounds/04.jpg";
}
if (random_number==5) {
myValue="./public/images/backgrounds/05.jpg";
}
if (random_number==6) {
myValue="./public/images/backgrounds/06.jpg";
}
if (random_number==7) {
myValue="./public/images/backgrounds/07.jpg";
}

(function($){

	var origDiv = 'body';
	var origImg = '#back';

	//resize the image on brower load
	$(document).ready(function() {
		$(origDiv).resizeImg();
	});
	//resize the image on browser resize
	$(window).bind("resize", function() {
		$(origDiv).resizeImg();
	});

    $.fn.resizeImg = function() {
        //define original width and height of the image
        var imgWidth = $(origImg).attr('width');
        var imgHeight = $(origImg).attr('height');
        //define image ratio
        var ratio = imgHeight/imgWidth;
        //get browser dimensions
        var winWidth = $(window).width();
        var winHeight = $(window).height();
	var winRatio = winHeight/winWidth;
        //resize the image
        if (winRatio > ratio) {
            $(origDiv).height(winHeight);
            $(origDiv).width(winHeight / ratio);
            $(origImg).height(winHeight);
            $(origImg).width(winHeight / ratio);
        } else {
            $(origDiv).width(winWidth);
            $(origDiv).height(winWidth * ratio);
            $(origImg).width(winWidth);
            $(origImg).height(winWidth * ratio);
        }

    };
})(jQuery);



