/*
 * (c) Accu-Rate.ca 2006
 *
 * Javascript code for exchange rate pages
 *
 * HTML & PHP code by Webmotion
 * mikael.grave@webmotion.com
 */

<!-- //

var helpTitleVIP   = 'VIP';
var helpContentVIP = 'The VIP clients rate program is a privilege given to clients trading large volumes of funds with us. Should you or your company wish to adhere to this program, please send us your request by email at <a href="VIP@accu-rate.ca">VIP@accu-rate.ca</a> and we will be please to send you more information.';

var calcRateType = 'S';
var calcRate     = 1.00;

function calculate() {
  // Hide all results
  document.getElementById( "crs" ).style.display = "none";
  document.getElementById( "crb" ).style.display = "none";
  if ( calcRateType == 'S' ) {
    objectToShow = document.getElementById( "crs" );
    objectAmount = document.getElementById( "crs_amount" );
    objectConvertedAmount = document.getElementById( "crs_converted" );
  } else {
    objectToShow = document.getElementById( "crb" );
    objectAmount = document.getElementById( "crb_amount" );
    objectConvertedAmount = document.getElementById( "crb_converted" );
  }
  amount     = 1.00 * document.calculator.amount.value;
  converted  = amount * calcRate;
  objectAmount.innerHTML          = amount.toFixed( 2 );
  objectConvertedAmount.innerHTML = converted.toFixed( 2 );
  objectToShow.style.display = "block"; // Show result
}

function setRate( type, rate ) {
  calcRateType  = type;
  calcRate      = rate;
  if ( document.calculator && document.calculator.amount.value ) calculate();
}

// -->
