var switchyLastWidth=0; function quickSwitchy() { var change=document.getElementById('container'); var curWidth=document.body.clientWidth; if (curWidth!=switchyLastWidth) { if (curWidth>1224) { change.className="wide"; } else { change.className="narrow"; } switchyLastWidth=curWidth; } } /* the following fixes Opera being a bit #DDD on loading background images */ function operaRenderFix() { document.body.style.padding="0"; } function stageTwo() { if (navigator.userAgent.indexOf("Opera")>-1) { document.body.style.padding="0 1px"; setTimeout(operaRenderFix,1); } } function initialize() { quickSwitchy(); if (window.addEventListener){ window.addEventListener('resize',quickSwitchy,false); window.addEventListener('load',stageTwo,false); } else if (window.attachEvent){ window.attachEvent("onresize",quickSwitchy); window.attachEvent("onload",stageTwo); } else { window.onresize=quickSwitchy; window.onload=stageTwo; } }