// Javascript Rollover Objects (rollover.js)
// Version 2.2, August 2009, Harley H. Puthuff
// Copyright ©2009, Your Showcase

// constants & variables:

var rollovers = new Array();

// rollover object constructor

function Rollover(button,hilite) {
    this.button = new Image();
    this.button.src = button;
    this.hilite = new Image();
    this.hilite.src = hilite;
    return this;
    }

// rollover method

function rollover(button,hilite,link,target,alt,myclass) {
    var ix = rollovers.length;
    var thisname = 'rollover' + ix.toString();
    var thislink = ((link == null) || (link == '')) ?
	"javascript:alert('This link is not implemented yet.')" : new String(link);
    var thistarget = ((target == null) || (target == '')) ? '_self' : new String(target);
    var thisalt = ((alt == null) || (alt == '')) ? '' : (' alt="' + String(alt) + '"');
    var thisclass = ((myclass == null) || (myclass == '')) ? '' : (' class="' + myclass + '"');
    rollovers[ix] = new Rollover(button,hilite);
    var text =
	'<a href="' + thislink + '" target="' + thistarget + '"\n' +
	' onMouseOver="' + thisname + '.src=rollovers[' + ix.toString() + '].hilite.src"\n' +
	' onMouseOut="' + thisname + '.src=rollovers[' + ix.toString() + '].button.src">\n' +
	'<img name="' + thisname + '" src="' + button + '" border=0 align=absmiddle' +
	  thisalt + thisclass + '></a>\n';
    document.write(text);
    }
