//==============================================================================================
// Copyright Surfocracy Ltd, 2004
// Contact: info@surfocracy.com
// No part of this file may be re-used, republished or distributed under any circumstances
// without the permission of Surfocracy Ltd. Any web site found to be containing any content
// copyrighted to Surfocracy Ltd shall be reported for copyright infringement, followed by
// legal action if necessary.
//----------------------------------------------------------------------------------------------
// File   : javascript-paypal.js
// Scope  : COMMON  (refer to /includes/readme.txt for explanation)
// Version: 1.0
// Description:  These functions are specifically for the payPal launch pages.
// Version control
//==============================================================================================
//   Date        | Changed by |     Description
//==============================================================================================
//  17-March-2005     VLD          First issue 1.0
//
//==============================================================================================
//   
function validateFloat(obj, nLength, nPrecision){

	var strVal = new String(obj.value);
	var nIndexOfDot = strVal.indexOf('.');
	var nValidLength = nIndexOfDot==-1?strVal.length:strVal.length+1
	if(nValidLength<strVal.length){
		alert('Maximum length can be '+nLength);
		strVal = strVal.substring(0,nValidLength);
	}
	if(strVal.charAt(strVal.length-1)!='.' || nIndexOfDot!=(strVal.length-1)){
		if(isNaN(parseFloat(strVal))){
			strVal='0';
		}
		obj.value=parseFloat(strVal);
	}

	if(-1!=nIndexOfDot && strVal.substring(nIndexOfDot+1).length>nPrecision){
		strVal=strVal.substring(0, strVal.length-1);
		obj.value=strVal;
	}
}

function validateform()
{
	if(document.recurring.a3.value*10/10==0){
			alert("Please enter valid amount");
			document.recurring.a3.focus();
			return false;
	}
}
