
//  -----------------------------------------------------------------
//    Notes:	The purpose of this Javascript File is to control the div resize functionality Either not handled by x_
//              Code or need to setup the use of the X_ code
//
//    Global Variables Delcared:         
//           NONE
//
//    Arguments:   
//    Returns:	N/A
//  		E:\WebSite_Default\ArcIMSFrameWorkSource\JavaScript\ArcIMSFrameWork_UnitConversions.js
//   -----------------------------------------------------------------
//    Orginization:	City of Asheville IT Services
//    Original Code: 	Dave Michelson 1/31/2006
//    Last Update:	Dave Michelson 1/31/2006
//




  //convert to square measurement
  function ConvertSqUnits( inArea , inUnits , OutUnits ){

    var outArea = 0.0;

    if (inUnits == 'FEET'){
      outArea = Math.round(Number(outArea)*100)/100; 
      if(OutUnits == 'ACRES'){
        outArea = (inArea/43560);
        outArea = Math.round(Number(outArea)*10000)/10000; 
      }else if(OutUnits == 'SQUARE_MILES'){
        outArea = ((inArea/43560)/640);
        outArea = Math.round(Number(outArea)*10000)/10000; 
      }else if(OutUnits == 'HECTARES'){
        outArea = ((inArea/43560) * 0.4049);
        outArea = Math.round(Number(outArea)*10000)/10000; 
      }
    }
  
    if (outArea > 10){
      outArea = Math.round(Number(outArea)*100)/100 
    }
    return outArea;   
   
  }

  // convert the amounts to new units
  function convertUnits(theDist1,mUnits,sUnits) {
    var theDist = parseFloat(theDist1);
    var mDistance = theDist;
	
    if (mUnits == "FEET"){
      if (sUnits=="MILES"){
        mDistance = theDist / 5280;
      }else if(sUnits == "METERS"){
        mDistance = theDist * (3048/10000);
      }else if(sUnits == "KILOMETERS"){
        mDistance = theDist * (3048/10000000);
      }
    }else{
      if (sUnits=="MILES"){
        mDistance = theDist * (6213711922/10000000000000);
        }else if(sUnits == "FEET"){
          mDistance = theDist * (3280839895/1000000000);
        }else if(sUnits == "KILOMETERS"){
          mDistance = theDist / 1000;
        }
      }
    var u = Math.pow(10,2);

    if (!isNav) mDistance = parseInt(mDistance * u + (5/10)) / u;
    mDistance = Math.round(Number(mDistance)*10)/10;
    return mDistance;
  }