"use strict";
(essent.cookie = function () {
	var read, write;
	read = function () {
		var r, c;
		c = new String($.cookie('essentisolatietest'));
		r = "";
		if (c !== undefined) {
			try {
				c =  c.split(',');
				r = {
					rekenwaarden: {
						bouwjaar: c[0],
						woning: c[1],
						kruipruimte: c[2],
						vloeroppervlak: c[3],
						muuroppervlak: c[4]
					},
					resultaat: {
						muur: {
							oppervlak: c[5],
							reductie: c[6],
							investering: c[7],
							besparing: c[8]
						},
						vloer: {
							oppervlak: c[9],
							reductie: c[10],
							investering: c[11],
							besparing: c[12]
						},
						totaal: {
							reductie: c[13],
							besparing: c[14]
						}
					}
				};
			}
			catch (err) {
				alert("er is iets fout gegaan");
				/* do nothing */
			}
		}
		return r;
	};
	write = function (rekenwaarden, resultaat) {
			var ck = [];
			ck.push(rekenwaarden.bouwjaar);
			ck.push(rekenwaarden.woning);
			ck.push(rekenwaarden.kruipruimte);
			ck.push(rekenwaarden.vloeroppervlak);
			ck.push(rekenwaarden.muuroppervlak);
			ck.push(resultaat.muur.oppervlak);
			ck.push(resultaat.muur.reductie);
			ck.push(resultaat.muur.investering);
			ck.push(resultaat.muur.besparing);
			ck.push(resultaat.vloer.oppervlak);
			ck.push(resultaat.vloer.reductie);
			ck.push(resultaat.vloer.investering);
			ck.push(resultaat.vloer.besparing);
			ck.push(resultaat.totaal.reductie);
			ck.push(resultaat.totaal.besparing);
			$.cookie('essentisolatietest', ck.join(','));
		};
	return {
		read: read,
		write: write
	};
}());

