/*******************************************************************
 * soopaG-rollovers.js
 * 7/28/2001
 * www.youngpup.net
 *
 * easiest rollovers on earth, baby!
 * see www.youngpup.net for documentation.
 *
 *
 * 10/09/2002
 * www.fuzzygroove.com
 *
 * Added soopaGrouping to link buttons just as easily.
 *******************************************************************/


function soopaSetup() {
	var img, sh, sn, sd, sg
	for (var i = 0; (img = document.images[i]); i++) {
		if (img.getAttribute) {

			sn = img.getAttribute("src");
			sh = img.getAttribute("hsrc");
			sd = img.getAttribute("dsrc");
			
			sg = img.getAttribute("group");

			if (sn != "" && sn != null) {
				img.n = new Image();
				img.n.src = img.src;
			
				if (sh != "" && sh != null) {
					img.h = new Image();
					img.h.src = sh;
					img.onmouseover = soopaSwapOn
					img.onmouseout  = soopaSwapOff
					img.over = soopaSwapOn;
					img.off = soopaSwapOff;
				}

				if (sd != "" && sd != null) {
					img.d = new Image();
					img.d.src = sd;
					img.onmousedown = soopaSwapDown
					img.down = soopaSwapDown;
				}
				
				if (sg != "" && sg != null) {
					gSet = eval("typeof("+sg+"RG) != 'undefined'");
					if(!gSet) eval(sg+"RG = new soopaGroup('"+sg+"')");
					img.g = eval(sg+"RG");
					img.g.add(img);
				}
			}
		}
	}
}

function soopaSwapOn() {
if(this.g && this.g.selected == this.getAttribute("name"))
		return "selected";
	else this.src = this.h.src;
}

function soopaSwapOff() {
	if(this.g && this.g.selected == this.getAttribute("name"))
		return "selected";
	else this.src  = this.n.src;
}

function soopaSwapDown() {
	if(this.g) {
		if(this.g.selected == this.getAttribute("name")) {
			return "selected";
		} else {
			this.src = this.d.src;
			if(this.g) {
				this.g.selected = this.getAttribute("name");
				for(var i=0;i<this.g.rollImages.length;i++) {
					this.g.rollImages[i].off();
				}
			}
		}
	} else {
	  this.temp = typeof(document.onmouseup) != 'undefined' && typeof(document.onmouseup) != 'unknown' ? document.onmouseup : "";
	  soopaSwapUp.img = this;
	  document.onmouseup = soopaSwapUp;
	}
}

function soopaSwapUp() {
	var ths = soopaSwapUp.img;
	ths.src = ths.n.src;
	if (ths.temp) document.onmouseup = ths.temp;
}


// prototype object for linking multiple items in a menu //
function soopaGroup(name,selected) {
	this.name		= name;
	this.obj		= name + "soopaGroup";
  	eval(this.obj + "=this");
  	
  	this.rollImages	= new Array();
  	this.selected	= selected;
}
soopaGroup.prototype.add	= function (rollimage) {
	this.rollImages[this.rollImages.length] = rollimage;
}