function adjustLayout(){
    var MenuColumn = $('Menu');
    var ContentColumn = $('ViewContainer');
    var Footer = $('Footer');
    
    if(MenuColumn && ContentColumn){
        ContentColumn.setStyle({height: 'auto'});
        if(MenuColumn.getHeight() > ContentColumn.getHeight()){
            var paddingTop = GetComputedStyle(ContentColumn, 'padding-top', 1);
            var paddingBottom = GetComputedStyle(ContentColumn, 'padding-bottom', 1);
            var newHeight = MenuColumn.getHeight() - paddingTop - paddingBottom - 24;
            newHeight += 'px';
            
            //alert('Menu: ' + MenuColumn.getHeight() + '; Contenido: ' + ContentColumn.getHeight() + '; Nueva Altura: ' + newHeight);
            ContentColumn.setStyle({height: newHeight});
        }
        if(Footer && Footer.getStyle("display") == "none"){
            Footer.setStyle({display: 'block'});
        }
    }
}

//function adjustPortletContainers(){
//    //Default sizes
//    var LeftCol = $('LeftSide');
//    var RightCol = $('RightSide');    
//    LeftCol.style.height = 'auto';
//    RightCol.style.height = 'auto';
//        
//    //Header height
//    var Header = $('TopPanel');
//    paddingTop = GetComputedStyle(Header, 'padding-top', 1);
//    paddingBottom = GetComputedStyle(Header, 'padding-bottom', 1);    
//    var HeaderHeight = Header.clientHeight + paddingTop + paddingBottom;
//    //alert('HeaderHeigt = ' + HeaderHeight);
//    
//    //Menu height
//    var Menu = $('Menu');
//    paddingTop = GetComputedStyle(Menu, 'padding-top', 1);
//    paddingBottom = GetComputedStyle(Menu, 'padding-bottom', 1);    
//    var MenuHeight = Menu.clientHeight + paddingTop + paddingBottom;
//    //alert('MenuHeigt = ' + MenuHeight);
//    
//    //Welcome height
//    var Welcome = $('Welcome');
//    paddingTop = GetComputedStyle(Welcome, 'padding-top', 1);
//    paddingBottom = GetComputedStyle(Welcome, 'padding-bottom', 1);    
//    var WelcomeHeight = Welcome.clientHeight + paddingTop + paddingBottom;
//    //alert('WelcomeHeight = ' + WelcomeHeight);
//    
//    //DockBar height
//    var DockBar = $('DockBar');
//    paddingTop = GetComputedStyle(DockBar, 'padding-top', 1);
//    paddingBottom = GetComputedStyle(DockBar, 'padding-bottom', 1);    
//    var DockBarHeight = DockBar.clientHeight + paddingTop + paddingBottom;
//    //alert('DockBarHeight = ' + DockBarHeight);
//    
//    //Columns max height
//    var Container = $('ViewContainer');
//    var paddingTop = GetComputedStyle(Container, 'padding-top', 1); 
//    var paddingBottom = GetComputedStyle(Container, 'padding-bottom', 1);
//    var ViewContainerPadding = paddingTop + paddingBottom;
//    var MaxColHeight = Container.clientHeight - ViewContainerPadding - WelcomeHeight;
//    //alert('MaxColHeight = ' + MaxColHeight + 'container='+Container.clientHeight+' - cont.padding='+ViewContainerPadding+' - welcome=' + WelcomeHeight);
//    
//    //Minimum columns height
//    var WindowHeight = get_windowHeight();
//    var MinColHeight = WindowHeight - HeaderHeight - MenuHeight - WelcomeHeight - DockBarHeight - ViewContainerPadding;
//    //alert('MinColHeight = ' + MinColHeight);
//    
//    if(MaxColHeight > MinColHeight){
//        //alert('Custom Height!! --> ' + MaxColHeight);
//        LeftCol.style.height = MaxColHeight + 'px';
//        RightCol.style.height = MaxColHeight + 'px';
//    }
//    else {
//        if(navigator.appName == 'Netscape')
//            MinColHeight = MinColHeight - 1;
//        //alert('MinHeight!! --> ' + MinColHeight);
//        LeftCol.style.height = MinColHeight + 'px';
//        RightCol.style.height = MinColHeight + 'px';
//    }
//    
//    //alert('LeftCol final height = ' + LeftCol.clientHeight + ' Browser3: ' + navigator.appName);
//}

function get_windowHeight(){
   var myWidth = 0, myHeight = 0;
   if( typeof( window.innerWidth ) == 'number' ){ 
      //Non-IE
      myHeight = window.innerHeight;
   }
   else{
      if ( document.documentElement && ( document.documentElement.clientWidth ||    document.documentElement.clientHeight ) ){ 
        //IE 6+ in 'standards compliant mode'
        myHeight = document.documentElement.clientHeight;
      }
      else{
        if ( document.body && ( document.body.clientWidth || document.body.clientHeight ) ){ 
            //IE 4 compatible
            myHeight = document.body.clientHeight;
        }
      }
   }
   return myHeight;
}

function GetComputedStyle(element, style, i){
    if(!(element=$(element))) return null;
    var s, v = 'undefined', dv = document.defaultView;
    if(dv && dv.getComputedStyle){
        s = dv.getComputedStyle(element,'');
        if (s) v = s.getPropertyValue(style);
    }
    else if(element.currentStyle) {
        v = element.currentStyle[style.camelize()];
    }
    else return null;
    return i ? (parseInt(v) || 0) : v;
}

