	var the_timeout;
	var key = 0;
	var pre = -1;
	var num = 3;

	function rotateImage(){
		for(var i=0;i<num;i++){
			
			document.getElementById('image'+(i+1)).style.zIndex = -1000;
		}
		if((pre!=-1)&&(pre!=key)) document.getElementById('image'+(pre+1)).style.zIndex = 1500;
		document.getElementById('image'+(key+1)).style.zIndex = 1000;
		
		if((pre!=-1)&&(pre!=key)) $("#image"+(pre+1)).fadeOut('slow');
		$("#image"+(key+1)).fadeIn('slow');
		pre = key;
		key++;
		if (key >= num){ key = 0; }
		var function_string = "rotateImage("+key+");";
		the_timeout = setTimeout(function_string,5000);
	}


	function gallerySwitch(){
		if(the_timeout>0){
			clearTimeout(the_timeout);
			the_timeout = 0;
			document.getElementById(0).src = 'images/main_bt_play.png';
		}else{
			showImage(key);
			document.getElementById(0).src = 'images/main_bt_stop.png';
		}
	}
	rotateImage();

