// Rollover image object
// varname: variable name for the object instance
// imgId:   id for img tag
// w, h:    width, height
// imgA:    normal image URI
// imgB:    image URI for mouse over
// sUrl:    action url
// sTarget: action target frame name
// sAlt:    alt text
// bStatus: if browser status bar should be set
// sMsg:    browser status message
function rollover(varname, imgId, w, h, imgA, imgB, sUrl, sTarget, sAlt, bStatus, sMsg)
{
	this.varname =  varname;
	this.imgId = imgId;
	this.w = w;
	this.h = h;
	this.imgName = imgA;
	this.imgA = new Image(w, h);
	this.imgA.src = imgA;
	this.imgB = new Image(w, h);
	this.imgB.src = imgB;
	this.sUrl = sUrl;
	this.sTarget = sTarget;
	this.sAlt = sAlt;
	this.sMsg = sMsg;
	this.bStatus = bStatus;
	this.genTag = genTag;
}

function genTag()
{
	var s = '<A href="' + this.sUrl + '"'
	if (this.sTarget != '')
		s = s + ' target="' + this.sTarget + '"';
	if (this.bStatus == true) {
		s = s + ' onMouseOver="rollover_swapimg(\'' + this.imgId + '\', ' + this.varname + '.imgB); window.status=\'' + this.sMsg + '\'; return true;"';
		s = s + ' onMouseOut="rollover_swapimg(\'' + this.imgId + '\', ' + this.varname + '.imgA); window.status=\'\'; return true;">';		
	} else {		
		s = s + ' onMouseOver="rollover_swapimg(\'' + this.imgId + '\', ' + this.varname + '.imgB)"';
		s = s + ' onMouseOut="rollover_swapimg(\'' + this.imgId + '\', ' + this.varname + '.imgA)">';
	}
	s = s + '<img name="' + this.imgId + '" src="' + this.imgName + '" alt="' + this.sAlt + '" width="' + this.w + '" height="' + this.h + '" border=0 hspace=0 vspace=0 valign=middle></a>';
	
	return s;
}

function rollover_swapimg(imgId, imgName)
{
	var doc = document.images[imgId];
	if (doc)
		doc.src = imgName.src;
}
