// JavaScript Document

var revert = new Array();
var flipped = new Array();

var inames = ['index','about','parents','calendar',
                 'enrol','museum','contact'];

// just had two pages in my testing:  junk1.html and junk2.html
//var inames = ["index","about","parents","contact","enrol","calendar"];

// Preload
for(i=0; i< inames.length; i++) 
{
    var name = inames[i];
    flipped[name] = new Image();
    flipped[name].src = "images/key/" + name + "-r.jpg";
    revert[name] = new Image();
    revert[name].src = "images/key/" + name + ".jpg";
}
// now, for the current page, change it's "revert" image:
var page = location.href.toLowerCase();
// must strip off any prefix and any query string, etc.
var zap = /^.*?\/(\w+)\.html.*$/
page = page.replace( zap, "$1"); 
// the "if" should always be true, but I'm paranoid:
if ( flipped[page] != null ) revert[page] = flipped[page];

// then the simplified over/out methods:
function over(obj) {
    obj.src = flipped[obj.name].src;
    // debug alert(obj.name + " :: " + obj.src);
}
function out(obj) {
    obj.src = revert[obj.name].src;
    // debug alert(obj.name + " :: " + obj.src);
}



