var thisTimer;
var box1timer;
var box2timer;
var box3timer;

function homeSwitchInit(){
	var allofthem = $$('.switch');
	$('switchholder').addEvent('load',thisTimer = function(s){
		for(var i=0; i<allofthem.length; i++){
			var e = allofthem[i];
			if(e.getStyle('display') == 'block'){
				var nexty = i + 2;
				if(nexty > allofthem.length){
					nexty = Number(1);
				}
				var showthis = 'swd' + String(nexty);
				e.fade('out');
				(function(){e.setStyle('display','none');}).delay(400);
				(function(){
					$(showthis).setStyles({ opacity:0,display:'block'});
					$(showthis).fade('in');
				}).delay(400);
				(function(){
					$$('#solutions a').removeClass('current');
					var selector = 'swl'+String(nexty);
					$(selector).addClass('current');
				}).delay(400);
				break;
			}
		
		}
	}.periodical(5000));
	$$('#solutions a').each(function(e){
		e.addEvent('click',function(s){
			$$('#solutions a').removeClass('current');
			e.addClass('current');
			$$('.switch').setStyle('display','none');
			$('swd'+(e.id.substring(3))).setStyles({ opacity:0,display:'block'});
			$('swd'+(e.id.substring(3))).fade('in');
			$clear(thisTimer);
			return false;
		});
	});

}

function boxoneInit(){
	var allofthem = $$('.box1sw');
	$('box1title').addEvent('load',box1timer = function(s){
		for(var i=0; i<allofthem.length; i++){
			var e = allofthem[i];
			if(e.getStyle('display') == 'block'){
				var nexty = i + 2;
				if(nexty > allofthem.length){
					nexty = Number(1);
				}
				var showthis = 'box1sw' + String(nexty);
				e.fade('out');
				(function(){e.setStyle('display','none');}).delay(400);
				(function(){
					$(showthis).setStyles({ opacity:0,display:'block'});
					$(showthis).fade('in');
				}).delay(400);
				break;
			}
		
		}
	}.periodical(5000));
}

function boxtwoInit(){
	var allofthem = $$('.box2sw');
	$('box2title').addEvent('load',box2timer = function(s){
		for(var i=0; i<allofthem.length; i++){
			var e = allofthem[i];
			if(e.getStyle('display') == 'block'){
				var nexty = i + 2;
				if(nexty > allofthem.length){
					nexty = Number(1);
				}
				var showthis = 'box2sw' + String(nexty);
				e.fade('out');
				(function(){e.setStyle('display','none');}).delay(400);
				(function(){
					$(showthis).setStyles({ opacity:0,display:'block'});
					$(showthis).fade('in');
				}).delay(400);
				break;
			}
		
		}
	}.periodical(5000));
}

function boxthreeInit(){
	var allofthem = $$('.box3sw');
	$('box2title').addEvent('load',box3timer = function(s){
		for(var i=0; i<allofthem.length; i++){
			var e = allofthem[i];
			if(e.getStyle('display') == 'block'){
				var nexty = i + 2;
				if(nexty > allofthem.length){
					nexty = Number(1);
				}
				var showthis = 'box3sw' + String(nexty);
				e.fade('out');
				(function(){e.setStyle('display','none');}).delay(400);
				(function(){
					$(showthis).setStyles({ opacity:0,display:'block'});
					$(showthis).fade('in');
				}).delay(400);
				break;
			}
		
		}
	}.periodical(5000));
}