function mouseListener () {
  this.imageBase = new Array;
}

function mouseListenerData (imgName, img1, img2) {
  this.imgName = imgName;
  this.img1 = new Image;
  this.img1.src = img1;
  this.img2 = new Image;
  this.img2.src = img2;
  this.opened = false;
  this.mouseover=false;
}

mouseListener.prototype.addImage = function (imgName,img1,img2) {
  var counter = this.imageBase.length;
  this.imageBase[counter] = new Array;
  this.imageBase[counter] = new mouseListenerData(imgName,img1,img2);
  /*this.imageBase[counter][0] = imgName;
  this.imageBase[counter][1] = new Image;
  this.imageBase[counter][1].src = img1;
  this.imageBase[counter][2] = new Image;
  this.imageBase[counter][2].src = img2;  */
}

mouseListener.prototype.mouseClick = function (imgName) {
  for (var n = 0;n<this.imageBase.length;n++) {
    if (this.imageBase[n].imgName == imgName) {
	  if (!this.imageBase[n].mouseover) {
	    eval("top.northcenter.document."+imgName).src = this.imageBase[n].img2.src;
	  }
	  this.imageBase[n].opened = true;
	} else if (this.imageBase[n].opened) {
	  eval("top.northcenter.document."+this.imageBase[n].imgName).src = this.imageBase[n].img1.src;
	  this.imageBase[n].opened = false;
	}
  }
}

mouseListener.prototype.mouseOver = function (imgName) {
  for (var n = 0;n<this.imageBase.length;n++) {
    if (this.imageBase[n].imgName == imgName) {
	  this.imageBase[n].mouseover=true;
	  eval("top.northcenter.document."+imgName).src = this.imageBase[n].img2.src;
	}
  }
}

mouseListener.prototype.mouseOut = function (imgName) {
  for (var n = 0;n<this.imageBase.length;n++) {
    if (this.imageBase[n].imgName == imgName) {
	  if (!this.imageBase[n].opened)
	    eval("top.northcenter.document."+imgName).src = this.imageBase[n].img1.src;
		this.imageBase[n].mouseover=false;
	}
  }
}
