
var ISLinkNum = 0;
var ISLinks = {};

function ISLink(name, imgin, imgout, target, ext) {
	this.name = name;
	this.imgin = imgout;
	this.imgout = imgin;
	this.target = target;
	if (typeof(ext) != "undefined")
		this.ext = ext;
	else
		this.ext = null;
	preloadImages([imgin, imgout], 0, 2);
}

ISLink.prototype.width = 150;
ISLink.prototype.height = 35;

ISLink.prototype.write = function() {
	var name = "ISLink" + ISLinkNum;
	ISLinkNum++;
	document.write("<div style=\"width : " + this.width + ";\"><a href=\"" + this.target + "\" onMouseOver=\"ISOver('" + name + "')\" onMouseOut=\"ISRestore('" + name + "')\"><img name=\"" + name + "\" border=\"0\" src=\"" + this.imgout + "\"></a></div>");
	ISLinks[name] = this;
}

function findDocElem(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; 
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findDocElem(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function ISLinkImg(name) {
	return findDocElem(name);
}

function ISRestore(name) {
	var l = ISLinks[name];
	if (l.imgout != null ) {
		ISLinkImg(name).src = getImage(l.imgout).src;
	}
	if (this.ext) this.ext.headerOff(l.name);
}

function ISOver(name) {
	var l = ISLinks[name];
	var l = ISLinks[name];
	ISLinkImg(name).src = getImage(l.imgin).src;
	if (this.ext) {
		this.ext.headerOn(l.name);
	}
}

