function addLoadEvent(func) {
 var oldonload = window.onload;
 if (typeof window.onload != 'function') {
   window.onload = func;
 } else {
   window.onload = function() {
     oldonload();
     func();
   }
 }
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function resizePortlets() {
  // determine screen height
		var windowScroll = WindowUtilities.getWindowScroll();    
		var pageSize = WindowUtilities.getPageSize();    
    
    var topRowHeight = 100;
    var leftColWidth = 1; // firefox seems to need this?
    var availWidth = pageSize.windowWidth - leftColWidth - 15;
    var availHeight = pageSize.windowHeight - topRowHeight;
    
    // make some adjustments for firefox
    if(!document.all) availHeight -= 3;
    
    var portletWidth = availWidth/2;
    var portletHeight = availHeight/2;
    var portletScrollerHeight = portletHeight - 52; // subtract portlet header and footer height
    var portletScrollerWidth = portletWidth - 22; // subtract portlet left and right edges
    
    // Resize portlet containers
    Element.setStyle($('portlet_top_left'), {top: "0px", left: "0px", width: portletWidth + "px", height: portletHeight + "px"});
    Element.setStyle($('portlet_top_right'), {top: "0px", left: portletWidth+2 + "px", width: portletWidth + "px", height: portletHeight + "px"});
    Element.setStyle($('portlet_bottom_left'), {top: portletHeight + "px", left: "0px", width: portletWidth + "px", height: portletHeight + "px"});
    Element.setStyle($('portlet_bottom_right'), {top: portletHeight + "px", left:  portletWidth+2 + "px", width: portletWidth + "px", height: portletHeight + "px"});
    
    // need to set scroller heights as well...
    Element.setStyle($('contentPortletTL'), {height: portletScrollerHeight + "px", width: portletScrollerWidth + "px"});
    Element.setStyle($('contentPortletTR'), {height: portletScrollerHeight + "px", width: portletScrollerWidth + "px"});
    Element.setStyle($('contentPortletBL'), {height: portletScrollerHeight + "px", width: portletScrollerWidth + "px"});
    Element.setStyle($('contentPortletBR'), {height: portletScrollerHeight + "px", width: portletScrollerWidth + "px"});
}

Event.observe(window, 'load', resizePortlets, false);
Event.observe(window, 'resize', resizePortlets, false);

