var IN = 'IN';
var OUT = 'OUT';


function doLayout(){
    var main = $("main");
    var content = $("content");
    var menu = $("menu");
    var visual = $("visual");
//    var left = (document.viewport.getWidth() - main.getWidth()) / 2;
//    if(left < 0){
//       main.style.left = 0 + "px";
//    }else{
//      main.style.left = left + "px";
//    }
    var totalHeight = visual.getHeight() + menu.getHeight() + content.getHeight();
    if(totalHeight < document.viewport.getHeight()){
        content.style.height = (document.viewport.getHeight() - totalHeight + content.getHeight() - 5) + "px";
    }
    /*main.style.zIndex = 10;
    var shadow = document.createElement("DIV");
    shadow = $(shadow);
    shadow.style.zIndex = 1;
    shadow.style.top = "10px";
    shadow.style.left = (left + main.getWidth() - 5) + "px";
    shadow.style.width = "20px";
    shadow.style.height = (main.getHeight() - 10) + "px";
    shadow.style.backgroundImage = "url(/images/shadow_r.png)";
    shadow.style.backgroundRepeat = "repeat-y";
    shadow.style.backgroundPosition = "right";
    shadow.style.position = "absolute";
    $("body").appendChild(shadow);

    shadow = document.createElement("DIV");
    shadow = $(shadow);
    shadow.style.zIndex = 1;
    shadow.style.top = (main.getHeight() - 10) + "px";
    shadow.style.left = (left + 10) + "px";
    shadow.style.width = main.getWidth() + "px";
    shadow.style.height = "20px";
    shadow.style.backgroundImage = "url(/images/shadow_u.png)";
    shadow.style.backgroundRepeat = "repeat-x";
    shadow.style.backgroundPosition = "bottom";
    shadow.style.position = "absolute";
    $("body").appendChild(shadow);*/
}

function init(){
    doLayout();
    window.onresize = doLayout;
}



function menuHover(elem, direction){
//    if(elem.id == "homeButton" || elem.id == "homeButtonInv"){
//        if(elem.id == "homeButton"){
//            elem.id = "homeButtonInv";
//        }else if(elem.id == "homeButtonInv"){
//            elem.id = "homeButton";
//        }
//    }else{
//        var home = $("homeButton");
//        if(!home){
//            home = $("homeButtonInv");
//        }
//        if(elem.className == "menubutton"){
//            elem.className = "menubuttonHigh";
//            //home.id = "homeButtonInv";
//        }else if(elem.className == "menubuttonHigh"){
//            elem.className = "menubutton";
//            //home.id = "homeButton";
//        }
//    }
    if(direction == IN){
        elem.style.cursor = "pointer";
    }else{
        elem.style.cursor = "default";
    }
}

