function Screen2D::onExtentChange( %this, %data )  
{  
   setAcceptableScreenRatio();
}  
   
function setAcceptableScreenRatio()  
{  
   %x = getWord(getRes(), 0);   
   %y = getWord(getRes(), 1);

   if(%y == 600)
   {
      %heightfactor = 4;
      %factor = 3.5;
   }
   if(%y >= 768)
   {
      %heightfactor = 4.5;
      %factor = 4;
   }
      
   %currentarea = screen2d.getCurrentCameraPosition();
   %field1 = getWord(%currentarea, 0);
   %field2 = getWord(%currentarea, 1);
   %width = %x / %factor;
   %height = %y / %heightfactor;
   Screen2D.dismount();
   screen2d.setCurrentCameraPosition(%field1,%field2,%width,%height);
   screen2d.mount(player);      
}

function setAcceptableScreenCombatRatio()  
{  
   %x = getWord(getRes(), 0);   
   %y = getWord(getRes(), 1);

   if(%y == 600)
   {
      %height = 100;
      %factor = 5.5;
   }
   if(%y == 768)
   {
      %height = 125;
      %factor = 6;
   }
      
   %currentarea = screen2d.getCurrentCameraPosition();
   %field1 = getWord(%currentarea, 0);
   %field2 = getWord(%currentarea, 1);
   %width = %x / %factor;
   Screen2D.dismount();
   screen2d.setCurrentCameraPosition(%field1,%field2,%width,%height);
   screen2d.mount($vehicles[1, battleid]);      
}

function setAcceptableScreenInfantryRatio()  
{  
   %x = getWord(getRes(), 0);   
   %y = getWord(getRes(), 1);

   if(%y == 600)
   {
      %height = 150;
      %factor = 3.5;
   }
   if(%y == 768)
   {
      %height = 175;
      %factor = 4;
   }
      
   %currentarea = screen2d.getCurrentCameraPosition();
   %field1 = getWord(%currentarea, 0);
   %field2 = getWord(%currentarea, 1);
   %width = %x / %factor;
   screen2d.setCurrentCameraPosition(%field1,%field2,%width,%height);
}