// kt.js - Created by Bradley J. Gibby q:)
// Version 1.0 - 20040517

function drawHeader() {
	document.writeln("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"../images/topBg.gif\">");
		document.writeln("<tr>");
			document.writeln("<td><a href=\"http://www.flexiblelearning.net.au/\" target=\"_adlsfj\"><img src=\"../images/aflfLogo.gif\" width=\"339\" height=\"26\" border=\"0\" alt=\"Australian Flexible Learning Framework\"></a></td>");
			document.writeln("<td align=\"right\"><img src=\"../images/searchBoxTop.gif\" width=\"222\" height=\"26\"></td>");
		document.writeln("</tr>");
	document.writeln("</table>");
	
	document.writeln("<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"white\">");
		document.writeln("<tr>");
			document.writeln("<td>");
				document.writeln("<a href=\"http://www.flexiblelearning.net.au/knowledgetree/index.htm\"><img src=\"../images/treeRings.jpg\" alt=\"All editions\" width=\"115\" height=\"76\" border=\"0\"></a><img src=\"../images/knowledgeTreeLogo.gif\" alt=\"The Knowledge Tree - An e-Journal of Flexible Learning in VET\" width=\"303\" height=\"76\">");
			document.writeln("</td>");
			document.writeln("<td valign=\"top\" align=\"right\">");
				document.writeln("<table width=\"222px\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" background=\"../images/searchBox.gif\">");
					document.writeln("<tr>");
						document.writeln("<td width=\"34%\"><img src=\"../images/search.gif\" alt=\"Search\" width=\"73\" height=\"36\"></td>");
						document.writeln("<td width=\"47%\"><input type=\"text\" id=\"keywords\" class=\"form-SearchBox\" /></td>");
						document.writeln("<td width=\"19%\"><a href=\"javascript:search();\"><img src=\"../images/go.gif\" alt=\"Go\" width=\"24\" height=\"36\" border=\"0\"></a></td>");
					document.writeln("</tr>");
				document.writeln("</table>");
			document.writeln("</td>");
		document.writeln("</tr>");
	document.writeln("</table>");
}

function downloadable(path) {
	var ext = path.substring(path.length - 4);
	
	var icon = "";
	var fileType = "";
	
	if (ext == ".doc") {
		icon = "../images/iconDoc.gif";
		fileType = "Word Document";
	} else if (ext == ".pdf") {
		icon = "../images/iconPdf.gif";
		fileType = "Adobe PDF Document";
	} else if (ext == ".wmv") {
		icon = "../images/iconWmv.gif";
		fileType = "Windows Media Document";
	} else if (ext == ".mp3") {
		icon = "../images/iconMp3.gif";
		fileType = "Audio File";
	} else if (ext == ".txt") {
		icon = "../images/iconTxt.gif";
		fileType = "Text Document";
	} else if (ext == ".html") {
		icon = "../images/iconhtml.gif";
		fileType = "Text Document";
	} else if (ext == ".htm") {
		icon = "../images/iconhtml.gif";
		fileType = "Text Document";
	} else {
		alert("File extension does not match one that I am familiar with!\n\nPath: (" + path + ")");
	}

	var altText = "Download " + fileType;
	
	document.writeln("<a href=\"../download/" + path + "\" class=\"downloadableLink\" target=\"" + path + "\"><img src=\"" + icon + "\" border=\"0\" alt=\"" + altText + "\" /></a> <a href=\"../download/" + path + "\" class=\"downloadableLink\" target=\"" + path + "\">Download " + fileType + "</a>");
}

function goTo(path) {
	document.location.href = "../html/" + path;
}

function search() {
	var i = document.getElementsByTagName("input");
	
	document.location.href = "../perl/search.pl?keywords=" + i[0].value;
//	document.location.href = "http://www.elearn.wa.edu.au/kt/edition05/perl/search.pl?keywords=" + i[0].value;
}

