//                  Aust   Cana   Euro   Japan   Mexi   GrBr  USA    Braz   SAfr   India
//                  ----   ----   ----   -----   ----   ----  ----   ----   ----   ----
gCConv = new Array( 1.75,  1.52,  1.03,  121.90, 9.87,  1.00,  1.00,  2.77,  10.30,  49.00, -1 );
gCName = new Array( "AUD", "CAD", "EUR", "JPY", "MXP", "GBP", "USD", "BRL", "ZAR", "INR",  "???" );


function FixValue(rawValue, iRightOfDecimal ){

   	var iCents = 100*(rawValue-Math.floor(rawValue))+0.5;
   	newValue   = Math.floor(rawValue);
	
	if( iRightOfDecimal == 0 ) {
		return newValue;
	}
	newValue = newValue + ".";

	newValue += Math.floor(iCents/10);
	if( iRightOfDecimal == 1 ) {
		return newValue;
	}

	newValue += Math.floor(iCents%10);
   	return newValue;
}


function calcROI( iSeats, iTimePeriod, iIndex, iRightOfDecimal ){
	var i;
	var iLicense;
	var iROIMax;

	iROIMax= 0;
	if     (iSeats > 0     	 && iSeats <= 5   ){p=2.42;	}
	else if(iSeats > 5    && iSeats <= 10   ){	p=2.30;	}
	else if(iSeats > 10    && iSeats <= 15  ){	p=1.86;	}
	else if(iSeats > 15   && iSeats <= 20 ){	p=1.77;	}
	else if(iSeats > 20   && iSeats <= 100 ){	p=1.77;	}	
	else if(iSeats > 100   && iSeats <= 400 ){	p=1.60;	}
	else if(iSeats > 400   && iSeats <= 1000 ){	p=1.45;	}
	else if(iSeats > 1000   && iSeats <= 2000 ){p=1.35;	}
		
	iLicense = iSeats * p * 12;
	iROIMax= gCConv[iIndex] * (iLicense/iTimePeriod);
	iROIMax= FixValue (iROIMax, iRightOfDecimal);
	return iROIMax;
}





