function Inoculation(type) {
	this.interval;
	this.year;
	this.month;
	this.age;
	this.errors = [];
	this.type = type;
	this.months = ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'];
	
	this.setInoculationInterval = function(interval) {
		this.interval = interval;
	};
	this.getInocculationMonth = function() {
		return this.month;
	};
	this.getInocculationYear = function() {
		return this.year
	};
	this.getInocculationInterval = function() {
		return this.interval;
	};
	this.getInocculationAge = function() {
		return this.age;
	};
	this.getInocculationType = function() {
		return this.type;
	};
	this.setInoculationYear = function(year) {
		this.year = parseInt(year);
	};
	this.setInoculationMonth = function(month) {
		this.month = parseInt(month);
	};
	this.setAge = function(age) {
		this.age = parseInt(age);
	};
	this.validate = function() {

		if(this.interval == undefined){
			this.errors.push('Bitte geben Sie ein Impfintervall an.');
		}

		if(isNaN(this.year)){
			this.errors.push('Bitte geben Sie das Jahr Ihrer letzten Impfung an.');					
		}

		if(isNaN(this.month)){
			this.errors.push('Bitte geben Sie den Monat Ihrer letzten Impfung an.');					
		}

		if(isNaN(this.age)){
			this.errors.push('Bitte geben Sie Ihr Alter an.');					
		}else if (this.interval == 6 && this.age < 60) {
			this.errors.push('Bitte überprüfen Sie die Kombination aus <br />Alter und Impfintervall.');								
		};
		
		return this.errors;
	};
	
	this.calculate = function() {
		var today = Date.today(),
			oneDay=1000*60*60*24,
			lastInoculation = Date.parseExact(this.month+"/01/"+this.year, "M/d/yyyy"),
			intervalLength = this.calculateIntervalLength(lastInoculation, today, oneDay),
			diff = Math.ceil((today.getTime()-intervalLength.getTime()) / oneDay);

		this.errors = [];
		if(this.age < 16){
			this.errors.push('Bitte verwenden Sie den FSME-Junior-Impfstoff!');					
		}
		
		yearsSinceLastInoculation = Math.floor(((today.getTime()-lastInoculation.getTime()) / oneDay)/365);
		if(this.interval == 5 && this.age-yearsSinceLastInoculation > 59){
			this.errors.push('Das Impfinterval wurde für Sie angepasst!');
		}
			
		var ret = {status: today.compareTo(intervalLength), nextInoculation: intervalLength, diff: diff, errors: this.errors};
		return ret;
	};
	
	this.calculateIntervalLength = function(lastInoculation, today, oneDay){
		var intervalLength = lastInoculation.clone();

		if(this.age >= 57 && this.interval > 3){
			intervalLength.add({ years: 3});
			return intervalLength;
		}
		
		if(this.type == 1){
			switch(this.interval){
				case '1':
				intervalLength.add({ months: 3});
				break;
				case '2':
				intervalLength.add({ months: 12});
				break;
				case '3':
				intervalLength.add({ years: 3});
				break;
				case '4':
				intervalLength.add({ years: 5});
				break;
				case '5':
				yearsSinceLastInoculation = Math.floor(((today.getTime()-lastInoculation.getTime()) / oneDay)/365);
				if(this.age-yearsSinceLastInoculation > 59){
					intervalLength.add({ years: 3});
				}else{
					intervalLength.add({ years: 5});
				}
				break;
				case '6':
				intervalLength.add({ years: 3});
				break;
			}	
		}else if(this.type == 2){
			switch(this.interval){
				case '1':
				intervalLength.add({ days: 14});
				break;
				case '2':
				intervalLength.add({ months: 12});
				break;
				case '3':
				intervalLength.add({ years: 3});
				break;
				case '4':
				intervalLength.add({ years: 5});
				break;
				case '5':
				yearsSinceLastInoculation = Math.floor(((today.getTime()-lastInoculation.getTime()) / oneDay)/365);
				if(this.age-yearsSinceLastInoculation > 59){
					intervalLength.add({ years: 3});
				}else{
					intervalLength.add({ years: 5});
				}
				break;
				case '6':
				intervalLength.add({ years: 3});
				break;
			}
		}
		
		return intervalLength;
	};
	
	this.getMonths = function() {
		return this.months;
	};
};
