
	function load() {
		
		document.FormBestilling.ID_textareaName_1BF22D364EF2020.value = displayCookie();
		
		
	}


	function displayDebug(text) {
		debugtext.value = debugtext.value +"\n"+ text;
	}


	function addItem(title, price) {
		var cookiedata = readCookie();
		//displayDebug("addItem - "+cookiedata);
		//displayDebug("addItem - "+cookiedata +","+ title);
		saveCookie(cookiedata +"%"+ title +" ("+price+" DKK)");
		alert('Bogen er blevet tilfojet. Bestil under Bestillingsliste i menuen. The book has been added. Order under Orderlist in the menu');
	}


	function saveCookie(data) {
		var date = new Date();
		date.setTime(date.getTime()+(24*60*60*1000)); 
		var expires = "; expires="+date.toGMTString(); 
		//displayDebug("saveCookie - liste="+data+expires+"; path=/");
		document.cookie = "liste="+data+expires+"; path=/"; 
	}


	function readCookie() { 
		//displayDebug("readCookie - "+document.cookie);
		var nameEQ = "liste="; 
		var ca = document.cookie.split(';'); 
		for(var i=0;i < ca.length;i++) { 
			var c = ca[i]; 
			while (c.charAt(0)==' ') c = c.substring(1,c.length); 
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		} 
		return ""; 
	}
	
	
	function displayCookie() {
		var theData = String(readCookie());
		//displayDebug(theData);
		var niceList = "";
		if (theData) {
			theData = theData.split('%');
			for(var i=0;i < theData.length;i++) { 
				niceList = niceList + theData[i] +"\n\n";
			}
		} else {
		return "";
		}
		return niceList;
	}
	
	
	function clearCookie() {
		document.cookie = "liste=; expires=-1; path=/"; 
	}

