
// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

function createWorkItem(dir,fileName,minWidth,maxWidth)
{
}

// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

function createWorkItemContent(dir, xmlDoc, minWidth)
{
	var title = getNodeContent(xmlDoc,"title");
	var projectStart = getNodeContent(xmlDoc,"project-start");
	var lastUpdate = getNodeContent(xmlDoc,"last-update");
	
	var shortDescription = getNodeContent(xmlDoc,"short-description");
	var indexLink = getNodeContent(xmlDoc,"index-link");

	var descriptionMinWidth = 300;

	if ((projectStart != undefined) || (title != undefined))
	{
		document.write("	<div style=\"max-height: 200px; overflow:hidden; width: " + minWidth + "px; \">");

		if (title != undefined)
		{
			document.write("<div class=\"work-item-title\">");
			if (indexLink != undefined)
			{
//				document.write("<a href=\"" + dir + indexLink + "\">" + title + "</a>");
				document.write("<a href=" + quoted(dir) + ">" + title + "</a>");
			}
			else
			{
				document.write(title);
			}
			document.write("</div>");
			
		}

		if (projectStart != undefined)
		{
			document.write("		    <div class=\"work-item-date\">");
			document.write("			   " + projectStart);
			document.write("		    </div>");			
		}

		if ( ((title != undefined) || (projectStart != undefined)) && (shortDescription != undefined))
		{
			document.write("	<div style=" + quoted("float: left; height: 20px; clear: left;") + "></div>");
		}

		if (shortDescription != undefined)
		{
			shortDescription = formatHtml(shortDescription);

			document.write("	<div style=" + quoted("height: 20px") + "></div>");
			document.write("		    <div class=\"work-item-description\">");
			document.write("			   " + shortDescription);
			document.write("		    </div>");
		}
	
		document.write("	<div>");
	}
}

// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

function createWorkItemLeft(dir,fileName,minWidth,maxWidth)
{
	var xmlDoc = parseXmlFile(dir + fileName);

	var title = getNodeContent(xmlDoc,"title");
	var projectStart = getNodeContent(xmlDoc,"project-start");
	var lastUpdate = getNodeContent(xmlDoc,"last-update");

	var thumbnails = xmlDoc.getElementsByTagName('thumbnail');
	if (thumbnails.length > 0)
	{
		var randIndex = Math.floor(thumbnails.length*Math.random());
		db('rand' + randIndex);
		var thumbnail = thumbnails[randIndex].childNodes[0].nodeValue;
		thumbnail = formatHtml(thumbnail);
	}

	var shortDescription = getNodeContent(xmlDoc,"short-description");
	var indexLink = getNodeContent(xmlDoc,"index-link");

	var descriptionMinWidth = 300;

	document.write("<table class=\"columns-layout-item\" vbrl-float=" + quoted("whole-row") + " style=\"background-color: " + itemColor + ";\" force-line-break=\"true\">");
	document.write("	<tr>");

	createRoundedTop();

	document.write("	</tr>");
	document.write("	<tr>");
	document.write("		<td></td>");

	// Content
	document.write("		<td>");

	// ---

	document.write("<table width=auto style=\"background-color: " + itemColor + ";\">");
	document.write("	<tr>");
	document.write("		<td>");

	if (thumbnail != undefined)
	{
		if (indexLink != undefined)
		{
			document.write("				<a href=" + quoted(dir) + ">");
			document.write("					<img src=" + quoted(thumbnail) + ">");
			document.write("</a>");
		}
		else
		{
			document.write("				<img src=" + quoted(dir + thumbnail) + ">");
		}
	}

	document.write("</td>");

//	if (thumbnail != undefined)
	{
//		document.write("		<td style=\"min-width:10px;\"></td>"); // Spacing between the image and the description.
		document.write("		<td><div style=" + quoted("display:block; width:10px;") + "></div></td>"); // Spacing between the image and the description.
	}

//	document.write("		<td valign=top style=\"background-color: rgb(0,200,0);\">");
	document.write("		<td valign=top style=\"\">");

	createWorkItemContent(dir, xmlDoc, minWidth);

	document.write("		</td>");

	// If no thumbnail is provided, add an extra margin at the right
	if (thumbnail == undefined)
	{
		document.write("		<td><div style=" + quoted("display:block; width:10px;") + "></div></td>"); // Spacing between the image and the description.
	}

	
	document.write("	</tr>");
	document.write("</table>");


	
	document.write("		</td>");

	document.write("		<td></td>");
	document.write("	</tr>");
	document.write("	<tr>");

	createRoundedBottom();

	document.write("	</tr>");
	document.write("</table>");
}

// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

function createWorkItemRight(dir,fileName,minWidth,maxWidth)
{
	var xmlDoc = parseXmlFile(dir + fileName);

	var title = getNodeContent(xmlDoc,"title");
	var projectStart = getNodeContent(xmlDoc,"project-start");
	var lastUpdate = getNodeContent(xmlDoc,"last-update");

	var thumbnail = getNodeContent(xmlDoc,"thumbnail");
	thumbnail = formatHtml(thumbnail);

	var shortDescription = getNodeContent(xmlDoc,"short-description");

	var descriptionMinWidth = 300;

	document.write("<table class=\"columns-layout-item\" vbrl-float=" + quoted("whole-row") + " style=\"background-color: " + itemColor + ";\" force-line-break=\"true\">");
//	document.write("<table class=\"rows-layout-item\"; style=\"background-color: rgb(50,50,50);\">");
	document.write("	<tr>");

	createRoundedTop();

	document.write("	</tr>");
	document.write("	<tr>");
	document.write("		<td></td>");

	// Content
	document.write("		<td>");

	// ---

	document.write("<table width=auto style=\"background-color: " + itemColor + ";\">");
	document.write("	<tr>");
	
	document.write("		<td style=\"min-width:10px;\"></td>");
	document.write("		<td valign=top style=\"\">");

	createWorkItemContent(dir, xmlDoc, minWidth);

	document.write("		</td>");

	// Image
	document.write("		<td>");
	document.write("				<img src=\"" + dir + thumbnail + " \">");
	document.write("		</td>");

	document.write("	</tr>");
	document.write("</table>");


	
	document.write("		</td>");

	document.write("		<td></td>");
	document.write("	</tr>");
	document.write("	<tr>");

	createRoundedBottom();

	document.write("	</tr>");
	document.write("</table>");
}

// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

