imgno=0;imgflag=0;showcheck=0;var timeid;
function changeimg(im){
if(document.all){
if(imgno<im)
document.images["viewimg"].filters[0].transition=7;
else
document.images["viewimg"].filters[0].transition=6;

document.images["viewimg"].filters[0].Apply();
document.images["viewimg"].src=chimg[im][0];
document.images["viewimg"].filters[0].Play();}
else{
document.images["viewimg"].src=chimg[im][0];}
document.getElementById("imgmemo").innerHTML=chimg[im][1];
imgno=im;
}
function direction(di){
if(di=='migi')
imgflag=1;
else if(di=='hidari')
imgflag=2;
if(!showcheck){
clearTimeout(timeid);
showcheck=1;
showstart();}
}

function showstart(){
if(!showcheck)return;
if(imgflag==1){
if(!document.showform.loopcheck.checked && imgno==(chimg.length-1)){
showcheck=0;return
}else{
imgno++;
imgno%=chimg.length;
}
}else{
if(!document.showform.loopcheck.checked && imgno==0){
showcheck=0;return
}else{
imgno--;if(imgno<0)imgno=chimg.length-1;
}
}

if(document.all){
if(imgflag==1)
document.images["viewimg"].filters[0].transition=7;
else
document.images["viewimg"].filters[0].transition=6;

document.images["viewimg"].filters[0].Apply();
document.images["viewimg"].src=chimg[imgno][0];
document.images["viewimg"].filters[0].Play();}
else{
document.images["viewimg"].src=chimg[imgno][0];}
document.getElementById("imgmemo").innerHTML=chimg[imgno][1];
timeid=setTimeout("showstart()",changesec);}