
function CastlesunLayout () {
    
    this.map = null;
    
    this.init = function () {
        
        var dim = getWindowDimensions();
        
        $("#backgroundDiv").css({"width":dim[0]+"px","height":dim[1]+"px"});
        $("#contentDivOpacity,#contentDiv").css({"height":(dim[1]-219)+"px"});
        
    }
    
    this.initMap = function () {
        var latlng = new google.maps.LatLng(48.145243, 11.56208);
        var myOptions = {
            zoom: 13,
            center: latlng,
            mapTypeId: google.maps.MapTypeId.TERRAIN,
            mapTypeControl: false,
            mapTypeControlOptions: {
                style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
                position: google.maps.ControlPosition.RIGHT_BOTTOM
            },
            navigationControl: false,
            navigationControlOptions: {
                style: google.maps.NavigationControlStyle.ZOOM_PAN,
                position: google.maps.ControlPosition.RIGHT_BOTTOM
            },
            scaleControl: false,
            scaleControlOptions: {
                position: google.maps.ControlPosition.RIGHT_BOTTOM
            }
        };
        this.map = new google.maps.Map($("#backgroundDiv").get(0), myOptions);
    }
    
    this.resize = function (width,height) {
        // resize map
        $("#backgroundDiv").css({"width":width+"px","height":height+"px"});
        
        // resize content
        $("#contentDivOpacity,#contentDiv").css({"height":(height - 219)+"px"});
    }
    
    this.reRender = function () {
        this.hideLeftMenu();
        this.hideRightMenu();
    }
    
    
    this.contentHide = false;
    this.leftMenuHide = true;
    this.rightMenuHide = true;
    
    this.showLeftMenu = function () {
        this.leftMenuHide = false;
        $("#menuLeftDiv").effect("slide", {"direction":"left", "mode":"show"}, "slow", function () {});
        $("#menuLeftHideBtn").fadeIn("slow", function (){});
        $("#menuLeftShowBtn").fadeOut("slow", function () {});
        this.hideRightMenu();
        this.hideContent();
    }
    this.hideLeftMenu = function () {
        if (this.leftMenuHide == false) {
            $("#menuLeftDiv").effect("slide", {"direction":"left", "mode":"hide"}, "slow", function () {});
            $("#menuLeftHideBtn").fadeOut("slow", function () {});
            $("#menuLeftShowBtn").fadeIn("slow", function () {});
            this.leftMenuHide = true;
        }
    }
    this.showRightMenu = function () {
        this.rightMenuHide = false;
        $("#menuRightDiv").effect("slide", {"direction":"right", "mode":"show"}, "slow", function () {});
        $("#menuRightHideBtn").fadeIn("slow", function () {});
        $("#menuRightShowBtn").fadeOut("slow", function () {});
        this.hideLeftMenu();
        this.hideContent();
    }
    this.hideRightMenu = function () {
        if (this.rightMenuHide == false) {
            $("#menuRightDiv").effect("slide", {"direction":"right", "mode":"hide"}, "slow", function () {});
            $("#menuRightHideBtn").fadeOut("slow", function () {});
            $("#menuRightShowBtn").fadeIn("slow", function () {});
            this.rightMenuHide = true;
        }
    }
    this.showContent = function () {
        this.contentHide = false;
        $("#contentDivOpacity, #contentDiv").effect("slide", {"direction":"up", "mode":"show"}, "slow", function () {});
        this.hideRightMenu();
        this.hideLeftMenu();
    }
    this.hideContent = function () {
        $animated = false;
        // $("#contentDivOpacity, #contentDiv")[0].each(function(index,object) {
            // alert("test : "+$($("#contentDivOpacity, #contentDiv")[0]).css("display"));
            if ($($("#contentDivOpacity, #contentDiv")[0]).css("display") == "block") {
                $("#contentDivOpacity, #contentDiv").effect("slide", {"direction":"down", "mode":"hide"}, "slow", function () {
                    animated = false
                });
                this.contentHide = true;
                animated = true;
            }
       //  });
    }
    
    
    
}




var castleSun = new CastlesunLayout();
smefCms.setLayout(castleSun);

