var interval = 6; // delay between rotating images (in seconds)
interval *= 1000;
var flagtime=0;
var image_index = 0;
image_list = new Array();
note_list = new noteArray(10);
var number_of_image = image_list.length;
var timesnum=0;
image_list[0] = new imageItem("photos/about/1.jpg");
image_list[1] = new imageItem("photos/about/2.jpg");
image_list[2] = new imageItem("photos/about/3.jpg");
image_list[3] = new imageItem("photos/about/4.jpg");
image_list[4] = new imageItem("photos/about/5.jpg");
image_list[5] = new imageItem("photos/about/6.jpg");

note_list[0] = "Liu Li meets famous Wu Bin in Beijing";
note_list[1] = "Toast to a new business agreement";
note_list[2] = "MsL tours a Chinese show into the heart of Wales";
note_list[3] = "Liu Li is on the first page of Mid Wales Journal";
note_list[4] = "Exchanging performing arts with university students";
note_list[5] = "Introducing British performing arts to Chinese artists";

function noteArray(size)
{
 this.length=size;
 for(i=1;i<=size;i++)
 {
 this[i]=""
 }
 return this;
}
function counternum(){
 if( timesnum < 6 ){//9表示有9张图片
 timesnum++;
 document.all.slide_ent.src="about:blank";
 document.all.slide_ent.src="1.htm";
 }
}
function run(obj){
 interval=obj.options[obj.selectedIndex].value*1000;
 rotateImage();
}
function stop(){
 interval=0;
}
function previous(){
 var new_image = getPreviousImage();
 document['rImage'].src = new_image;
}
function next(){
 var new_image = getNextImage();
 document['rImage'].src = new_image;
}
function imageItem(image_location) {
this.image_item = new Image();
this.image_item.src = image_location;
}
function noteItem(note) {
this.note_item = new Image();
this.note_item.src = note;
}
function get_ImageItemLocation(imageObj) {
return(imageObj.image_item.src)
}
function get_NoteItemLocation(noteObj) {
return(noteObj.note_item.src)
}
function generate(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
}
function getPreviousImage() {
image_index = image_index-1;
if (image_index < 0){
 image_index=image_index+6;//9表示有9张图片
 }
var new_image = get_ImageItemLocation(image_list[image_index]);
document.all.span_1.innerText=image_index+1;
document.all.summary.innerText=note_list[image_index];
return(new_image);
}
function getNextImage() {
image_index = image_index+1;
if (image_index >= 6){
 image_index=image_index-6;//9表示有9张图片
 }
var new_image = get_ImageItemLocation(image_list[image_index]);
document.all.span_1.innerText=image_index+1;
document.all.summary.innerText=note_list[image_index];
return(new_image);
}
function rotateImage() {
if (interval == 0){
 return 1;
}
if (flagtime == 1){
 var now = new Date();
 var time1 = now.getTime();
 var time2;
 time1=time1+3000;
 time2=now.getTime();
 while(time2 < time1){
 now = new Date();
 time2=now.getTime();
 }
 flagtime=0;
}
var new_image = getNextImage();
document['rImage'].src = new_image;
var recur_call = "rotateImage('"+'rImage'+"')";
setTimeout(recur_call,interval);
}
