	var the_timeout;
	var key = 0;
	var pre = -1;
	var num = 4;

	function rotateImage(){
		for(var i=0;i<num;i++){
			document.getElementById(i+1).src = 'images/main_bt_gray.png';
			document.getElementById(0).src = 'images/main_bt_stop.png';
			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;
		document.getElementById(key+1).src = 'images/main_bt_white.png';
		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,10000);
	}

	function showImage(index){
		key = index;
		clearTimeout(the_timeout);
		rotateImage();
	}

	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();


function searchSubmit(){
	var query = document.getElementById('q').value;
	location.href="search/index.htm?keyword="+query;
}
