

///////////// PRELOAD IMAGES ////////////////

preloadArray = new Array();
function addPreload(imgSrc) { preloadArray[preloadArray.length] = imgSrc; }
var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		for (i=0; i<preloadArray.length; i++) eval("preloadImage"+i+" = newImage('"+preloadArray[i]+"');");
		preloadFlag = true;
	}
}
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

// addPreload('images/v1_0.jpg');

function initImageSwap() {
	imgs = document.getElementsByTagName('IMG');
	for(i=0;i<imgs.length;i++) {
		el = imgs[i];
		if (el.className=='imageSwap') {
			el.ext = el.src.substr(el.src.length-3,3);
			addPreload(el.src.replace('0.'+el.ext,'1.'+el.ext));
			addPreload(el.src);
			el.onmouseover = el.onmouseup = function() {
				this.src = this.src.replace('0.'+this.ext,'1.'+this.ext);
			}
			el.onmouseout = el.onmousedown = function() {
				this.src = this.src.replace('1.'+this.ext,'0.'+this.ext);
			}
		}
	}
}

function initSN() {
	el = document.getElementById('sn');
	if (el) {
		snImages = el.getElementsByTagName('IMG');
		for(i=0;i<snImages.length;i++) {
			snImg = snImages[i];
			snImg.onmouseover = function() {
				el = document.getElementById('snInfo');
				el.innerHTML = this.getAttribute('ALT');
			}
			snImg.onmouseout = function() {
				el = document.getElementById('snInfo');
				el.innerHTML = '';
			}
		}
	}
}



/////////////////////// INIT /////////////////////////


onload = function() {
	initImageSwap();
	preloadImages();
}

