<!-- ##################################################################### -->

<!-- # GID BUTTON                             Version 2.0                # -->

<!-- # Created: 18/08/01                      Last Modified: 17/09/01    # -->

<!-- # by Thomas A. Vervost                   (c) 2001 GLOBAL IDENTITY   # -->

<!-- ##################################################################### -->





<!--

function gidButton (szName, szPath, szActive)

{

	szVersion = "2.0";



//	Default-Werte ////////////////////////////////////////////////



	if ((typeof szName)	== "undefined")	{alert ("gidButton: Abort/Name of instance missing"); return}

	if ((typeof szPath)	== "undefined")	{alert ("gidButton: Abort/Graphic not defined"); return}

	if ((typeof szActive)	== "undefined")	{szActive = 0}



//	Objekt-Eigenschaften /////////////////////////////////////////



	this.name	= szName;

	this.auto	= 1;

	this.enabled	= true;

	this.preload	= false;

	this.animation	= true;



//	Objekt-Methoden //////////////////////////////////////////////



	this.OnImg	= privOnImg;

	this.OffImg	= privOffImg;

	this.LockImg	= privLockImg;

	this.define	= privDefine;

	this.images	= new objImages (szPath, szActive);

	this.alt	= new objCaption ("hier klicken", true);

	this.status	= new objCaption ("Treffen Sie eine Auswahl", true, true);

	this.version	= function(){return (szVersion)}

	this.length	= function(){return (this.images.length)}

	this.clicked	= function(){return (this.images.active)}

	this.click	= privClick;

}





function objCaption (szValue, bState, bAuto)

{

//	Objekt-Eigenschaften /////////////////////////////////////////



	this.value	= szValue;

	this.enabled	= bState;

	this.auto	= bAuto;

}





function objImagesLayer (szOff, szOn, szLock)

{

//	Objekt-Eigenschaften /////////////////////////////////////////



	this.lock	= false;



//	Objekt-Methoden //////////////////////////////////////////////



	this.mask	= new objLayerMask(szOff, szOn, szLock);

	this.length	= function(){return (parseInt(this.lock + 2))}

}





function objLayerMask (szOff, szOn, szLock)

{

//	Objekt-Eigenschaften /////////////////////////////////////////



	this.off	= szOff;

	this.on		= szOn;

	this.lock	= szLock;

	this.define	= privMaskDefine;

}





function objImages (szPath, szActive)

{

//	Initialisierung //////////////////////////////////////////////



	szType = szPath.substring(szPath.lastIndexOf(".") +1, szPath.length);



	szIndex = szPath.lastIndexOf ("/");

	if (szIndex == -1)

	{

		szName = szPath.substring(0, (szPath.lastIndexOf (".")));

		szPath = "";

	}

	else

	{

		szName = szPath.substring(szIndex +1, (szPath.lastIndexOf (".")));

		szPath = szPath.substring(0, szIndex +1);

	}



//	Objekt-Eigenschaften /////////////////////////////////////////



	this.name	= szName;

	this.path	= szPath;

	this.fullpath	= szPath + szName;

	this.active	= szActive;

	this.type	= szType;

	this.length	= 0;



//	Objekt-Methoden //////////////////////////////////////////////



	this.loaded	= privImagesLoaded;

	this.buffer	= new Array();

	this.layer	= new objImagesLayer("", "_on", "_lock");

	this.max	= function(){return (this.length * parseInt(this.layer.lock + 2))}

}





function privImagesLoaded ()

{

	nLoaded = 0;

	if (this.length > 0)

	{

		for (i=1; i <= this.length; i++)

		{

			if (this.buffer[i][0] != "") {nLoaded++}

			if (this.buffer[i][1] != "") {nLoaded++}

			if (this.layer.lock == true)

			{

				if (this.buffer[i][2] != "") {nLoaded++}

			}

		}

	}

	return (nLoaded);

}





function privMaskDefine (szOff, szOn, szLock)

{

	if ((typeof szOff)	== "undefined")	{szOn = ""}

	if ((typeof szOn)	== "undefined")	{szOn = "_on"}

	if ((typeof szOLock)	== "undefined")	{szLock = "_lock"}



	this.on     = szOn;

	this.off    = szOff;

	this.lock   = szLock;

}





function privClick (nButton)

{

	nButton = parseInt(nButton);

	if (nButton > this.images.max()) {nButton = this.images.max()}

	if (nButton < 1) {nButton = 1}

	szImageName = this.images.name + nButton + this.images.layer.mask.off;

	this.LockImg (szImageName);

}





function privOnImg (imagename)

{

	if (this.enabled == false || this.animation == false) {return}



	szImageID = this.name + imagename;

	i = parseInt(imagename.substring(this.images.name.length, imagename.length));



	if ((this.images.active != 0) && (i == parseInt(this.images.active))) {return}



	if (this.images.buffer[i][0] == "")

	{

		this.images.buffer[i][0] = new Image();

		this.images.buffer[i][0].src = document[szImageID].src;

	}



	document[szImageID].src = this.images.buffer[i][1].src;

}





function privLockImg (imagename)

{

	if (this.enabled == false) {return}



	szImageID = this.name + imagename;

	i = parseInt(imagename.substring(this.images.name.length, imagename.length));



	if (this.images.buffer[i][0] == "")

	{

		this.images.buffer[i][0] = new Image();

		this.images.buffer[i][0].src = document[szImageID].src;

	}



	if (this.images.active != 0)

	{

		if (this.images.active > 0)

		{

			document[this.images_on].src =  this.images.buffer[this.images.active][0].src;

		}

		this.images.active = i;

		this.images_on = szImageID;

	}



	document[szImageID].src = this.images.buffer[i][this.images.layer.lock + 1].src;

}





function privOffImg (imagename)

{

	if (this.enabled == false || this.animation == false) {return}



	szImageID = this.name + imagename;

	if (this.images_on == szImageID || this.enabled == false) {return}

	document[szImageID].src = this.images.buffer[parseInt(imagename.substring(this.images.name.length, imagename.length))][0].src;

}





function privDefine (szLink, szAlt, szStatus, szNr)

{

	if (((typeof szNr) == "undefined") || (szNr = "auto"))

	{

		if (this.auto == 0) {alert("gidButton: Abort/AutoButton disabled"); return}

		szNr = this.auto;

		this.auto++;

	}

	else

	{

		if (this.auto > 0) {alert("gidButton: Abort/AutoButton enabled"); return}

	}



	this.images.length++;



	if ((typeof szAlt) == "undefined") {szAlt = this.alt.value}

	if (this.alt.enabled == true)

	{

		szAltTag = "alt='" + szAlt + "'";

	}

	else

	{

		szAltTag = "";

	}



	if ((typeof szStatus) == "undefined")

	{

		if (this.status.auto == true)

		{

			szStatus = szAlt;

		}

		else

		{

			szStatus = this.status.value;

		}

	}



	if (this.status.enabled == true)

	{

		szStatusOn = "; window.status='" + szStatus + "'; return true";

		szStatusOff = "; window.status=''; return true";

	}

	else

	{

		szStatusOn = "";

		szStatusOff = "";

	}



	szImage = this.images.name + szNr + this.images.layer.mask.off;

	szImageID = this.name + szImage;



	this.images.buffer[szNr] = new Array (this.images.layer.lock + 1);



	if (this.preload == true)

	{

		this.images.buffer[szNr][0] = new Image(); this.images.buffer[szNr][0].src = this.images.fullpath + szNr + "." + this.images.type;

	}

	else

	{

		this.images.buffer[szNr][0] = "";

		if (this.images.layer.lock == true)

		{

			this.images.buffer[szNr][2] = "";

		}

	}



	this.images.buffer[szNr][1] = new Image(); this.images.buffer[szNr][1].src = this.images.fullpath + szNr + this.images.layer.mask.on + "." + this.images.type;



	if (this.images.layer.lock == true)

	{

		this.images.buffer[szNr][2] = new Image(); this.images.buffer[szNr][2].src = this.images.fullpath + szNr + this.images.layer.mask.lock + "." + this.images.type;

	}



	if (this.images.active == szNr)

	{

		if (this.images.buffer[szNr][0] == "")

		{

			this.images.buffer[szNr][0] = new Image(); this.images.buffer[szNr][0].src = this.images.fullpath + szNr + "." + this.images.type;

		}

		this.images_on = szImageID;



		if (this.images.layer.lock == true)

		{

			szLayer = this.images.layer.mask.lock;

		}

		else

		{

			szLayer = this.images.layer.mask.on;

		}

	}

	else

	{

		szLayer = this.images.layer.mask.off;

	}



	document.write("<a href=" + szLink

	 + " onmouseover=\"" + this.name + ".OnImg('" + szImage + "')" + szStatusOn

	 + "\" onmouseout=\"" + this.name + ".OffImg('" + szImage + "')" + szStatusOff

	 + "\" onClick=" + this.name + ".LockImg('" + szImage + "')><img src='"

	 + this.images.fullpath + szNr + szLayer + "." + this.images.type

	 + "' border=0 name='" + szImageID + "' " + szAltTag + "></a>");

}

// -->


