﻿function OnClient1Click(sender, mouseEventArgs)
{
  window.open("http://www.runaware.com/microsoft/de-de/edu/td");
}

function OnClient2Click(sender, mouseEventArgs)
{
  window.open("http://www.runaware.com/microsoft/de-de/edu/td");
}

function OnClient3Click(sender, mouseEventArgs)
{
  window.open("http://www.runaware.com/microsoft/de-de/edu/td");
}


function createSilverlightRotator()
{		
	Silverlight.createObjectEx({
		source: 'Rotator.xaml',
		parentElement: document.getElementById('slRotator'),
		id: 'SilverlightPlugIn',
		properties: {
			width: '620',
			height: '190',
			background:'#ffffff',
			isWindowless: 'false',
			version: '1.0'
		},
		events: {
				onError: null
		},		
		context: null 
	});
}

var currentClient = 1;

function startAnim(s)
{
	var tb = s.findName("SB1")
	if (tb != null)
	{
		s.findName("FadeOut")["Storyboard.TargetName"] = "client" + currentClient;					
		s.findName("FadeIn")["Storyboard.TargetName"] = "client" + getNextNum(currentClient);									
		tb.AddEventListener("Completed", "nextAnim")					
		tb.Begin();
	}
}

function nextAnim(s)
{
	var tb =s.findName("SB1")
	if (tb != null)
	{
		tb.Stop();
		s.findName("client" + currentClient).Opacity = "0";
		currentClient = getNextNum(currentClient);
		s.findName("client" + currentClient).Opacity = "1";
		s.findName("FadeOut")["Storyboard.TargetName"] = "client" + currentClient;					
		s.findName("FadeIn")["Storyboard.TargetName"] = "client" + getNextNum(currentClient);					
		tb.Begin();
	}
}

function getNextNum(currentNum)
{
	if (currentNum == 3)
		return 1;
	else
		return currentNum+1;
}
