function BMRCalculator (type) {
	this.type = type;

	this.heightInches = null;
	this.heightFeet = null;
	this.heightCms = null;
	this.cmsSet = false;

	this.weightKg = null;
	this.age = null;
	this.gender = null; // 1 = male, 2 = female
	this.activityLevel = null; //1 = low, 2 = light, 3 = moderate, 4 = high 5 = very high
	
	
	
	this.BMI = null;
	this.BMICategory = null;
	this.BMR = null;
	this.BMRAdjusted1 = null;
	this.BMRAdjusted2 = null;
	this.BMRAdjusted3 = null;
	this.BMRAdjusted4 = null;
	this.BMRAdjusted5 = null;
	this.maintananceCal = null;
	this.lose1Cal = null;
	this.lose2Cal = null;
	
	this.BMR2 = null;
	this.BMR2Adj1 = null;
	this.BMR2Adj2 = null;
	this.BMR2Adj3 = null;
	this.BMR2Adj4 = null;
	this.BMR2Adj5 = null;
	
}
	
	this.setAge = function(ageInput) {
		this.age = parseFloat(ageInput);
	}

//	this.setActivityLevel = function(activityLevelInput) {
//		this.activityLevel = parseFloat(activityLevelInput);
//	}


	this.setHeightFtInches = function(feet, inches) {
		this.heightInches = parseFloat(inches);
		this.heightFeet = parseFloat(feet);
		this.cmsSet = false;
	}

	this.setHeightCms = function(cms) {
		this.heightCms = parseFloat(cms);
		this.cmsSet = true;
	}

	this.setWeightKg = function(kgs) {
		this.weightKgs = parseFloat(kgs);
	}

	this.setWeightLbs = function(lbs) {
		this.weightKgs = parseFloat(lbs) * 0.45359237;
	}
	
	this.setGender = function(genderInput) {
		this.gender = genderInput;
	}
	
	this.calculateInfo = function() {
		if (!this.cmsSet){
			var heightInInches = this.heightInches + (12 * heightFeet);
			var heightInCm = heightInInches * 2.54;
		} else {
			var heightInCm = this.heightCms;
			var heightInInches = heightInCm / 2.54;
		}


		var weightInLbs = this.weightKgs * 2.20462262;

		
		this.BMI = (weightInLbs * 703)/(heightInInches * heightInInches);



		if (this.BMI < 16.5) this.BMICategory = 1;
		else if (this.BMI < 18.5) this.BMICategory = 2;
		else if (this.BMI < 25) this.BMICategory = 3;
		else if (this.BMI < 30) this.BMICategory = 4;
		else this.BMICategory = 5;



		this.BMR = (9.99 * this.weightKgs) + (6.25 * heightInCm) - (4.92 * this.age);
		if (this.gender == 1){// male
			this.BMR += 5;
			this.BMR2 = (13.7516 * this.weightKgs) + (5.0033 * heightInCm) - (6.755 * this.age) + 66.473;
		} else { // female
			this.BMR -= 161;
			this.BMR2 = (9.5634 * this.weightKgs) + (1.8496 * heightInCm) - (4.6756 * this.age) + 655.0955;
		}
		
			this.BMRAdjusted1 = this.BMR * 1.2;
			this.BMR2Adjusted1 = this.BMR2 * 1.2;
			this.BMRAdjusted2 = this.BMR * 1.375;
			this.BMR2Adjusted2 = this.BMR2 * 1.375;
			this.BMRAdjusted3 = this.BMR * 1.55;
			this.BMR2Adjusted3 = this.BMR2 * 1.55;
			this.BMRAdjusted4 = this.BMR * 1.725;
			this.BMR2Adjusted4 = this.BMR2 * 1.725;
			this.BMRAdjusted5 = this.BMR * 1.9;
			this.BMR2Adjusted5 = this.BMR2 * 1.9;
	
		this.maintananceCal = this.BMRAdjusted;
		this.lose1Cal = this.BMRAdjusted-500;
		this.lose2Cal = this.BMRAdjusted-1000;
	

	}
	
	this.getBMIString = function(){
		var returnStr = "<b>BMI: " + Math.round(this.BMI*10)/10;
		if (age >= 17) {
			if (this.BMI < 16.5) returnStr += " (Severely underweight)";
			else if (this.BMI < 18.5) returnStr += " (Underweight)";
			else if (this.BMI < 25) returnStr += " (Normal)";
			else if (this.BMI < 30) returnStr += " (Overweight)";
			else returnStr += " (Obese)";
		}
		returnStr += "</b>";
		return returnStr;
	}

	this.getBMRString = function(){
		return "<b>Your BMR: " + Math.round(this.BMR) + " Calories/Day</b>";
	}
	
	this.getBMRAdjusted1String = function(){
		return "<b>" + Math.round(this.BMRAdjusted1) + " Calories/Day</b>";
	}

	this.getBMRAdjusted2String = function(){
		return "<b>" + Math.round(this.BMRAdjusted2) + " Calories/Day</b>";
	}
	this.getBMRAdjusted3String = function(){
		return "<b>" + Math.round(this.BMRAdjusted3) + " Calories/Day</b>";
	}
	this.getBMRAdjusted4String = function(){
		return "<b>" + Math.round(this.BMRAdjusted4) + " Calories/Day</b>";
	}
	this.getBMRAdjusted5String = function(){
		return "<b>" + Math.round(this.BMRAdjusted5) + " Calories/Day</b>";
	}
	this.getBMRAdjustedString = function(){
		return "<b>Calories Burned Per Day:<br>" + Math.round(this.BMRAdjusted) + " Calories/Day</b>";
	}
	
	

	this.getBMR2String = function(){
		return "<b>Your BMR: " + Math.round(this.BMR2) + " Calories/Day</b>";
	}
	
	this.getBMR2Adjusted1String = function(){
		return "<b>" + Math.round(this.BMR2Adjusted1) + " Calories/Day</b>";
	}
	this.getBMR2Adjusted2String = function(){
		return "<b>" + Math.round(this.BMR2Adjusted2) + " Calories/Day</b>";
	}
	this.getBMR2Adjusted3String = function(){
		return "<b>" + Math.round(this.BMR2Adjusted3) + " Calories/Day</b>";
	}
	this.getBMR2Adjusted4String = function(){
		return "<b>" + Math.round(this.BMR2Adjusted4) + " Calories/Day</b>";
	}
	this.getBMR2Adjusted5String = function(){
		return "<b>" + Math.round(this.BMR2Adjusted5) + " Calories/Day</b>";
	}
	this.getBMR2AdjustedString = function(){
		return "<b>Adjusted for Activity: " + Math.round(this.BMR2Adjusted) + " Calories/Day</b>";
	}

	
	
	this.getFoodConsumtionString = function(){
	
		if (this.BMRAdjusted < 1200) {
			return "" + Math.round(this.BMRAdjusted) + " Calories/day should maintain your current weight however " +
			"about.com " +
			"recommends you should not adopt a diet with less than 1200 calories a day as this is unhealthy. " +
			"As such, you may need to increase your calorie intake.";
		}


		if (this.BMICategory == 1){
			return "" + Math.round(this.BMRAdjusted) + " Calories a day should maintain your current weight, however " +
			"your BMI " +
			"indicates you are severely underweight and as such may need to increase your calorie intake " +
			"and consult a doctor.  Each increase of 500 Calories a day should result in approximately " +
			"1lb of weight gain a week.  ";
		}


		if (this.BMICategory == 2){
			return "" + Math.round(this.BMRAdjusted) + " Calories a day should maintain your current weight, however " +
			"your BMI " +
			"indicates you are underweight.  Increasing this calorie intake by 500 Calories a day should " +
			"result in gaining approximately 1lb a week.";
		}

		var returnStr = "<b>" + Math.round(this.BMRAdjusted) + " Calories/day</b> should maintain your current weight.<br>";
		var useBMRWarning = false;
		var useMaleWarning = false;
		if (this.lose1Cal > 1250) {
			returnStr += "<br><b>" + Math.round(this.lose1Cal) + " Calories/day</b> should lose approx. 1lb of fat a week.";
			if (this.lose1Cal < this.BMR){
				returnStr += " *";
				useBMRWarning = true;
			}
			if (this.lose1Cal < 1800 && this.gender == 1){
				returnStr += " **";
				useMaleWarning = true;
			}
			returnStr += "<br>";
		}

		if (this.lose2Cal > 1250) {
			returnStr += "<br><b>" + Math.round(this.lose2Cal) + " Calories/day</b> should lose approx. 2lbs of fat a week.";
			if (this.lose2Cal < this.BMR){
				returnStr += " *";
				useBMRWarning = true;
			}
			if (this.lose2Cal < 1800 && this.gender == 1){
				returnStr += " **";
				useMaleWarning = true;
			}
			returnStr += "<br>";
		}
		if (useBMRWarning){
			returnStr += "<br><i>* Note: Some people recommend you should not reduce your calorie intake below your BMR.</i><br>";
		}
		if (useMaleWarning){
			returnStr += "<br><i>** Note: The American College of Sports Medicine (ACSM) recommends that men should not drop their calorie intake below 1800 Calories per day.</i><br>";
		}
		return returnStr;
	}

	


