//     This file contains English messages that appear in Javascript.
//     Variable names in all SystemMessages files are the same.  Depending
//     on the language of JSP, it will include its respective
//     SystemMessages file.  This way, only the SystemMessages file will have to be
//     different for each language.

//--> Added the PageName Variable for Static incluing JavaScript -- By Billy 19Dec2002
//var PAGE_NAME = "<%= viewBean.PAGE_NAME%>";

//--> Added Language Indicator -- By Billy 20Nov2002

/*
var LANGUAGE = "en";
var LANGUAGECODE = 0;

var NUMERIC_ONLY = "Please input numeric only !"
var INPUT_NUM_DIGITS = "You must input %i digits !"
//var INPUT_VALUE = "Missing MI Certificate # !"
var INPUT_DECVALUE_RANGE = "You must enter a value between %f and %f !"
var INPUT_VALUE_RANGE = "You must enter a value between %i and %f !"
// SCR 2717: force 3 decimal - Joe Ng Dec 13, 2004
var INPUT_VALUE_RANGE_3DECIMAL = "You must enter a value between %i and %.3f !"
var INPUT_INTVALUE_RANGE = "You must enter a value between %i and %i !"
//var INPUT_DIGITS_RANGE = "You must enter number of digits between %i and %i !"
var INVALID_DECIMAL = "Invalid decimal format !"
var ALPHA_ONLY = "Please input alphabetic only !"
var MAX_PRECISION = "The maximum precision is %i decimal places !"
var INVALID_POSTAL_CODE = "Postal code format wrong !"
var INVALID_NUM_DAYS_31 = "Invalid Day -- there are not 31 days in the specified month !"
var INVALID_NUM_DAYS_29 = "Invalid Day -- there are only 29 days in Feb in a Leap Year !"
var INVALID_NUM_DAYS_28 = "Invalid Day -- there are only 28 days in Feb in a Non-Leap Year !"
var NUM_YEARS = "Please input # of years in the range 0-80 !"
var MAX_YEAR = "Duration must be less than 80 years 0 months !"
var NUM_MONTHS = "Please input # of months in the range 0-11 !"
var MAX_CHARS = "Please input with max of %i characters !"
var DEAL_NUM_NUMERIC_ONLY = "Please input numeric only for Deal #!"
var NO_SECOND_SELECTION = "Second selection is not allowed while previous request is being processed."
var CHAR_MAX_255 = "You cannot enter more than 255 characters in this field."
var LIABILITY_DELETION_ERROR = "One or more liability was selected for deletion but \'Delete Liability\' key was not pressed."
var LIABILITY_EXPORT_ERROR = "One or more liability was selected for export but \'Export Liability\' key was not pressed."
var FEE_TYPE_ALREADY_SET = "This Fee Type has already been set for this deal. Please select a different type of fee."
var MAX_DISCOUNT = "Max Discount Rate must be less or equal to Posted Rate"
var HIGHER_APPROVER_REQ = "Higher Approver or Joint Approver required for all users except for 'Senior Manager', 'Junior Administrator','Administrator','Senior Administrator','System Administrator', 'Investor Administrator','Passive'."
var NON_DECISIONING_USER = "This user type is a non-decisioning user. Higher or Joint Approvers are invalid for non-decisioning users."
var USER_TYPE_REQ = "User type is required."
var FIELD_ALPHA_ONLY = "The ' %s ' field can only hold alpha characters."
var FIELD_ALPHA_ONLY_2 = "The ' %s ' field can only hold letters (a to z)."
var AREA_CODE_3_DIGITS = "Area Code must be 3 digits."
var AREA_CODE_NUMERIC = "Area Code must be numeric."
var WORK_PHONE_FORMAT = "Please enter the work phone number as follows: (###) ###-####."
var FAX_NUMBER_FORMAT = "Please enter the fax number as follows: (###) ###-####."
var PHONE_NUMERIC = "Phone Number must be numeric."
var PHONE_EXT_NUMERIC = "Phone Number Extension must be numeric."
var INVALID_EMAIL = "Invalid Email Address."
var DO_NOT_USE_SPECIAL_CHARACTERS = "Warning: this text contains one or more prohibited characters; please remove or replace any angle brackets (< >), double quotation marks (\"), or ampersands ( & ) before continuing"

//--> Messages for Applicant and Property Screen when Cancel Button pressed
var APP_CANCEL_CHANGES = "You are leaving the Applicant Entry screen. Your changes have not yet been saved. \n"+
	    "To continue without saving click \'OK\'. \n"+
	    "To return to Applicant Entry screen click \'Cancel\'."
var PRO_CANCEL_CHANGES = "You are leaving the Property Entry screen. Your changes have not yet been saved. \n"+
	    "To continue without saving click \'OK\'. \n"+
	    "To return to Applicant Entry screen click \'Cancel\'."

var VARIRATE_TO_PRIME_SIGN_ERROR = 'There must be a + or - character at the beginning of the value! \nExample: -1.23  or  +2.01.';
var VARIRATE_TO_PRIME_INVALID_NUMBER = 'This must be a valid number between -99.999 and +99.999.';

var NUMERALS_NOT_ALLOWED = "Numerals not allowed in Text-only field.";

var NO_ACCESS_RIGHTS = "You do not have access rights to this function.";
var NO_DEAL_VIEW_RIGHTS = "You do not have access to view any deals.";
var NO_SUBMIT_RIGHTS = "You do not have the right to submit this mortgage. It is in review";

	var MPP_CONSENTFORM_FAILED_IN_BATCH = "MPP Request and Consent Form document failed to be generated, \nplease ensure the appropriate information has been entered and try again.";
	var MAPP_FAILED_IN_BATCH = "MPP document generation currently unavailable.";
	var CONSENTFORM_FAILED_IN_BATCH = "Consent Form document failed to be generated, \nplease ensure the appropriate information has been entered and try again.";
	var MAPP_FAILED_WITH_COMMITMENT = "MPP document generation currently unavailable. \nCommitment document created without the MPP document attached.";
	var MAPP_FAILED_WITH_MORTGAGEAPPFORM = "MPP document generation currently unavailable. \nMortgage Application document created without the MPP document attached.";
	var BLANK_APPLICATIONS_REPORT = "There were no records found based on the criteria you have selected.";
	var NO_LENDER_SELECTED = "Lender Name selection is required when the lender type is specified." ;
	var TOO_MANY_ROWS_ON_PDF = "The report has exceeded the maximum of 5000 rows. \nPlease refine your search criteria.";	
	var NO_SOLICITOR_MESSAGE = "The Solicitor information is missing.\nThe system will not allow you to print the letter \nunless this information is completed.";
	var TASK_NOT_SAVED_YET = "You are now leaving the Tasks screen. \nAny unsaved changes will be lost. \nDo you wish to proceed?";
		var INPUT_VALUE_RANGE_2X3DECIMAL = "You must enter a value between %.3f and %.3f !"
*/	
//==================================
//  Code block required for printf()
//==================================

var newline = (navigator.appVersion.lastIndexOf('Win') != -1) ? "\r\n" : "\n"
var string_constant_blank = "                                  "
var string_constant_zero  = "0000000000000000000000000000000000"

function err100(string)
{
  alert(string)
}

function isSpecificChar(c)
{
  return "0123456789.".indexOf(c) == -1 ? 0 : 1
}

function printf(arg)
{
  var i, c, c2, c3, ww, pointer = 1, w = 0, d = 0, left, period
  var format = printf.arguments[0]
  var line = ""

  for (i = 0; i < format.length; i++)
  {
    c = format.charAt(i)

    if (c == "\n")
    {
      if (line == "") line = " "
      line += newline
    }
    else if (c == "%")
    {
      left = 0
      i++
      c2 = format.charAt(i)

      if (c2 == "%")
      {
	line += c2
	continue
      }
      else if (c2 == "-")
      {
	left = 1
	c2 = format.charAt(++i)
      }

      if (isSpecificChar(c2))
      {
	period = 0
	w = 0
	d = 0

	while ((c3 = format.charAt(i)) != "s" && c3 != "f" && c3 != "g" && c3 != "i" && c3 != "d")
	{
	  if (c3 == ".")
	  {
	    period = 1
	  }
	  else if (isSpecificChar(c3) == 0)
	  {
	    err100("non digit after % ("+c3+")")
	  }
	  else if (period == 0)
	  {
	    w = w*10+eval(c3)
	  }
	  else if (period == 1)
	  {
	    d = d*10+eval(c3)
	  }
	  i++
	}

	if (c3 == "s")
	{
	  line += print_string(left, w, printf.arguments[pointer++])
	}
	else if (c3 == "g" || c3 == "f")
	{
	  line += print_number(c3, w, d, printf.arguments[pointer++])
	}
	else if (c3 == "i" || c3 == "d")
	{
	  line += print_number(c3, w, 0, printf.arguments[pointer++])
	}
      }
      else if (c2 == "s")
      {
	line += print_string(left, 0, printf.arguments[pointer++])
      }
      else if (c2 == "f")
      {
//For bug #1188
//	line += print_number(c2, 0, 3, printf.arguments[pointer++])
	line += print_number(c2, 0, 2, printf.arguments[pointer++])
      }
      else if (c2 == "g")
      {
	line += print_number(c2, 0, 6, printf.arguments[pointer++])
      }
      else if (c2 == "i" || c2 == "d")
      {
	line += print_number(c2, 0, 0, printf.arguments[pointer++])
      }
    }
    else
    {
      line += c
    }
  }
  return line
}

function my_length(str)
{
  var i, c
  var retv = 0

  for (i = 0; i < 200; i++)
  {
    if ((c = str.charAt(i)) == "")
    {
      break
    }
    else if (c > "~")
    {
      retv += 2
    }
    else
    {
      retv++
    }
  }
  return retv
}

function print_string(left, w, arg)
{
  var ww, temp
  var line = ""

  if (w != 0)
  {
    ww = my_length(""+arg)
    if (left == 1)
    {
      line += (ww > w) ? arg : arg+string_constant_blank.substring(0, w-ww)
    }
    else
    {
      line += (ww > w) ? arg : string_constant_blank.substring(0, w-ww)+arg //@@
    }
  }
  else
  {
    line += arg
  }

  return line
}

function print_number(gf, w, d, number)
{
  var num

  if (gf == "g")
  {
    num = print_number_g(w, d, number)
  }
  else if (gf == "f")
  {
    num = print_number_f(w, d, number)
  }
  else if (gf == "i" || gf == "d")
  {
    num = print_number_i(w, d, number)
  }

  return num
}

function print_number_i(w, d, number)
{
  var s, p, ww
  s = fixed2(number, d)
  ww = (""+s).length
  if (ww < w)
  {
    s = string_constant_blank.substring(0, w-ww)+s
  }
  return s
}

function print_number_f(w, d, number)
{
  var s, p, ww
  s = fixed2(number, d)

  if ((""+s).charAt(0) == ".")
  {
    s = "0"+s
  }
  else if ((""+s).indexOf("-.") != -1)
  {
    s = "-0"+(""+s).substring(1, (""+s).length)
  }

  if ((""+s).indexOf(".") == -1)
    s += "."

  ww = (""+s).length-1
  p = (""+s).indexOf(".")

  if (ww-p < d)
    s += string_constant_zero.substring(0, d-(ww-p))

  ww = (""+s).length

  if (ww < w)
    s = string_constant_blank.substring(0, w-ww)+s

  return s
}

function print_number_g(w, d, number)
{
  var abs = Math.abs(number)

  if (number == 0 || (0.001 <= abs && abs < Math.pow(10, d)))
  {
    return print_number_g2(w, d, number)
  }
  else
  {
    return print_number_e(w, d, number)
  }
}

function print_number_g2(w, d, number)
{
  var s, p, ww, abs, temp
  abs = Math.abs(number)
  if (number == 0)
  {
    temp = 1
  }
  else if (abs >= 1)
  {
    temp = d-(""+Math.floor(abs)).length
  }
  else
  {
    temp = d-1

    while (abs < 1)
    {
      temp++
      abs *= 10
    }
  }
  s = fixed2(number, temp)
  if ((""+s).charAt(0) == ".")
  {
    s = "0"+s
  }
  else if ((""+s).indexOf("-.") != -1)
  {
    s = "-0"+(""+s).substring(1, (""+s).length)
  }

  if ((""+s).indexOf(".") == -1)
    s += "."

  ww = (""+s).length
  ww -= (number < 0 ? 1 : 0)+(Math.abs(number) < 1 ? 1 : 0)+1

  if (ww < d)
    s += string_constant_zero.substring(0, d-ww)

  ww = (""+s).length

  if (ww < w)
    s = string_constant_blank.substring(0, w-ww)+s

  return s
}

function print_number_e(w, d, number)
{
  var s, p, ww, exponent, sign, abs, temp
  w -= 4
  exponent = 0
  abs = Math.abs(number)

  while (abs < 1)
  {
    exponent--
    abs *= 10
  }

  while (abs >= 10)
  {
    exponent++
    abs /= 10
  }

  temp = (number < 0 ? -1 : 1)*abs
  return print_number_f(w, d-1, temp)+"e"+(exponent < 0 ? "-" : "+")+rec(exponent)
}

function rec(expo)
{
  expo = Math.abs(expo)
  return (expo < 10) ? "0"+expo : ""+expo
}

function fixed2(x, d)
{
  return Math.round(x*Math.pow(10,d))/Math.pow(10,d)
}
//======================================
//  End code block required for printf()
//======================================



