var a=["01.png","02.png","03.png","04.png","05.png","06.png","07.png","08.png","09.png","10.png","11.png","12.png","13.png","14.png","15.png","16.png","17.png","18.png","19.png","20.png","21.png","22.png","23.png","24.png","25.png","26.png","27.png","28.png","29.png","30.png","31.png","32.png","33.png","34.png","35.png","36.png","37.png","38.png","39.png","40.png","41.png","42.png","43.png","44.png","45.png","46.png","47.png","48.png","49.png","50.png"];
var makuWidth=325;
var mPicture;
var eleNum;
var i=0;
var pic;

function selectNum() {
	sn=document.form1.select1.value;
	obj=document.getElementById("img");
	isrc=obj.src;
	isrclen=isrc.length;
	cutsrc=isrc.substr(0,isrclen-6)+a[sn];
	obj.src=cutsrc;
	arrayLen=eval("b"+sn);
	nListCount=arrayLen.length;
	document.form1.destination.options.length=0;
	for (j=0;j<nListCount;j++) {
		document.form1.destination.options[j]=new Option(arrayLen[j],j);
	}
	obj.style.height=nListCount*60;
	initMp();
	mPicture.style.top="295px";
	i=0;
	selNum=0;
	Switch(sn);
}

//------------------------------------------------------------
//javascript by —‚¤‚³ http://www.scriptsquare.com/usajava/
//------------------------------------------------------------
function Switch(nType) {
	for (nLoop=0; nLoop<nListCount; nLoop++) {
		document.form1.elements["destination"].options[nLoop].text=eval("b"+nType)[nLoop];
	}
}
//------------------------------------------------------------

function initMp() {
	var makuTop=0;
	var makuBottom=60;
	mPicture=document.getElementById("img1");
	mPicture.style.clip="rect("+makuTop+" "+makuWidth+" "+makuBottom+" 0)";
	eleNum=0;
}

function movePict() {
	var selNum=eval(document.form1.destination.value);
	if (eleNum<selNum) {
		var makuTop=i*2+2;
		var makuBottom=makuTop+60;
		if (i<selNum*30) {
			i++;
			mPicturetop=mPicture.style.top;
			mPicTopStr=eval(mPicturetop.substr(0,mPicturetop.length-2));
			mPicTopStr=mPicTopStr-2;
			mPicture.style.top=mPicTopStr+"px";
			mPicture.style.clip="rect("+makuTop+" "+makuWidth+" "+makuBottom+" 0)";
		} else {
			kaijo();
		}
	} else if (eleNum>selNum) {
		var makuTop=i*2-2;
		var makuBottom=makuTop+60;
		if (i>selNum*30) {
			i--;
			mPicturetop=mPicture.style.top;
			mPicTopStr=eval(mPicturetop.substr(0,mPicturetop.length-2));
			mPicTopStr=mPicTopStr+2;
			mPicture.style.top=mPicTopStr+"px";
			mPicture.style.clip="rect("+makuTop+" "+makuWidth+" "+makuBottom+" 0)";
		} else {
			kaijo();
		}
	} else { 
		kaijo();
	}
}

function kaijo() {
	clearTimeout(pic);
	eleNum=eval(document.form1.destination.value);
	document.form1.submit2.disabled=false;
}
