var pointsPerDollar = 1;
var bonusPoints = 0;
var pointsPerFlight = 15000;
var pointsPerEsso = 6500;
var pointsPerHardware = 6500;
var currentPoints = 0;
var currentFlights = 0;
var optionSB = 0
var ddmiles = 0;		//direct deposit miles
var pamiles = 0;		//pre auth miles
var rewardType = 0;
var rewardUnit = 0;
var rewardImage = 0;
var rewardImageWidth = 0;
var rewardImageHeight = 0;
//var trakingID = "";

//tracking id and option variables located on specific pages.

/* if needed add to end of newCustomWindow
if((window.location.href).indexOf('visa')!='-1'){	
	trakingID=";&WT.mc_id=FC08-017";
}
else{
	trakingID=";&WT.mc_id=FC08-018";
}
*/
//defining month variables added sep 15 08
var oct = 0;
var nov = 0;
var dec = 0;

/********* Personal Banking ****************/

function addCommas(nStr)	{
	if((window.location.href).indexOf('-fr.html')!='-1') {
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + '&nbsp;' + '$2');
	}
	return x1 + x2;
	
	}else {
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
	
	}
}

function updatePoints(){
	oct = 0;
	nov = 0;
	dec = 0;
 	var validationStatus = true;			//Validation Begins -blank fields and special characters
  
  	if (option == '1' || option == "3"){
  		if(document.VisaTool.MonthlyPurchaseAmount.value== ''){
			if((window.location.href).indexOf('-fr.html')!='-1'){
				alert('Veuillez entrer la valeur approximative de vos autres achats mensuels.');
			}else{
				alert('Please enter the approximate value of your monthly purchases.');
			}
			validationStatus = false;
		}
		else if(!patternValidate(removeCurrencyFormatting(document.VisaTool.MonthlyPurchaseAmount.value),'currency')){
			if((window.location.href).indexOf('-fr.html')!='-1'){
				alert('Veuillez entrer la valeur approximative de vos autres achats mensuels.');
			}else{
				alert('Please enter the approximate value of your monthly purchases.');
			}
			validationStatus = false;
		}
		else if(document.VisaTool.OtherMonthlyPurchaseAmount.value== ''){
			if((window.location.href).indexOf('-fr.html')!='-1'){
				alert('Veuillez entrer la valeur approximative de vos autres achats mensuels.');
			}else{
				alert('Please enter the approximate value of your other monthly purchases.');
		}
		validationStatus = false;
		}
		else if(!patternValidate(removeCurrencyFormatting(document.VisaTool.OtherMonthlyPurchaseAmount.value),'currency')){		
			if((window.location.href).indexOf('-fr.html')!='-1'){
				alert('Veuillez entrer la valeur approximative de vos autres achats mensuels.');
			}else{
				alert('Please enter the approximate value of your other monthly purchases.');
		}
		validationStatus = false;
		}
   	} //end of option 1 & 3 **************************************validation
  
  
	//if the validations are successfull do the following
	if(validationStatus){
		if((window.location.href).indexOf('-fr.html')!='-1'){
			newCustomWindow("/ca/visa/article-tools/aeroplan-calc-fr.html?" + option + ";" + 0 + ";" +oct+ ";" +nov+ ";" +dec+ ";" + document.VisaTool.MonthlyPurchaseAmount.value + ";" + document.VisaTool.OtherMonthlyPurchaseAmount.value + trakingID, "750", "790");	
		}else{
			newCustomWindow("/ca/visa/article-tools/aeroplan-calc.html?" + option + ";" + 0 + ";" +oct+ ";" +nov+ ";" +dec+ ";" + document.VisaTool.MonthlyPurchaseAmount.value + ";" + document.VisaTool.OtherMonthlyPurchaseAmount.value + trakingID, "750", "790");	
		}			
	}
				
		
}//end function update 
