/*
 * FullScreenBG 1.0 
 * for MooTools 1.1
 *
 * Copyright (c) 2008 Ryan Quigley (exhibit-E.com)
 * Licensed under the MIT (MIT-LICENSE.txt)
 *
 */
var FullScreenBG={bg:null,img_src:"",ratio:0,init:function(A){FullScreenBG.img_src=A;window.addEvent("domready",function(){FullScreenBG.createBackground()})},createBackground:function(){if(FullScreenBG.bg===null){FullScreenBG.bg=new Element("img",{id:"FullScreenBGImg",styles:{position:"fixed",overflow:"hidden",zIndex:0,visibility:"hidden"},src:this.img_src,events:{load:function(){var A=parseInt(FullScreenBG.bg.getStyle("width"),10);var B=parseInt(FullScreenBG.bg.getStyle("height"),10);FullScreenBG.ratio=A/B;window.addEvent("resize",FullScreenBG.scale);FullScreenBG.scale();new Fx.Style(FullScreenBG.bg,"opacity").start(0,1)}}});FullScreenBG.bg.injectInside(document.body);if(window.ie6){FullScreenBG.bg.setStyles({position:"absolute",top:window.getScrollTop()});window.addEvent("scroll",function(){FullScreenBG.bg.setStyle("top",window.getScrollTop())})}}},changeBG:function(A){if(A===FullScreenBG.bg.getProperty("src")){return }FullScreenBG.bg.setOpacity(0);FullScreenBG.bg.setProperty("src",A)},scale:function(){var A,C,B,E,D;A=window.getWidth();C=window.getHeight();D=FullScreenBG.ratio;if(A/C>D){B=A;E=Math.round(A/D)}else{B=Math.round(C*D);E=C}FullScreenBG.bg.setStyles({width:B,height:E,marginLeft:Math.round(A/2-B/2),marginTop:Math.round(C/2-E/2)})}};