var thisTimer;

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');
				e.setStyle('display','none');
				$(showthis).setStyles({ opacity:0,display:'block'});
				$(showthis).fade('in');
				$$('#swlinkholder a').removeClass('current');
				var selector = 'swl'+String(nexty);
				$(selector).addClass('current');
				break;
			}
		
		}
	}.periodical(4000));
	$$('#swlinkholder a').each(function(e){
		e.addEvent('click',function(s){
			$$('#swlinkholder 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;
	});
});


}

