function readQuicklinks(){
	
	var DEBUG = false;
	var cookies = document.cookie.split(';');
	if(DEBUG)document.write(cookies);
	//cookies is an array with all the cookies available to the current domain
	var quicklinks_exist = false;
	//if cookies nothing is in cookies, then there are no current cookies set
	if(cookies != ""){
		var code = "<div id='careertools'>QuickLinks</div>";
		
		if(DEBUG)document.write(code);
		code += "<div style='background-color:#FFEBAE;color:inherit;'>";
		if(DEBUG)document.write(code);
		code += "<ul class='careertools'>";
		if(DEBUG)document.write(code);
		
		for(var cookie_index=0; cookie_index < cookies.length; cookie_index++){
			
			if(DEBUG)document.write("inside the for loop[" + cookie_index + "]<br>");
			
			var cookie_content_array = cookies[cookie_index];
			var cookie_name_value_array = cookie_content_array.split("=");
			var cookie_name_array = cookie_name_value_array[0].split("_");
			
			if(DEBUG)document.write(cookie_name_array[0] + "<br>");
			
			if(cookie_name_array[0] == " quicklinks"){
				if(DEBUG)document.write("<b>inside the quicklinks if statement</b><br>");
				quicklinks_exist = true;
//				document.write("<div>Quick Links</div>");
				var cookie_name = "quicklinks_" + cookie_name_array[1];
				var cookie_value_array = cookie_name_value_array[1].split('|');
				var title = cookie_value_array[0];
				var url = cookie_value_array[1];
				title = title.split("_");
				var title_name = "";
				for(var title_index=0;title_index < title.length; title_index++){
					title_name += title[title_index] + " ";	
				}
				
				code += "<li class='careertools'><a href='" + url + "'>" + title_name + "</a>";
				var linkage = "<a href='?123' onClick=eraseCookie('"+cookie_name+"')>";
				//alert(linkage);
				code += linkage;
				//code += "<a href='#' onClick='eraseCookie("+cookie_name+")'>";
				code += "&nbsp;<img style='vertical-align: bottom' src='del.jpg' border='0'></a></li>";

				if(DEBUG)document.write(code);
			}
		}
		
		if(DEBUG)document.write(quicklinks_exist);
		
		if(quicklinks_exist){
			code += "</ul></div><br>";
			document.write(code);
		}

	}
}

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 QuickLinkExist(title){
	//alert(title);
	var cookies = document.cookie.split(';');
	var quicklinksexist = false;
	
	if(cookies != ""){
		//alert('here');
		for(var cookie_index=0; cookie_index < cookies.length; cookie_index++){
			//alert('here');
			var cookie_content_array = cookies[cookie_index];
			var cookie_name_value_array = cookie_content_array.split("=");
			var cookie_value_array = cookie_name_value_array[1].split('|');
			
			//alert(url1);
			

			//document.write(cookie_value_array[0] + " " + title + "<br>");
			if(cookie_value_array[0] == title){
				//alert('here');
				quicklinksexist = true;
			}			
		}		
		
		if(quicklinksexist){
			//alert('true');
			return true;
		}
			
	}
	
	return false;
}

function setQuickLinks(title){
	//alert('test');
	var url = document.location;
	var date = new Date();
	var name = "quicklinks_" + date.getTime();
	var value = title + "|" + url
	
	
	createCookie(name, value, 1000);
	
}

function OutputQuickLinks(title){
	//alert(title);
	var code="";
	var url = document.location;
	var quicklink_exist = QuickLinkExist(title);
	//alert(quicklink_exist);
	//alert(title);
	
	
	if(!quicklink_exist){
		document.write("<div style='float:right' id='quicklinks'>");
		var onclick = "onClick=setQuickLinks('"+title+"')>";
		var linkage = "<a href='' " + onclick
		code += linkage;
		code += "Add to QuickLinks</a></div>";
		//alert(code);
		document.write(code);
	}else{
		document.write("<div style='float:right' id='quicklinks'>");
		document.write("<i>Added to QuickLinks</i></div>");
		
	}
	
}



function test(foo){
	//alert(foo);	
}

function eraseCookie(name) {
	//alert('test');
	createCookie(name,"",-1);
}

