// JavaScript Document
		var fps = 10;
		// Hardcode catches for change of fade before finish or start initialised out of sequence (mouseout or mouseover missed)
		
		var fading = false;
		var appearing = false;
		
		
		function dofade(steps,img,value,targetvisibility, otype){
			value += (targetvisibility ? 1 : -1) / steps;
			if(targetvisibility ? value > 1 : value < 0) 
				value = targetvisibility ? 1: 0 ;
			
			setfade(img, value, otype);
			
			if(targetvisibility ? value < 1 : value > 0){
				setTimeout(function(){
					dofade(steps,img,value,targetvisibility, otype);
					}, 1000/fps);
				}
					
			}
		
		function fade(img, time, direction)
		{
			//document.getElementById('debug').innerHTML = "in fade";
		  // check if interupting a fade
		  
		
		  img = document.getElementById(img);
		  var steps = time * fps;
		
		  if (typeof img.style.opacity != 'undefined')
		  {
			var otype = 'w3c';
		  }
		  else if (typeof img.style.MozOpacity != 'undefined')
		  {
			otype = 'moz';
		  }
		  else if (typeof img.style.KhtmlOpacity != 'undefined')
		  {
			otype = 'khtml';
		  }
		  else if (typeof img.filters == 'object')
		  {
			otype = (img.filters.length > 0
				&& typeof img.filters.alpha == 'object'
				&& typeof img.filters.alpha.opacity == 'number')
				? 'ie' : 'none';
		  }
		  else { otype = 'none'; }
		
		  if (otype != 'none')
		  {
			if (direction == 'out') { dofade(steps, img, 1, false, otype); }
			else { dofade(steps, img, 0, true, otype); }
		  }
		}

		
		
			
		function setfade(img, value, otype){
			//document.getElementById('debug').innerHTML = value ;
			  switch(otype)
			  {
				case 'ie':
				  img.filters.alpha.opacity = value * 100;
				  break;
			
				case 'khtml':
				  img.style.KhtmlOpacity = value;
				  break;
			
				case 'moz':
				  img.style.MozOpacity = (value == 1 ? 0.9999999 : value);
				  break;
			
				default:
				  img.style.opacity = (value == 1 ? 0.9999999 : value);
			  }
			}
			
