// JavaScript Document

var hostname = "http://www.doc.ic.ac.uk/~tbourden"
var hostname = ".."
var selection = ""		// ok one global var can't be that bad :) --(where has the world come?!?)

function AppendMenu(title, link)
{
	var active="";
	if (selection == title)
		active = "active";

	if (link.substring(0,4) != 'http')
		link = hostname + link
	document.write('															\
			<li class="' + active + '">											\
				<a href="' + link + '" title="">' + title + '</a>	\
			</li>																\
	');
}

function DrawNavigationMenu()
{
	document.write('			\
			<div id="menu">		\
				<ul>			\
	');

	AppendMenu("Homepage", "/homepage/index.html");
	AppendMenu("Personal", "/homepage/personal.html");
	AppendMenu("Contact",  "/homepage/contact.html");
	//AppendMenu("Blogging <img width=\"16\" height=\"16\" src=\"../images/blogger.jpg\" />", "http://bourdenas.blogspot.com/");

	document.write('	\
				</ul>	\
			</div>		\
	');
}

function AppendProject(title, link)
{
	var active="";
	if (selection == title)
		active = "active";

	document.write('														\
		<li class="' + active + '">											\
			<a href="' + hostname + link + '" title="">' + title + '</a>	\
		</li>																\
	');
}

function DrawProjects()
{
	document.write('									\
		<div id="projects" class="boxed">				\
			<h2 class="title">Research Projects</h2>	\
			<div id="prjmenu">							\
	');
	AppendProject("starfish",		"/starfish/index.html");

	document.write('	\
			</div>		\
		</div>			\
	');

	document.write('									\
		<div id="projects" class="boxed">				\
			<h2 class="title">Open Source Projects</h2>	\
			<div id="prjmenu">							\
	');

	//AppendProject("talkie",			"/talkie/index.html");
	AppendProject("sshmem",			"/sshmem/index.html");
	AppendProject("vine engine",	"/vine/index.html");

	document.write('	\
			</div>		\
		</div>			\
	');
}

function AppendUpdate(date, text, link)
{
	document.write('											\
		<ul>													\
			<li>												\
				<h3>' + date + '</h3>							\
				<p><a href="' + link + '">' + text + '</a></p>	\
			</li>												\
		</ul>													\
	');
}

function DrawUpdatesPane()
{
	document.write('								\
		<div id="updates" class="boxed">			\
			<h2 class="title">Recent Updates</h2>	\
			<div class="content">					\
	');

	AppendUpdate("Jul 5, 2009", "Moved minor stuff around", "#");
	AppendUpdate("Oct 8, 2008", "News clip added in the personal section", "../homepage/personal.html");
	AppendUpdate("Jul 9, 2008", "New site uploaded", "#");

	document.write('	\
			</div>		\
		</div>			\
	');
}

function DrawOtherLinks()
{
	document.write('								\
		<div id="updates" class="boxed">			\
			<h2 class="title">Other Links</h2>		\
			<div class="content">					\
				<ul>								\
					<li>							\
						<a href="http://www.linkedin.com/in/bourdenas" onClick="javascript: pageTracker._trackPageview(\'/links/linkedin\'); "><img src="http://www.linkedin.com/img/webpromo/btn_myprofile_160x33.gif" width="160" height="33" border="0" alt="View Themistoklis Bourdenas \'s profile on LinkedIn"/></a>	\
					</li>							\
				</ul>								\
			</div>									\
		</div>										\
	');
}

function DrawSidebar(section)
{
	selection = section;	//< setting the global selection var

	//-- Begin sidebar <div>
	document.write('			\
		<div id="sidebar">		\
	');

	//-- Draw Site Navigation Menu
	DrawNavigationMenu(section);

	//-- Draw Projects
	DrawProjects();

	//-- Draw Site Updates
	DrawUpdatesPane();

	//-- Draw Other Links
	DrawOtherLinks();

	//-- Close sidebar <div>
	document.write('	\
		</div>			\
	');

	//-- TO BE USED:
	//document.getElementById("talkie").innerHTML = submenu;
}
