<!--hide this script from non-javascript-enabled browsers

//////////////////////////////////////////////////////////
//
// Periodic Table of Data
//
// Produced by Presenting Science
//  www.PresentingScience.com
//
// Copyright (C) Royal Society of Chemistry &
//		 Presenting Science 2004-2006
//
//////////////////////////////////////////////////////////


var label = "ShowWelcomePage=";	// The name of the cookie

// Set up version applet
function initVersion() {
	
	if (document.theVersion.isLoaded()==1) {
		// Initialise fonts, colours etc.
		document.theVersion.setAppletBackground(0,0,0);
		document.theVersion.setAppletForeground(0, 255, 0);
		document.theVersion.setFontAndSize("SansSerif", 9);
		document.theVersion.setPosition(0, 10);
		document.theVersion.setJavascript();
	}
	else
		setTimeout("initVersion()", 500);

}


/**
 * Update the radio from the cookie - called on load
 */
function updateWelcomeCheckBox() {
    var welcomeCookie = readWelcomeCookie();    

    if (welcomeCookie=="0")
        document.form.WelcomePage[0].checked = true;
    if (welcomeCookie=="1")
        document.form.WelcomePage[1].checked = true;
    if (welcomeCookie=="2")
        document.form.WelcomePage[2].checked = true;
}

/**
 * Update the cookie from the radio- called when radio is clicked
 */
function updateWelcomeCookie(i) {
	
	document.form.WelcomePage[0].checked = i==0;
	document.form.WelcomePage[1].checked = i==1;
	document.form.WelcomePage[2].checked = i==2;
	
    var c = document.form.WelcomePage[0].checked ? "0" : document.form.WelcomePage[1].checked ? "1" : "2";
    writeWelcomeCookie(c);
}


/**
 * Extract and return the welcome cookie
 */
 function readWelcomeCookie() {
    var c = document.cookie;
    var pos = c.indexOf(label);
    if (pos != -1) {
         var start = pos+label.length;
         var d = c.substring(start, c.length)
         var end = d.indexOf(";");
         if (end == -1) end = d.length;
         var h = d.substring(0, end);
         h = unescape(h);
         if (h.length>0) {
            return h;
        }
    }
    return "";
}
 
/**
 * Write the Welcome cookie
 */
 function writeWelcomeCookie(value) {
     var nextYear = new Date();
     nextYear.setFullYear(nextYear.getFullYear()+1);	// Will last for one year
     document.cookie = label+escape(value) + "; expires=" + nextYear.toGMTString();
 }

// stop hiding -->

