MooTools Full Screen

Full Screen Background Image

<script>
window.addEvent(load, function(){resize();});
window.addEvent(resize, function(){bg.empty();resize();});

function resize(){

width = window.getSize().x;
height = window.getSize().y;

bg = new Element(div).inject(document.body,top);
bg.setStyles({position:fixed,width:width,height:height,display:block});
img_bg = new Element(img,{src:bg.jpg}).inject(bg);

image_width = 1024;
image_height = 768;

if(image_width/image_height>width/height){new_image_height = height; new_image_width = (height/image_height)*image_width;}
else {new_image_height = (width/image_width)*image_height; new_image_width = width;}

img_bg.setStyles({width:new_image_width ,height:new_image_height,display:block});

};
</script>