/**
 * Default Javascript for the CMS
 *
 * @author Jeroen Boersma <jeroen@jboersma.nl>
 * @copyright Jeroen Boersma 2009
 * @package Private project CMS
 * @created 2009-10-10
 * @lastmodified 2009-10-10
 * @version 0.1
 */

/**
 * Reset width of contentcontainer
 */
function resetContentContainerWidth () {
  if ( ( m = document.getElementById ( 'menu' ) ) ) {
    if ( window.innerHeight ) {
      // Gecko, fixed in Stylesheet
      m.style [ 'position' ] = 'fixed';
    } else if ( ie = navigator.appVersion.match ( /MSIE (6)/ ) ) {
      window.onscroll = initMoveMenu;
      moveMenu ();
    } else if ( document.documentElement.clientHeight ) {
      // Gecko, fixed in Stylesheet
      m.style [ 'position' ] = 'fixed';
    } else {
    }
  }
}
window.onload = window.onresize = resetContentContainerWidth;

/**
 * Place menu on right place
 */
function moveMenu () {
  if ( m = document.getElementById ( 'menu' ) ) {
    if ( ( st = document.documentElement.scrollTop ) >= 0 ) {
      m.style [ 'marginTop' ] = ( 5 + st ) + 'px'
    }
  }
}

to = null;
function initMoveMenu () {
  if ( to != null ) {
    clearTimeout ( to );
  }

  to = setTimeout ( 'moveMenu ();', 300 );
}