var bg = new function() {
    var element = "bg";
    
    // this.fixFlashLayer = function() {
        // var flashDiv = document.getElementById("cright_flash");
        // if(!flashDiv) return;
        
        // var flashOuter = document.getElementById("cright");
        // if(!flashOuter) return;
        
        // alert(flashOuter.offsetHeight);
        // flashDiv.style.height = (flashOuter.offsetHeight + 50) + "px";
    // };
    
	this.fixa = function() {
		(function() { $(document.body).setStyle("overflow: visible;"); }).defer();
		bg.fix();
	}

    this.fix = function() {
        var e = $(element);
        if(!e) return;
        
	var pos = "absolute";
	if(window.XMLHttpRequest)
		pos = "fixed";

        e.style.cssText = "position:" + pos + ";"
            + "z-index:99;"
            + "display:block;"
            + "top:0;"
            + "left:0;"
            + "overflow:hidden;";
        
        var d = document.viewport.getDimensions();
        var m = $("main");
        m.style.cssText = "position:absolute;"
            + "z-index:100;"
            + "top:2%;"
            + "left:" + ((d.width - m.getWidth()) / 2) + "px;";
    };
};

document.observe("dom:loaded", bg.fixa);
Event.observe(window, "resize", bg.fix);
