// Rollover-script that adds '_on' to the src if img-buttons and input-buttons

	var defaultStatus = '';
	
		function roll_highlight() {
			if (!isOn(this.src)) {
				prefix = this.src.substring(0,this.src.lastIndexOf("."));
				postfix = this.src.substring(this.src.lastIndexOf("."));
				this.src = prefix+"_on"+postfix;
				if (this.alt) {
					window.status = this.alt;
				}
			}
			return true;			
		}
		
		function isOn(imgsrc) {
			if (imgsrc.length>6) {
				onstr = imgsrc.substring(imgsrc.lastIndexOf(".")-3,imgsrc.lastIndexOf("."));
				//alert(onstr);
				if (onstr.toLowerCase()=="_on") {
					return true;
				}
			} 
			return false;
		}
		
		function roll_shadow() {
			if (isOn(this.src)) {
				prefix = this.src.substring(0,this.src.lastIndexOf(".")-3);
				postfix = this.src.substring(this.src.lastIndexOf("."));
				this.src = prefix+postfix;
				if (this.alt) {
					window.status = defaultStatus;
				}
			}
			return true;			
		}
	
		function makeItRoll(ds) {
			if (ds!=null) {
				defaultStatus = ds;
				window.status = defaultStatus;
			}
			
/*	Check with a loop if 'rollover' exists in the name-tag	*/
			allElements = document.getElementsByTagName("img");
			var j = 0;
			var images = new Array();
			for(i=0;i<allElements.length;i++)	{
				if(allElements[i].name.indexOf('rollover')>-1)	{
					images[j] = allElements[i];
					j++;
				}
			}

			for (i=0;i<images.length;i++) {
				images[i].onmouseover = roll_highlight;
				images[i].onmouseout = roll_shadow;
			}
			
/* Check with a loop if input-type is 'image' */
			allElements = document.getElementsByTagName("input");
			var j = 0;
			var inputs = new Array();
			for(i=0;i<allElements.length;i++)	{
				if(allElements[i].type.indexOf('image')>-1)	{
					inputs[j] = allElements[i];
					j++;
				}
			}

			for (i=0;i<inputs.length;i++) {
				inputs[i].onmouseover = roll_highlight;
				inputs[i].onmouseout = roll_shadow;
			}
			
			return true;
		}
	
