	//home page rotation functionality
	
	var t = 0;
	var defaultSpeed = 1400;	//fadeout and fadein speed
	var move = 1;
	var currentID = 0;
	
	/*
	//test data
	var count = 0;		//splash count
	
	var title = new Array(count);
	var text 	= new Array(count);
	var image = new Array(count);
	var link 	= new Array(count);
	
	title[0] = 'Title 0';
	title[1] = 'Title 1';
	
	text[0] = 'Text 0';
	text[1] = 'Text 1';
	
	image[0] = './../files/general/d200f6e3-8d1a-fea4-31c2-424152cb8f4c.jpg';
	image[1] = './../files/general/2a290dc8-581c-73e4-6d59-17e32b4a3ef5.jpg';
	
	link[0] = 'http://www.google.com';
	link[1] = 'http://www.wcd.ch'*/
	
	
	function RotateView(id, speed) 
	{
		if (move == 0)
		{
			return;
		}
		currentID = id;
		clearTimeout(t);
		
		//$('#main #sidebar').fadeOut(speed);	//problems with title in IE
		$('#page .visual #splash').fadeOut(speed, function() 
		{		
			//$('#main #sidebar .information .heading').html(title[id]);
			//$('#main #sidebar .information .text').html(text[id]);
			$('#page .visual a.information').attr('href', link[id]);
			$('#page .visual #splash').attr('src', image[id] /*+ '?' + Math.random()*/);
			$('#page .visual #splash').fadeIn(speed, function() 
			{
				StartAnimation(id);
				//setTimeout("StartAnimation("+ id +")", rd);
			});
			
			/*$('#main #sidebar').delay(120).fadeIn(speed, function() 
			{
				StartAnimation(id);
				//setTimeout("StartAnimation("+ id +")", rd);
			});	*/
		});
	}
	
	
	function StartAnimation(id) 
	{
		if (count == 0)
		{
			return;
		}
		if (move == 0)	//pause
		{
			return;
		}
		
		if (move == -1)	//go back
		{
			id--;	
			
			if (id < 0)
			{
				id = count - 1;
			}
		}
		else	//go next
		{
			id++;
		
			if (id + 1 > count) 
			{
				id = 0;
			}
		}
		
		var delay = 3000;
		var speed = defaultSpeed;
		
		if (move == 2 || move == -1)
		{
			clearTimeout(t);
			delay = 1;
			move = 1;
			speed = defaultSpeed / 2;
		}
		
		t = setTimeout('RotateView('+ id +', '+ speed +')', delay);
	}
	
	
	$(document).ready(function()
	{
		if (!count)
		{
			var count = 0;
		}
		
		$('#page .controls .pause').click(function(event)
		{ 
			event.preventDefault();
			if (move == 0)
			{
				move = 2;	//move again
			}
			else
			{
				move = 0;	//stop
			}
			clearTimeout(t);
			StartAnimation(currentID);
		});
		
		$('#page .controls .previous').click(function(event)
		{ 
			event.preventDefault();
			move = -1;	//move back
			clearTimeout(t);
			StartAnimation(currentID);
		});
		
		$('#page .controls .next').click(function(event)
		{ 
			event.preventDefault();
			move = 2;	//move next
			clearTimeout(t);
			StartAnimation(currentID);
		});
		
		StartAnimation(currentID);
	});
