var windowHandle;


function oneOnly(parm,chr,must) 
{
 var atPos = parm.indexOf(chr,0);
  if (atPos == -1) 
    {
	 return !must;
	}
  if (parm.indexOf(chr, atPos + 1) > - 1) 
   {
    return false;
   }
  return true; 
} 



function ValidateAmount(field,form1) 
{
// Make sure that the name field is not blank
  if (form1.Amount.value.length < 1 ) 
  {
    window.alert("Please enter the amount of currency.");
    form1.Amount.focus();
    return false;
  }
  
// Make sure that it is a conversion
  if (form1.From.value  ==  form1.To.value) 
  {
    window.alert("You have chosen the same currency. Please select different currencies!");
    form1.From.focus();
    return false;
  }
  // test for only one decimal point
/*  fld = stripBlanks(field);
  if (!oneOnly(fld,'.',false))
   {
    window.alert("You can enter only one decimal point! Please see 'Note'");
    form1.Amount.focus();
    return false;
   }*/
   //make sure that the decimal point is not places at the end of the number
  atPos = form1.Amount.value.lastIndexOf('.');
 
  if (((form1.Amount.value.length) -1) == atPos) 
  {
    window.alert("You have place the decimal point '.' at a wrong position!");
    form1.Amount.value = "";
	form1.Amount.focus();
	return false;
  }
  

}
