
// global variables
var timerID = null;
var timerOn = false;
var timecount = 300;
var browser = null;
var initialised = false;

function refresh(){
	window.location.reload()
}

window.onresize = refresh;

// Initialisation and Browser detection
function init()
{
	if (document.layers) {
		layerRef = "document.layers";
		styleSwitch = "";
		visibleVar = "show";
		screenSize = window.innerWidth;
		browser = "ns4";
	}
	else if (document.all) {
		layerRef = "document.all";
		styleSwitch = ".style";
		visibleVar = "visible";
		screenSize = document.body.clientWidth + 18;
		browser = "ie";
	}
	else if (document.getElementById) {
		layerRef = "document.getElementByID";
		styleSwitch = ".style";
		visibleVar = "visible";
		browser = "moz";
	}
	else {
		browser = "none";
	}
	window.status='An Introduction to the Yukulta Language';
	initialised = true;
}

function onLoad()
{
	init();
}


// Layer Activation
function show_layer(layerName)
{
	if (initialised) {
		if (browser == "none") {
			return;
		}
		else if (browser == "moz") {
			document.getElementById(layerName).style.visibility="visible";
		}
		else {
			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
		}
	}
	else {
		return;
	}
}

// Layer DeActivation
function hide_layer(layerName)
{
	if (initialised) {
		if (browser == "none") {
			return;
		}
		else if (browser == "moz") {
			document.getElementById(layerName).style.visibility="hidden";
		}
		else {
			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
		}
	}
	else {
		return;
	}
}

function hide_all()
{
	hide_layer('introduction');
	hide_layer('phonology');
	hide_layer('morphology');
	hide_layer('syntax');
	hide_layer('semantics');
	hide_layer('resources');
}

function start_time()
{
	if (timerOn == false) {
		timerID = setTimeout( "hide_all()" , timecount);
		timerOn = true;
	}
}

function stop_time()
{
	if (timerOn) {
		clearTimeout(timerID);
		timerID = null;
		timerOn = false;
	}
}
