/*
This js extracts he cookie value and shows it in the HTML
*/

 function showRecent() {
	
	var lilink1 = readCookie('idlistCK_1');
	var lilink2 = readCookie('idlistCK_2');
    var lilink3 = readCookie('idlistCK_3');

	var title1 = unescape(readCookie('titleCK_1'));
	var title2 = unescape(readCookie('titleCK_2'));
	var title3 = unescape(readCookie('titleCK_3'));
  
if (title1 != "null" && document.getElementById("Link1"))
{
var rview=document.getElementById("Link1");
var liChild =document.createElement('li');
var anchorchild = document.createElement('a');
anchorchild.setAttribute('href',lilink1);
anchorchild.setAttribute('title',title1);
var text=document.createTextNode(title1);
anchorchild.appendChild(text);
liChild.appendChild(anchorchild);
rview.appendChild(liChild);
}

if (title3 != "null" && document.getElementById("Link2"))
{
var rview=document.getElementById("Link2");
var liChild =document.createElement('li');
var anchorchild = document.createElement('a');
anchorchild.setAttribute('href',lilink2);
anchorchild.setAttribute('title',title2);
var text=document.createTextNode(title2);
anchorchild.appendChild(text);
liChild.appendChild(anchorchild);
rview.appendChild(liChild);
}

if (title3 != "null" && document.getElementById("Link3"))
{
var rview=document.getElementById("Link3");
var liChild =document.createElement('li');
var anchorchild = document.createElement('a');
anchorchild.setAttribute('href',lilink3);
anchorchild.setAttribute('title',title3);
var text=document.createTextNode(title3);
anchorchild.appendChild(text);
liChild.appendChild(anchorchild);
rview.appendChild(liChild);
}

  

 }

function createCookie(name,value,days) {
		if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	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 null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}


