<!--hide this script from non-javascript-enabled browsers

//////////////////////////////////////////////////////////
//
// SpectraSchool
//
// Produced by Presenting Science
//  www.PresentingScience.com
//
// Copyright (C)SpectraSchool &
//       Presenting Science 2007 - 2009
//
//////////////////////////////////////////////////////////


var startpageCookie = "STARTPAGE=";	// The name of the cookie
var levelCookie = "LEVEL=";

function initStartPage() {
	updateStartUpCheckBox();
	updateLevelCheckBox();
	setTimeout("checkJava()", 1000);
}

/**
 * Do the redirect depending on the cookie, called when the main frameset is (re)loaded
 */
function doStartUpRedirect() {
    var c = readCookie(startpageCookie) - 0;   
	
	switch (c) {
	case 0:
		// no action required
		break;
	case 1:
		if (navigator.javaEnabled()) bottomFrame.document.location="sindex.htm";
		break;
	case 2:
		bottomFrame.document.location="vindex.htm";
		break;
	case 3:
		bottomFrame.document.location="sias.htm";
		break;
	}
	
}

/**
 * Update the radio from the cookie - called on load of home page
 */
function updateStartUpCheckBox() {
    var c = readCookie(startpageCookie) - 0;    

    document.form.startUpPage[0].checked = c==0;
    document.form.startUpPage[1].checked = c==1;
    document.form.startUpPage[2].checked = c==2;
    document.form.startUpPage[3].checked = c==3;
}

/**
 * Update the cookie from the radio- called when radio is clicked
 */
function updateStartUpCookie(i) {
	
	document.form.startUpPage[0].checked = i==0;
	document.form.startUpPage[1].checked = i==1;
	document.form.startUpPage[2].checked = i==2;
	document.form.startUpPage[3].checked = i==3;
	
    var c = ""+i;
    writeCookie(startpageCookie, c, true);
}

/**
 * Update the radio from the cookie - called on load of home page
 */
function updateLevelCheckBox() {
    var c = readCookie(levelCookie) - 0;    

	// cookie = 0 or empty means level = A2: the default 
    document.form.teachingLevel[0].checked = c==1;
    document.form.teachingLevel[1].checked = c!=1;
}

/**
 * Update the cookie from the radio- called when radio is clicked
 */
function updateLevelCookie(i) {
	
	document.form.teachingLevel[0].checked = i==1;
	document.form.teachingLevel[1].checked = i==0;
	
    var c = ""+i;
    writeCookie(levelCookie, c, true);
}

function checkJava() {
   var JavaError = "<p style='color:#FF0000;font-size:10pt'><strong>Java version 1.5 or later must be installed and enabled to use this site. Please consult your browser's documentation for details or visit <a href='http://www.java.com/' target='_blank'>www.java.com</a> to download the latest version.</strong></p>";
   
   if (navigator.javaEnabled()) {
 		//document.getElementById('JavaCheck').innerHTML = document.JavaVersion.getVersion();
  		try {
			if (document.JavaVersion.getVersion()<"1.5.0") {
				// Wrong version
				document.getElementById('JavaCheck').innerHTML = JavaError;
			}
			else {
				document.getElementById('JavaCheck').innerHTML = "Browser configuration OK";
			}
		}
		catch (error) {
			document.getElementById('JavaCheck').innerHTML = "<p style='color:#FF0000;font-size:10pt'><strong>Error checking Java version: " + error + "</strong></p>" + JavaError;
		}
	}
	else {
		// No Java
		document.getElementById('JavaCheck').innerHTML = JavaError;
	}
}

// stop hiding -->


