			function imagefade(dir,imgId)
			{
				//window.status = imgO;
				if (dir == 1)
				{
					imgO += 2;
					//if (imgO > 100) {imgO = 100};
					document.getElementById(imgId).style.opacity = imgO/10;				
					document.getElementById(imgId).style.filter = 'alpha(opacity=' + (imgO * 10) + ')';
					
					if (imgO < 10)
					{
						//alert("imagefade(" + dir + "," + imgId + ")");
						setTimeout("imagefade(1,\'" + imgId + "\')",50);
					} else {
						//setTimeout("alert('fadout')",1500);
						setTimeout("imagefade(-1,\'" + imgId + "\')",10000);
					}				
					
					
				} else {
				
					//alert(dir);
				
					imgO -= 2;
					if (imgO > 10) {imgO = 10};
					document.getElementById(imgId).style.opacity = imgO/10;				
					document.getElementById(imgId).style.filter = 'alpha(opacity=' + (imgO * 10) + ')';
					
					if (imgO > 0)
					{
						//alert("imagefade(" + dir + "," + imgId + ")");
						setTimeout("imagefade(-1,\'" + imgId + "\')",50);
					} else {
						imageswap(imgId);
					}
				
				}				

			}
			
			function imageswap(imgId)
			{
				currentImg++;
				if (currentImg >= maxImg) {currentImg = 0;}
				document.getElementById(imgId).src = imgs[currentImg].src;
				imagefade(1,imgId);
				document.getElementById("pImageViewer").innerHTML = imgs_title[currentImg];
			}