
var isIE = navigator.userAgent.toLowerCase().indexOf("msie")>-1;
var isOpera = navigator.userAgent.toLowerCase().indexOf("opera")>-1;

var nImg =null;
var timeOut =null;

function changeImg(nextImg,txt) {	document.getElementById("collectiondiv").innerHTML=txt;
	if(timeOut != null) clearTimeout(timeOut);
	var imgObj = document.getElementById("imgchange");
	if(imgObj.src != nextImg.src) {
		nImg = nextImg;
		opDown(100);
	}
}


function opDown(top) {
	var imgObj = document.getElementById("imgchange");
	var doit = true;
	if(navigator.platform == "Win32" || navigator.userAgent.indexOf('Gecko') >= 0){
		doit = false;
		top -= 10;
		if(isIE) {
			imgObj.style.filter="alpha(Opacity="+top+")";
		}
		else {
			if(top == 100) dotop = 1.0;
			else dotop = top/100;
			imgObj.style.opacity=dotop;
		}
		if(top > 0) {
			if(timeOut != null) clearTimeout(timeOut);
			timeOut = window.setTimeout("opDown("+top+")", 60);
		}
		else doit = true;
	}
	if(top <= 0) {
		imgObj.src = nImg.src;
		if(timeOut != null) clearTimeout(timeOut);
		if(imgObj.complete) {
			timeOut = window.setTimeout("opUp(0)", 500);
		}
		else{
			imgObj.onload = function() {
				opUp(0);
			}
		}
	}
}

function opUp(top) {
	if(navigator.platform == "Win32" || navigator.userAgent.indexOf('Gecko') >= 0){
		top += 10;
		var imgObj = document.getElementById("imgchange");
		if(isIE) {
			imgObj.style.filter="alpha(Opacity="+top+")";
		}
		else {
			if(top == 100) dotop = 1.0;
			else dotop = top/100;
			imgObj.style.opacity=dotop;
		}
		if(top < 100) {
			if(timeOut != null) clearTimeout(timeOut);
			timeOut = window.setTimeout("opUp("+top+")", 60);
		}
	}
}

