if( Prototype.Browser.IE ){
    if (typeof document.documentElement.style.msInterpolationMode != "undefined") {
        Prototype.Browser.IE6 = false;
    } else {
        Prototype.Browser.IE6 = true;
    }
} else {
    Prototype.Browser.IE6 = false;
}

function getPageSize(parent){
  parent = parent || document.body;              
  var windowWidth, windowHeight;
  var pageHeight, pageWidth;
  if (parent != document.body) {
    windowWidth = parent.getWidth();
    windowHeight = parent.getHeight();                                
    pageWidth = parent.scrollWidth;
    pageHeight = parent.scrollHeight;                                
  } 
  else {
    var xScroll, yScroll;

    if (window.innerHeight && window.scrollMaxY) {  
      xScroll = document.body.scrollWidth;
      yScroll = window.innerHeight + window.scrollMaxY;
    } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
      xScroll = document.body.scrollWidth;
      yScroll = document.body.scrollHeight;
    } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
      xScroll = document.body.offsetWidth;
      yScroll = document.body.offsetHeight;
    }


    if (self.innerHeight) {  // all except Explorer
      windowWidth = self.innerWidth;
      windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
      windowWidth = document.documentElement.clientWidth;
      windowHeight = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
      windowWidth = document.body.clientWidth;
      windowHeight = document.body.clientHeight;
    }  

    // for small pages with total height less then height of the viewport
    if(yScroll < windowHeight){
      pageHeight = windowHeight;
    } else { 
      pageHeight = yScroll;
    }

    // for small pages with total width less then width of the viewport
    if(xScroll < windowWidth){  
      pageWidth = windowWidth;
    } else {
      pageWidth = xScroll;
    }
  }             
  return {pageWidth: pageWidth ,pageHeight: pageHeight , windowWidth: windowWidth, windowHeight: windowHeight};
}
function getWindowWidth(){
  return getPageSize().windowWidth;
}
function getWindowHeight(){
  return getPageSize().windowHeight;
}
Event.observe( window,
               'load',
               function(){
                 var footer_pos   = Position.cumulativeOffset($('footer'));
                 var pointer_pos   = Position.cumulativeOffset($('pointer2'));
                 var offset = ( pointer_pos[1] - footer_pos[1] ) + ( Prototype.Browser.IE ? 20 : 0 );
                 
                 var att = { data:"mg_top.swf?1",  width:getWindowWidth(), height:( getWindowHeight() - offset ) };
                 
                 var par = {}
                 var flashvars = {};
                 swfobject.embedSWF( att.data, 'mg_top_swf', att.width, att.height, "8.0.0", "expressInstall.swf" );
               }
             );
Event.observe( window,
               "resize",
               function(){
                 var footer_pos   = Position.cumulativeOffset($('footer'));
                 var pointer_pos   = Position.cumulativeOffset($('pointer2'));
                 var offset = ( pointer_pos[1] - footer_pos[1] ) + ( Prototype.Browser.IE ? 20 : 0 );
                 
                 var swf = $('mg_top_swf');
                 if( swf ){
                   swf.width = getWindowWidth();
                   swf.height = ( getWindowHeight() - offset );
                   swf.style.width = getWindowWidth() + 'px';
                   swf.style.height = ( getWindowHeight() - offset ) + 'px';
                 }
               }
             );
