var speed = 0;
var actimage = 1;
var mylogo;

var img1 = new Image;
img1.src = 'http://www.freiburg2009.com/clips/rwm-logo.jpg';

var img2 = new Image;
img2.src = 'http://www.freiburg2009.com/clips/rwm-logo2.jpg';

function init ()  {
	if (document.getElementById)  {
		mylogo = document.getElementById ('logo');
	}  else  {
		mylogo = 0;
	}
}

function startrun (position, width)  {
	if (mylogo != 0)  {
		var newposition;
		var newwidth;
		if (actimage == 1 && position > 150 && width==147)  {
			mylogo.style.left = (position-1)+"px";
			newposition = position-1;
			newwidth = 147;
		}
		else if (actimage == 1 && position < 300 && ((position == 150 && width > 1) || (position >=150 && width<147 && width>1)))  {
			mylogo.style.width = (width-2)+"px";
			mylogo.style.left = (position+1)+"px";
			newposition = position+1;
			newwidth = width-2;
			if (newwidth < 1)  {
				newwidth = 1;
			}
		}
		else if (actimage == 1 && width == 1 && position < 300)   {
			mylogo.src = img2.src;
			actimage = 2;
			newposition = position;
			newwidth = 1;
		}
		else if (actimage == 2 && width < 147 && position < 300)  {
			mylogo.style.width = (width+2)+"px";
			mylogo.style.left = (position-1)+"px";
			newposition = position-1;
			newwidth = width+2;
			if (newwidth > 147)  {
				newwidth = 147;
			}
		}  
		else if (actimage == 2 && width==147 && position < 750)  {
			mylogo.style.left = (position+1)+"px";
			newposition = position+1;
			newwidth = 147;
		}
		else if (actimage == 2 && ((position == 750 && width > 1) || (position >= 750 && width<147 && width>1)))  {
			mylogo.style.width = (width-2)+"px";
			mylogo.style.left = (position+1)+"px";
			newposition = position+1;
			newwidth = width-2;
			if (newwidth < 1)  {
				newwidth = 1;
			}
		}
		else if (actimage == 2 && width == 1 && position > 300)   {
			mylogo.src = img1.src;
			actimage = 1;
			newposition = position;
			newwidth = 1;
		}
		else if (actimage == 1 && position > 300 && width < 147)  {
			mylogo.style.width = (width+2)+"px";
			mylogo.style.left = (position-1)+"px";
			newposition = position-1;
			newwidth = width+2;
			if (newwidth > 147)  {
				newwidth = 147;
			}
		} 
	
		window.setTimeout ("startrun ("+(newposition)+", "+newwidth+");", speed);
	}
}