// JavaScript Document

// <![CDATA[ 

  // make the flash resize
	window.onresize= checkSize;
  isResized = false;
  
  // checks the window size etc...
	function checkSize() 
  {
	  
    // max vals of Flash. 
	var maxWidth = 1048;
	var maxHeight = 696;
	
	
    // max vals of Window.
    var maxWidth_win = 1100;
	var maxHeight_win = 700;

    // FIND THE SIZE OF THE WINDOW
      var myWidth = 0, myHeight = 0;
      if( typeof( window.innerWidth ) == 'number' ) {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
      } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
      } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
      }
            
    // CHECK IF FLASH NEEDS RE-SIZING
      var newWidth = maxWidth;
      var newHeight = maxHeight;
      
      var isChanged=false;
      
      if(myWidth < maxWidth_win || myHeight < maxHeight_win)
      { // window is shrunk (WIDTH OR HEIGHT) and flash needs to follow
      
        // get ratios
        var ratioW = (myWidth/maxWidth_win);
        var ratioH = (myHeight/maxHeight_win);
        
        // which ratio is biggest
        var toRatioBy = ratioW;
        
        if(ratioH < ratioW) toRatioBy = ratioH;
        
        newWidth = maxWidth*toRatioBy;
        newHeight = maxHeight*toRatioBy;
        
        isChanged=true;
        isResized=true;
      } else if (isResized=true)
      { // if it's above the min allowed for the window
        newWidth = maxWidth;
        newHeight = maxHeight;     
        
        isChanged=true;  
        isResized=false;       
      }
    
    // do resize
      if(isChanged) resizeTo(newWidth,newHeight);
             
	}

  // handles a resize
  function resizeTo(width,height)
  {
   if(document.all && !document.getElementById) {
   		document.all['middle-bitx'].style.pixelWidth = width;
   		document.all['middle-bitx'].style.pixelHeight = height;
  	}else{
  		document.getElementById('middle-bitx').style.width = width;
  	 document.getElementById('middle-bitx').style.height = height;
  	}
  }

// ]]>

