function processCookie(sCookie) {
	var nPos = sCookie.indexOf('=');
	var sName = sCookie.substring(0, nPos);
	
	switch(sName) {
		case 'section_1':
			// Section 1
			var oSection = oSections.getSection(1);
			var sValue = getCookie(sCookie, sName);
			processYesNo(sValue, oSection);
			
			// Section 2
			var oSection = oSections.getSection(2);
			var sValue = getCookie(sCookie, 'section_2');
			var aQuestions = sValue.split('_');
			
			for (var nCounter = 0; nCounter < aQuestions.length; nCounter++) {
				var sQuestion = aQuestions[nCounter];
				var aData = sQuestion.split(':');
				
				var oQuestion = oSection.getQuestion(aData[0]);
				
				if (nCounter == 0) {
					oQuestion.addChosenAnswer('answer', aData[1]);
					oQuestion.bIsCurrent = (aData[2] == 1 ? true : false);
					oQuestion.bIsCompleted = (aData[3] == 1 ? true : false);
				}
				else {
					if (aData[1] != '') {
						oQuestion.addChosenAnswer('Persoon1', aData[1]);
					}
					if (aData[2] != '') {
						oQuestion.addChosenAnswer('Persoon2', aData[2]);
					}

					oQuestion.bIsCurrent = (aData[3] == 1 ? true : false);
					oQuestion.bIsCompleted = (aData[4] == 1 ? true : false);
				}
			}
			
			// Section 3.4
			var oSection = oSections.getSection(3);
			var oSubSection = oSection.getSection(4);
			var sValue = getCookie(sCookie, 'section_3-4');
			processYesNo(sValue, oSubSection);
			
			// Section 3.5
			var oSection = oSections.getSection(3);
			var oSubSection = oSection.getSection(5);
			var sValue = getCookie(sCookie, 'section_3-5');
			processYesNo(sValue, oSubSection);
			
			// Section 3.6
			var oSection = oSections.getSection(3);
			var oSubSection = oSection.getSection(6);
			var sValue = getCookie(sCookie, 'section_3-6');
			processYesNo(sValue, oSubSection);
			
			// General info
			var sValue = getCookie(sCookie, 'availability');
			processAvailability(sValue);
			break;

		case 'section_3-1_part_1':
		case 'section_3-1_part_2':
		case 'section_3-1_part_3':
			var oSection = oSections.getSection(3);
			var oSubSection = oSection.getSection(1);
			var sValue = getCookie(sCookie, sName);
			processMultipeFields(sValue, oSubSection);
			break;

		case 'section_3-2_part_1':
		case 'section_3-2_part_2':
		case 'section_3-2_part_3':
			var oSection = oSections.getSection(3);
			var oSubSection = oSection.getSection(2);
			var sValue = getCookie(sCookie, sName);
			processMultipeFields(sValue, oSubSection);
			break;

		case 'section_3-3_part_1':
		case 'section_3-3_part_2':
			var oSection = oSections.getSection(3);
			var oSubSection = oSection.getSection(3);
			var sValue = getCookie(sCookie, sName);
			processMultipeFields(sValue, oSubSection);
			break;
	}
}


function processYesNo(sCookieValue, oSection) {
	var aQuestions = sCookieValue.split('_');
			
	for (var nCounter = 0; nCounter < aQuestions.length; nCounter++) {
		var sQuestion = aQuestions[nCounter];
		var aData = sQuestion.split(':');
				
		var oQuestion = oSection.getQuestion(aData[0]);
		oQuestion.addChosenAnswer('answer', aData[1]);
		oQuestion.bIsCurrent = (aData[2] == 1 ? true : false);
		oQuestion.bIsCompleted = (aData[3] == 1 ? true : false);
	}
}


function processMultipeFields(sCookieValue, oSection) {
	var aQuestions = sCookieValue.split('__');
			
	for (var nCounter = 0; nCounter < aQuestions.length; nCounter++) {
		var sQuestion = aQuestions[nCounter];
		var aData = sQuestion.split('::');
				
		var oQuestion = oSection.getQuestion(aData[0]);
		oQuestion.addChosenAnswer('BedragPersoon1', aData[1]);
		oQuestion.addChosenAnswer('BedragPersoon2', aData[2]);
		oQuestion.addChosenAnswer('RegelingPersoon1', aData[3]);
		oQuestion.addChosenAnswer('RegelingPersoon2', aData[4]);
		oQuestion.bIsCurrent = (aData[5] == 1 ? true : false);
		oQuestion.bIsCompleted = (aData[6] == 1 ? true : false);
	}
}


function processAvailability(sCookieValue) {
	var aSections = sCookieValue.split('_');
			
	for (var nCounter = 0; nCounter < aSections.length; nCounter++) {
		var sSection = aSections[nCounter];
		var aData = sSection.split(':');
		var oSection = oSections.getSection(aData[0]);

		if (nCounter < 3) {
			oSection.bIsAvailable = (aData[1] == 1 ? true : false);
			oSection.bIsCompleted = (aData[2] == 1 ? true : false);
		}
		else {
			var oSubSection = oSection.getSection(aData[1]);
			oSubSection.bIsAvailable = (aData[2] == 1 ? true : false);
			oSubSection.bIsCompleted = (aData[3] == 1 ? true : false);
		}
	}
}


