
// Example image: This image would toggle between "myimage_0.gif" and "myimage_1.gif".
/*
	<img border="0" alt="" id="myimage" src="/boeken/images/myimage_0.gif" 
		onload="cacheImgSrcSuffix(this.id,0,1)" 
		onmouseover="setImgSrcSuffix(this.id,1)" 
		onmouseout="setImgSrcSuffix(this.id,0)"
	>
*/

	var booImgSrcFade = true;
	var fltImgSrcFade = 0.2;

	// Caches all versions of the image URL, belonging to the Id, with the last digit substituted by the arguments.
	// for example: 'myimage_0.gif' and 'myimage_1.gif'
	function cacheImgSrcSuffix(strId){
		if(dom){
			// get the picture source name
			strImgUrl = document.getElementById(strId).src;
			// split the url
			strImgUrlPrefix = strImgUrl.substr(0,strImgUrl.length-5);
			strImgUrlSuffix = strImgUrl.substr(strImgUrl.length-4);
			// for all desired suffixes
			for(var intA=1; intA<arguments.length; intA++){
				eval(	""
						+ "obj" + strId + arguments[intA] + " = new Image();"
						+ "obj" + strId + arguments[intA] + ".src = '" + strImgUrlPrefix + arguments[intA] + strImgUrlSuffix + "';"
				);
			}
		}
	}

	// swaps the pre-loaded images around on events
	function setImgSrcSuffix(strId,intState){
		if(dom){
			// make the supposed object Id
			strObj = 'obj' + strId + intState;
			imgObj = eval(strObj);
			// put is back where you found it
			if(typeof(imgObj)!='undefined'){
				if(ie && dom && !mc && booImgSrcFade){
					document.getElementById(strId).style.filter="blendTrans(duration="+fltImgSrcFade+")";
					document.getElementById(strId).filters.blendTrans.Apply();
					document.getElementById(strId).src = imgObj.src;
					document.getElementById(strId).filters.blendTrans.Play();
				}else{
					document.getElementById(strId).src = imgObj.src;
				}
			}
		}
	}
