// the ultimate rollover script
// by lux
/* usage:
Both
H
U
H
?
*/
// requires JavaScript1.1 or greater
var browserOK = false;
var pics;
browserOK = true;
pics = new Array ();
var objCount = 0;
function preload (name) { //images is an array with flipCount-many values
if (browserOK) {
pics[objCount] = new Array (arguments.length);
pics[objCount][0] = name;
for (var i=1; i < (arguments.length + 1); i++) {
pics[objCount][i] = new Image ();
pics[objCount][i].src = arguments[i];
}
objCount++;
}
}
function on (name, picNum) {
if (picNum == null) picNum = 2; //default at simple rollover for ease of typing
if (browserOK) {
for (i = 0; i < objCount; i++) {
if (document.images[pics[i][0]] != null) {
if (name == pics[i][0])
document.images[pics[i][0]].src = pics[i][picNum].src;
}
}
}
}
function off () {
if (arguments.length > 0) {
on (arguments[0], 1); // 1 is always the original image
return;
}
if (browserOK) {
for (i = 0; i < objCount; i++) {
if (document.images[pics[i][0]] != null)
document.images[pics[i][0]].src = pics[i][1].src; //pics[i][1] is always the original image
}
}
}