// menus.js - Created by Bradley J. Gibby q:)
// Version 1.1 - 20030728

var urlPrefix = "../";
//var urlPrefix = "http://dv01.elearn.internal/KT/";

var menuState = 0;
var menus = [
	"pra", 
	"cri", 
	"pol", 
	"int",
	"con",
	"pro",
	"bra"
];

var pras = [];
var cris = [];
var pols = [];
var cons = [];
var ints = [];
var pros = [];
var bras = [];

function item(title, link) {
	this.title = title;
	this.link = link;
}

function praMenu() {
	for (var i = 0; i < pras.length; i++) {
		document.write(getMenuItem(pras[i].title, pras[i].link));
	}
}

function criMenu() {
	for (var i = 0; i < cris.length; i++) {
		document.write(getMenuItem(cris[i].title, cris[i].link));
	}
}

function polMenu() {
	for (var i = 0; i < pols.length; i++) {
		document.write(getMenuItem(pols[i].title, pols[i].link));
	}
}

function conMenu() {
	for (var i = 0; i < cons.length; i++) {
		document.write(getMenuItem(cons[i].title, cons[i].link));
	}
}
function intMenu() {
	for (var i = 0; i < ints.length; i++) {
		document.write(getMenuItem(ints[i].title, ints[i].link));
	}
}

function proMenu() {
	for (var i = 0; i < pros.length; i++) {
		document.write(getMenuItem(pros[i].title, pros[i].link));
	}
}

function braMenu() {
	for (var i = 0; i < bras.length; i++) {
		document.write(getMenuItem(bras[i].title, bras[i].link));
	}
}

function getMenuItem(title, link) {
	return "<tr><td class=\"menuItem_up\" onMouseOver=\"this.className='menuItem_over';\" onMouseOut=\"this.className='menuItem_up';\"><span class=\"menuSpacer\"></span><a href=\"" + link + "\" class=\"flyOutLink\">" + title + "</a></td></tr>";
}

// Pra Menu
pras.push(new item("Submit an Article", urlPrefix + "html/submit.html"));
pras.push(new item("Anne Bartlett-Bragg", urlPrefix + "html/blogging_to_learn_intro.html"));
pras.push(new item("Dawn Bennett", urlPrefix + "html/dawn_intro.htm"));
pras.push(new item("Hastie and Palmer", urlPrefix + "html/hastie_intro.htm"));
pras.push(new item("Housden, Forsyth and Bateman", urlPrefix + "html/online_adventures_intro.htm"));
pras.push(new item("Reeves, Gallacher and Robinson", urlPrefix + "html/human_resources_tool_intro.html"));

// Cri Menu
cris.push(new item("Eklund, Kay and Lynch", urlPrefix + "html/frank_intro.htm"));


// Pol Menu
//pols.push(new item("Frank Bate and Linda Smart", urlPrefix + "html/res_frankBate_lindaSmart.html"));
//pols.push(new item("Chris Howell and Sophie Cholewka", urlPrefix + "html/res_chrisHowell.html"));
//pols.push(new item("Reece Lamshed", urlPrefix + "html/res_reeceLamshed.html"));
//pols.push(new item("Prue Masden", urlPrefix + "html/res_prueMasden.html"));
//pols.push(new item("John Mitchell: Innovation", urlPrefix + "html/res_innovation.html"));
//pols.push(new item("Ellie Thompson", urlPrefix + "html/res_ellieThompson.html"));

// Bra Menu
bras.push(new item("Australian Capital Territory", urlPrefix + "html/act_fll_state_rpt.htm "));
bras.push(new item("Northern Territory", urlPrefix + "html/nt_report.html"));
bras.push(new item("South Australia", urlPrefix + "html/sa_rpt.html"));
bras.push(new item("Tasmania", urlPrefix + "html/tas_rpt.htm"));
bras.push(new item("Western Australia", urlPrefix + "html/fl_in_wa.htm"));


// Int Menu
ints.push(new item("Marty Cielens", urlPrefix + "html/marty_cielens_intro.html"));
ints.push(new item("Martin Dougiamis", urlPrefix + "html/dougiamis_intro.htm"));
ints.push(new item("Janina Gawler", urlPrefix + "html/Janina_Gawler.html"));
ints.push(new item("Nola Campbell and Elizabeth McPherson", urlPrefix + "html/Nola_Campbell.html"));
ints.push(new item("Nola Campbell and Janice Anderson", urlPrefix + "html/Nola_Campbell_janice.html"));
ints.push(new item("Allison Gotts", urlPrefix + "html/alison_gotts_intro.html"));
//ints.push(new item("Kate Fannon", urlPrefix + "html/kate_intro.html"));

// Con Menu

cons.push(new item("New Practices in Flexible Learning", urlPrefix + "html/newPractices.html"));

// Pros Menu
pros.push(new item("NET*Working 2003", urlPrefix + "html/highlights_2003.html"));

function getPageOffsetLeft(el) {
	var x;
	
	// Return the x coordinate of an element relative to the page.
	
	x = el.offsetLeft;
	if (el.offsetParent != null)
	x += getPageOffsetLeft(el.offsetParent);
	
	return x;
}

function getPageOffsetTop(el) {
	var y;
	
	// Return the x coordinate of an element relative to the page.
	
	y = el.offsetTop;
	if (el.offsetParent != null)
	y += getPageOffsetTop(el.offsetParent);
	
	return y;
}

function hideMenus() {
	if (menuState == 0) {
		for (var i = 0; i < menus.length; i++) {
			document.getElementById(menus[i]).style.display = "none";
		}
	}
}

function showMenu(id) {
	menuState = 0;
	hideMenus();
	menuState = 1;

	var y = getPageOffsetTop(document.getElementById(id + "Parent"));
	var x = getPageOffsetLeft(document.getElementById(id + "Parent"));
	
	document.getElementById(id).style.top = y + 30;
	document.getElementById(id).style.left = x;
	document.getElementById(id).style.display = "block";
}

function init() {
	setInterval('hideMenus();', 1250);
	
	document.getElementById("pra").style.width = "200px";
	document.getElementById("cri").style.width = "215px";
	document.getElementById("pol").style.width = "200px";
//	document.getElementById("bra").style.width = "115px";
	document.getElementById("int").style.width = "235px";
//	document.getElementById("con").style.width = "200px";
	document.getElementById("pro").style.width = "250px";
}

function drawNav() {
	document.write("<a href=\"" + urlPrefix + "html/editor.html\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('home','','" + urlPrefix + "images/homeb.gif',1); menuState = 0;\"><img src=\"" + urlPrefix + "images/homea.gif\" name=\"home\" border=\"0\" alt=\"Home\"></a><a href=\"javascript:void(0);\" id=\"praParent\" onMouseOut=\"MM_swapImgRestore(); menuState = 0;\" onMouseOver=\"MM_swapImage('peer','','" + urlPrefix + "images/peerArticlesb.gif',1); showMenu('pra');\"><img src=\"" + urlPrefix + "images/peerArticlesa.gif\" name=\"peer\" border=\"0\" alt=\"Peer Reviewed Articles\"></a><a href=\"javascript:void(0);\" id=\"criParent\" onMouseOut=\"MM_swapImgRestore(); menuState = 0;\" onMouseOver=\"MM_swapImage('critiques','','" + urlPrefix + "images/critiquesb.gif',1); showMenu('cri');\"><img src=\"" + urlPrefix + "images/critiquesa.gif\" name=\"critiques\" border=\"0\" alt=\"Critiques\"></a><a href=\"javascript:void(0);\" id=\"braParent\" onMouseOut=\"MM_swapImgRestore(); menuState = 0;\" onMouseOver=\"MM_swapImage('branches','','" + urlPrefix + "images/theBranchesb.gif',1); showMenu('bra');\"><img src=\"" + urlPrefix + "images/theBranchesa.gif\" name=\"branches\" border=\"0\" alt=\"From the Branches\"></a><a href=\"javascript:void(0);\" id=\"intParent\" onMouseOut=\"MM_swapImgRestore(); menuState = 0;\" onMouseOver=\"MM_swapImage('interviews','','" + urlPrefix + "images/interviewsb.gif',1); showMenu('int');\"><img src=\"" + urlPrefix + "images/interviewsa.gif\" name=\"interviews\" border=\"0\" alt=\"Interviews\"></a><a href=\"current_research.htm\" id=\"conParent\" onMouseOut=\"MM_swapImgRestore(); menuState = 0;\" onMouseOver=\"MM_swapImage('currentResearch','','" + urlPrefix + "images/currentResearchb.gif',1); menuState = 0;\"><img src=\"" + urlPrefix + "images/currentResearcha.gif\" name=\"currentResearch\"0\" alt=\"Current Research\" border=\"0\"></a><a href=\"javascript:void(0);\" id=\"proParent\" onmouseout=\"MM_swapImgRestore(); menuState = 0;\" onmouseover=\"MM_swapImage('project','','" + urlPrefix + "images/leaderProjectsb.gif',1); showMenu('pro');\"><img src=\"" + urlPrefix + "images/leaderProjectsa.gif\" name=\"project\" border=\"0\" Alt=\"Special Features\"></a><a href=\"" + urlPrefix + "html/contactDetails.html\" onMouseOut=\"MM_swapImgRestore();\" onMouseOver=\"MM_swapImage('contactDetails','','" + urlPrefix + "images/contactDetailsb.gif',1); menuState = 0;\"><img src=\"" + urlPrefix + "images/contactDetailsa.gif\" name=\"contactDetails\" border=\"0\" alt=\"Contact Details\"></a><img src=\"" + urlPrefix + "images/menuEnd.gif\" alt=\"Edition 3, August 2003\">");
}

function drawMenus() {
	for (var i = 0; i < menus.length; i++) {
		document.write("<div id=\"" + menus[i] + "\" class=\"flyOut\" onMouseOver=\"menuState = 1;\" onMouseOut=\"menuState = 0;\"><table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\"><script language=\"JavaScript\">" + menus[i] + "Menu();</script></table></div>");
	}
}

function showMovie(id) {
	window.open("../video/" + id, "", "width=455,height=400,resizable=no,statusbar=no,toolbars=no,addressbar=no");
}

function showDocument(id) {
	window.open("downloads/" + id + "", "", "width=550,height=400,scrollbars=yes,resizable=yes,toolbars=yes,statusbar=no");
}

function showMP3(id) {
	window.open("../mp3/" + id + "", "", "width=500,height=400,scrollbars=yes,resizable=yes,toolbars=yes,statusbar=no");
}

function search() {
	document.location.href = "http://www.flexiblelearning.net.au/knowledgetree/edition05/perl/search.pl?keywords=" + document.getElementById("textfield").value + "&ed=4";
}
