/***********************************************
** File:      %M%  version %I%
** Author:    nat
** Modified:  %G%
** Copyright: I-Next Ltd
***********************************************/
/* ident %W% */

var contentDiv = 'contentholder';

function doLoad(){
  moveFooter(); // Move the footer to the correct place
  set('footer','visibility','visible'); // Show the footer
  window.onresize = moveFooter; // Move it on window resize
  checkIFrames(); // Move the footer on iframe onload
}

function checkIFrames(){
  var iframes = document.getElementsByTagName('iframe'); // Get the iframes
  for ( var i = 0; i < iframes.length; i ++ ){ // Go through them
    if ( window.attachEvent ){ // For IE do an attach event
      iframes[i].attachEvent("onload", moveFooter );
    } else if ( ( navigator.userAgent.indexOf('Netscape') != -1 ) && ( navigator.userAgent.indexOf('Windows') != -1 ) ){ // Netscape on windows
      iframes[i].onload = function(){ setTimeout('moveFooter();',1000); } // Delay the footer move
    } else { // For others assign the function
      iframes[i].onload = function(){ moveFooter(); }
    }
  }
}

function moveFooter(){
  // Calc the full height of the content
  var contentHeight = get(contentDiv,'top') + get(contentDiv,'height') + 17;
  // Figure out the window height (safari or not)
  var winHt = ( typeof( window.innerHeight ) == 'number' )? window.innerHeight : document.body.clientHeight;
  // Move the footer to the bottom of the content or the window
  set('footer','top', ((( contentHeight > winHt )?contentHeight:winHt)-17));
}

function popup( win, w, h ){
  if ( window.pop ){ window.pop.close(); } // close an open one
  if ( popup.arguments.length < 2 ){ w = 320; };
  if ( popup.arguments.length < 3 ){ h = 480; };
  pop = window.open( win,'return','toolbar=no,location=no,directories=no,status=yes,scrollbars=no,resizable=no,copyhistory=no,locationbar=no,width=' + w + ',height=' + h + ',screenX=0,screenY=0,top=0,left=0');
}

window.onload = doLoad;
