////////////////////////////////

window.addEvent('domready', function() {
									 
var left1 = $("left1");
var left2 = $("left2");
var left3 = $("left3");

	left3.fade('hide');
	left2.fade('hide');

var index = 0;
var isPaused=0;
var forwardleftcol = function()
{
	
	index++;
	if (index<0)
	{
		index=2;
	}
	if (index>2)
	{
		index=0;
	}
	left1.fade('hide');
	left2.fade('hide');
	left3.fade('hide');
	if( index == 0 )
	{
		left1.fade('in');
		
	}
	else if( index == 1 )
	{
		left2.fade('in');
		
	}
	else if( index==2)
	{
		left3.fade('in');
		
	}
	
}
var backwardleftcol = function()
{
	index--;
	if (index<0)
	{
		index=2;
	}
	if (index>2)
	{
		index=0;
	}
	left1.fade('hide');
	left2.fade('hide');
	left3.fade('hide');
	if( index == 0 )
	{
		left1.fade('in');
		
	}
	else if( index == 1 )
	{
		left2.fade('in');
	
	}
	else if( index==2)
	{
		left3.fade('in');
		
	}
	
	
}
var forwardleftcolwpause = function()
{
	index++;
	if(isPaused == 0){
		isPaused = 1;
		$clear(timer);
		$('play').fade('show');
		$('pause').fade('hide');
		}
	if (index<0)
	{
		index=2;
	}
	if (index>2)
	{
		index=0;
	}
	left1.fade('hide');
	left2.fade('hide');
	left3.fade('hide');
	if( index == 0 )
	{
		left1.fade('in');
		
	}
	else if( index == 1 )
	{
		left2.fade('in');
		
	}
	else if( index==2)
	{
		left3.fade('in');

	}
	
	
}
var backwardleftcolwpause = function()
{
	index--;
	if(isPaused == 0){
		isPaused = 1;
		$clear(timer);
		$('play').fade('show');
		$('pause').fade('hide');
	}
	if (index<0)
	{
		index=2;
	}
	if (index>2)
	{
		index=0;
	}
	left1.fade('hide');
	left2.fade('hide');
	left3.fade('hide');
	if( index == 0 )
	{
		left1.fade('in');
		
	}
	else if( index == 1 )
	{
		left2.fade('in');

	}
	else if( index==2)
	{
		left3.fade('in');

	}

	
}
var timer = forwardleftcol.periodical(5000,this);
var play = function()
{
		if(isPaused == 0){
			isPaused = 1;
			$clear(timer);
			$('play').fade('show');
			$('pause').fade('hide');
		}
		else{
			isPaused = 0;
			timer = forwardleftcol.periodical(5000,this);
			$('play').fade('hide');
			$('pause').fade('show');
		}
		

}
$('play').addEvent('click',function(e){
								 e.stop();
								 play.run();}
								 );
$('pause').addEvent('click',function(e){
								 e.stop();
								 play.run();}
								 );
$('right').addEvent('click',function(e){
								 e.stop();
								
								forwardleftcolwpause.run();
							  	}
								);
$('left').addEvent('click',function(e){
								 e.stop();

							
								 backwardleftcolwpause.run();
								 }
								 );
//////////////////////////////////////////////////
/*
    var  mc= $('maincontainer');
	var count =2;
	mc.tween('height',300);
 	var scroll = new Fx.Scroll('demo-wrapper', {
	wait: false,
	duration: 500, 
	offset: {'x': -305, 'y': -50},
	transition: Fx.Transitions.Quad.easeInOut});
	scroll.toElement('flashintro');

	var gotoflash = function()
	{
		scroll.toElement('news3');
		mc.tween('height',300);
	};
//gotoflash.delay();

	

	var slideforward = function()
	{
	
	if( count ==1)
	{
		scroll.toElement('flashintro');
		mc.tween('height',300);
		count=count+1;
	}
	else if (count == 2)
	{
		scroll.toElement('news2');
		mc.tween('height',400);
		count = count+1;
	}
	else if (count == 3)
	{
		scroll.toElement('news3');
		mc.tween('height',560);
		count = 1;
	}
	else if (count == 4)
	{
		scroll.toElement('news1');
		mc.tween('height',890);
		count = 1;
	}	
		
	}

//	var myTimer = slideforward.periodical(15000,this);
$('left').addEvent('click', function(event) {
	event = new Event(event).stop();
	if( count ==1)
	{
		scroll.toElement('news2');
		mc.tween('height',300);
		count = 4;
		
	}
	else if (count == 2)
	{
		scroll.toElement('news1');
		mc.tween('height',890);
		count = count-1;
	}
	else if (count == 3)
	{
		scroll.toElement('news3');
		mc.tween('height',560);
		count = count-1;
		
	}

	else if (count == 4)
	{
		scroll.toElement('flashintro');
		mc.tween('height',300);
		count = count-1;
	}
	
	});

$('right').addEvent('click', function(event) {
	event = new Event(event).stop();
	if( count ==1)
	{   
		scroll.toElement('news3');
		mc.tween('height',560);
		count=count+1;
		
	}
	else if (count == 2)
	{
		scroll.toElement('flashintro');
		mc.tween('height',300);
		count=count+1;
		
	}
	else if (count == 3)
	{
		scroll.toElement('news2');
		mc.tween('height',400);
		count=count+1;
	}
	else if (count == 4)
	{
		scroll.toElement('news1');
		mc.tween('height',890);
		count = 1;
	}	
	});
*/
 

});
/*window.addEvent('domready', function() {
									 
var left1 = $("left1");
var left2 = $("left2");
var left3 = $("left3");

	left3.fade('hide');
	left2.fade('hide');
$('play').fade('hide');
var index = 0;
var isPaused=0;
var forwardleftcol = function()
{
	
	
	if (index<0)
	{
		index=2;
	}
	if (index>2)
	{
		index=0;
	}
	left1.fade('hide');
	left2.fade('hide');
	left3.fade('hide');
	if( index == 0 )
	{
		left2.fade('in');
		index++;
	}
	else if( index == 1 )
	{
		left3.fade('in');
		index++;
	}
	else if( index==2)
	{
		left1.fade('in');
		index++;
	}
	
}
var backwardleftcol = function()
{
		
	if (index<0)
	{
		index=2;
	}
	if (index>2)
	{
		index=0;
	}
	left1.fade('hide');
	left2.fade('hide');
	left3.fade('hide');
	if( index == 0 )
	{
		left3.fade('in');
		index--;
	}
	else if( index == 1 )
	{
		left1.fade('in');
		index--;
	}
	else if( index==2)
	{
		left2.fade('in');
		index--;
	}
	
}
var forwardleftcolwpause = function()
{
	
	if(isPaused == 0){
			isPaused = 1;
			$clear(timer);
			$('play').fade('show');
			$('pause').fade('hide');
		}
	if (index<0)
	{
		index=2;
	}
	if (index>2)
	{
		index=0;
	}
	left1.fade('hide');
	left2.fade('hide');
	left3.fade('hide');
	if( index == 0 )
	{
		left2.fade('in');
		index++;
	}
	else if( index == 1 )
	{
		left3.fade('in');
		index++;
	}
	else if( index==2)
	{
		left1.fade('in');
		index++;
	}
	
}
var backwardleftcolwpause = function()
{
		if(isPaused == 0){
			isPaused = 1;
			$clear(timer);
			$('play').fade('show');
			$('pause').fade('hide');
		}
	if (index<0)
	{
		index=2;
	}
	if (index>2)
	{
		index=0;
	}
	left1.fade('hide');
	left2.fade('hide');
	left3.fade('hide');
	if( index == 0 )
	{
		left3.fade('in');
		index--;
	}
	else if( index == 1 )
	{
		left1.fade('in');
		index--;
	}
	else if( index==2)
	{
		left2.fade('in');
		index--;
	}
	
}
var timer = forwardleftcol.periodical(5000,this);
var play = function()
{
		if(isPaused == 0){
			isPaused = 1;
			$clear(timer);
			$('play').fade('show');
			$('pause').fade('hide');
		}
		else{
			isPaused = 0;
			timer = forwardleftcol.periodical(5000,this);
			$('play').fade('hide');
			$('pause').fade('show');
		}
		

}
$('play').addEvent('click',function(e){
								 e.stop();
								 play.run();}
								 );
$('pause').addEvent('click',function(e){
								 e.stop();
								 play.run();}
								 );
$('right').addEvent('click',function(e){
								 e.stop();
								
								forwardleftcolwpause.run();
							  	}
								);
$('left').addEvent('click',function(e){
								 e.stop();

							
								 backwardleftcolwpause.run();
								 }
								 );
/*
    var  mc= $('maincontainer');
	var count =2;
	mc.tween('height',300);
 	var scroll = new Fx.Scroll('demo-wrapper', {
	wait: false,
	duration: 500, 
	offset: {'x': -305, 'y': -50},
	transition: Fx.Transitions.Quad.easeInOut});
	scroll.toElement('flashintro');

	var gotoflash = function()
	{
		scroll.toElement('news3');
		mc.tween('height',300);
	};
//gotoflash.delay();

	

	var slideforward = function()
	{
	
	if( count ==1)
	{
		scroll.toElement('flashintro');
		mc.tween('height',300);
		count=count+1;
	}
	else if (count == 2)
	{
		scroll.toElement('news2');
		mc.tween('height',400);
		count = count+1;
	}
	else if (count == 3)
	{
		scroll.toElement('news3');
		mc.tween('height',560);
		count = 1;
	}
	else if (count == 4)
	{
		scroll.toElement('news1');
		mc.tween('height',890);
		count = 1;
	}	
		
	}

//	var myTimer = slideforward.periodical(15000,this);
$('left').addEvent('click', function(event) {
	event = new Event(event).stop();
	if( count ==1)
	{
		scroll.toElement('news2');
		mc.tween('height',300);
		count = 4;
		
	}
	else if (count == 2)
	{
		scroll.toElement('news1');
		mc.tween('height',890);
		count = count-1;
	}
	else if (count == 3)
	{
		scroll.toElement('news3');
		mc.tween('height',560);
		count = count-1;
		
	}
	else if (count == 4)
	{
		scroll.toElement('flashintro');
		mc.tween('height',300);
		count = count-1;
	}
	
	});

$('right').addEvent('click', function(event) {
	event = new Event(event).stop();
	if( count ==1)
	{   
		scroll.toElement('news3');
		mc.tween('height',560);
		count=count+1;
		
	}
	else if (count == 2)
	{
		scroll.toElement('flashintro');
		mc.tween('height',300);
		count=count+1;
		
	}
	else if (count == 3)
	{
		scroll.toElement('news2');
		mc.tween('height',400);
		count=count+1;
	}
	else if (count == 4)
	{
		scroll.toElement('news1');
		mc.tween('height',890);
		count = 1;
	}	
	});

 

});*/
