// JavaScript Document
$(function(){
	$('.link_9').css('background','none');
	$('#school_text ul li:eq(0)').css('margin-top',0);
	$('#text').css('opacity',0.6);
	 Autoshow();
		   $('.list li:eq(0)').bind('click',function(){
										   
										   Autochange(0);
										   return false;
										   
										   });
		   $('.list li:eq(1)').bind('click',function(){
										   
										   
										   Autochange(1);
										   return false;
										  
										   });
		   $('.list li:eq(2)').bind('click',function(){
										   
										  
										   Autochange(2);
										   return false;
										  
										   });
		   
		   
			$('.list li:eq(3)').bind('click',function(){
										   
										  
										   Autochange(3);
										   return false;
										  
										   });
			
			
});

var imgindex=0;
var ChangeTime;

function Autoshow(){
	 Autochange(imgindex);
}


function Autochange(index){
	if(ChangeTime)
	{
		clearTimeout(ChangeTime);
	}
	imgindex=index;
	moveElement("gallery",0,-index*277,10);
	var list=$('.list li');
	list.attr('class','off');
	list.eq(index).attr('class','on');
	$('#text').animate({top:-40},'fast',function(){
												 var source=$('#gallery a').eq(index).attr('title')
												 $(this).find('p').html(source);
												 })
	          .animate({top:0},'normal');
	
	if(imgindex>=3) imgindex=0;
	else
	{
		imgindex=index+1;
	}
    ChangeTime=setTimeout("Autoshow()",3500);      
}
