/*******************************************************************
 * swap.js
 * 11/22/2001
 * www.shauninman.com
 *
 * based on:
 * soopa-rollovers.js
 * 7/28/2001
 * www.youngpup.net
 *
 * much props to aaron
 * youngpup.net is the jet!
 *
 * see swap.txt in this directory for documentation
 *******************************************************************/
function swapSetup() {
	var img, sn, sh, said, san, sah, sc, scid, sic, sicid, scc, sccid, svid, hrf, frm, elem, aid, an, ah;
	for (var i = 0; (img = document.images[i]); i++) {
		if (img.getAttribute) {

			sn    = img.getAttribute("src");
			sh    = img.getAttribute("hsrc");
			said  = img.getAttribute("aid");
			san   = img.getAttribute("asrc");
			sah   = img.getAttribute("ahsrc");
			sc    = img.getAttribute("csrc");
			scid  = img.getAttribute("cid");
			sic   = img.getAttribute("icsrc");
			sicid = img.getAttribute("icid");
			scc   = img.getAttribute("ccsrc");
			sccid = img.getAttribute("ccid");
			svid  = img.getAttribute("vid");
			
			if (sn != "" && sn != null) {
				img.n = new Image();
				img.n.src = sn;
					
				if (sh != "" && sh != null) {
					img.h = new Image();
					img.h.src = sh;
					img.onmouseover = selfSwapOn
					img.onmouseout  = selfSwapOff
					}
				}
				
			if (said != "" && said != null) {
				if (san != "" && san != null) {
					img.an = new Image();
					img.an.src = san;
					img.an.id = said;
					
					if (sah != "" && sah != null) {
						img.ah = new Image();
						img.ah.src = sah;
						img.onmouseover = affectedSwapOn
						img.onmouseout  = affectedSwapOff
						}
					}
				}
				
			if (scid != "" && scid != null && sicid != "" && sicid != null && sccid != "" && sccid != null) {				
				if (sc != "" && sc != null && sic != "" && sic != null && scc != "" && scc != null) {
					img.cc = new Image();
					img.cc.id = scid;
					img.cc.src = sc;
					img.ic = new Image();
					img.ic.id = sicid;
					img.ic.src = sic;
					img.icc = new Image();
					img.icc.id = sccid;
					img.icc.src = scc;
					img.onclick = clickSwapOn
					}
				}
				
			if (said != "" && said != null && sh != "" && sh != null) {
				img.onmouseover = bothSwapOn
				img.onmouseout  = bothSwapOff
				}
				
			if (svid != "" && svid != null) {
				img.v = new Image();
				img.v.id = svid;
				// alert('working thus far');
				img.onmouseover = visOn
				img.onmouseout  = visOff
				}
			}
		
		}
		
	for (var s = 0; (hrf = document.links[s]); s++) {
		hrf.onfocus = selfBlur
		}
	for (var f = 0; (frm = document.forms[f]); f++) {
		for (var t = 0; (elem = document.forms[f].elements[t]); t++) {
			if (elem.getAttribute) {
				
				aid = elem.getAttribute("aid");
				an = elem.getAttribute("asrc");
				ah = elem.getAttribute("ahsrc");
				
				if (an != "" && an != null) {
					elem.an = new Image();
					elem.an.src = an;
					
					if (aid != "" && aid != null) {
						elem.an.id = aid;
							
						if (ah != "" && ah != null) {
							elem.ah = new Image();
							elem.ah.src = ah;
							elem.onfocus = affectedSwapOn
							elem.onblur  = affectedSwapOff
							}
						}
					}
				}
			}		
		}
	}
	
function selfSwapOn() {
	this.src = this.h.src;	
	}

function selfSwapOff() {
	this.src  = this.n.src;
	}
	
function affectedSwapOn() {	
	document.getElementById(this.an.id).src = this.ah.src;
	}

function affectedSwapOff() {
	document.getElementById(this.an.id).src = this.an.src;
	}
	
function bothSwapOn() {	
	this.src  = this.h.src;
	document.getElementById(this.an.id).src = this.ah.src;
	}

function bothSwapOff() {
	this.src  = this.n.src;
	document.getElementById(this.an.id).src = this.an.src;
	}

function clickSwapOn() {
	document.getElementById(this.cc.id).src = this.cc.src;
	document.getElementById(this.ic.id).src = this.ic.src;
	document.getElementById(this.icc.id).src = this.icc.src;
	}

function visOn() {
	document.getElementById(this.v.id).style.visibility = 'visible';
	}
	
function visOff() {
	document.getElementById(this.v.id).style.visibility = 'hidden';
	}

function selfBlur() {
	this.blur();
	}