
//マウスによるリサイズ状態フラグの初期設定
var MouseResizeFlag = false;

//マウスによる反転選択の解除（Chrome対応）
document.onmousedown = function(){return false;};

//マウスによる画面リサイズ（マウスを離したとき）
document.onmouseup =function(){
	//リサイズ実行中の場合
	if (MouseResizeFlag == true){

		//ビデオのサイズ変更
		var Obj = document.getElementById("VideoTag");
		Obj.style.pixelWidth = event.x -100;
		Obj.style.pixelHeight = event.y -100;
	}
	//リサイズフラグをOFFにする
	MouseResizeFlag = false;
}
		
//マウスによる画面リサイズ（マウスを押したとき）
function MouseDownResize(){
	//リサイズフラグをONにする
	MouseResizeFlag = true;
}


//回転状態の初期値を設定
var RotateState = 1;

//回転処理を行う関数
function Rotate(){
	var VObj = document.getElementById("VideoTag");

	//状態ごとに表示角度を変更する
	switch(RotateState){
		case 1:
			VObj.className = "Rotate90";
			break;
		case 2:
			VObj.className = "Rotate180";
			break;
		case 3:
			VObj.className = "Rotate270";
			break;
		case 4:
			VObj.className = "Rotate360";
			break;
	}
	//回転状態を1増やす
	RotateState = RotateState + 1;
	//360度で元に戻す
	if(RotateState > 4){
		RotateState = 1
	}
	//説明削除
	showNm(null);
}

function showimg(){
	document.getElementById('bigimg').style.display = 'block';
	//document.getElementById('VideoTag').style.display = 'none';
	document.getElementById('btnTag').style.display = 'none';
	//document.getElementById('tunnelTag').style.display = 'none';
	//説明削除
	showNm(null);
}
function noneimg(){
	document.getElementById('bigimg').style.display = 'none';
	//document.getElementById('VideoTag').style.display = 'block';
	document.getElementById('btnTag').style.display = 'block';
	//document.getElementById('tunnelTag').style.display = 'block';
	RotateState = 4;
	Rotate();
	//document.getElementById('chgval02').style.textAlign = 'center';
	//document.getElementById('chgval02').width='200px';
	//説明削除
	showNm(null);
}

function chgImg(val){
	//次・前動作
	if(val == "pre"){
		if(chgNo == 0){
			chgNo = list.length-1;
		}else{
			chgNo = chgNo -1;
		}
	}else if(val == "next"){
		if(chgNo == (list.length - 1)){
			chgNo = 0;
		}else{
			chgNo = chgNo + 1;
		}
	}else{
		//初期表示
	}
	
	//拡大画像
	//document.images["chgval01"].src = list[chgNo][0];
	//<td colspan="2" id="chgval01">
	/*margintopsize = list[chgNo][5];
	if(margintopsize == null || margintopsize ==""){
		margintopsize = 30;
	}
	imgheight = list[chgNo][6];
	if(imgheight == null || imgheight == ""){
		imgheight = 600;
	}*/
	document.getElementById('chgval01').innerHTML = "<td colspan=\"2\" id=\"chgval01\">" + "<img src=\"" + list[chgNo][0] + "\"" + " name=\"chgval01\" height=\"" + list[chgNo][6] + "\" style=\"margin-top: " + list[chgNo][5] + "px;\"/>" + "</td>";
	//document.getElementById('chgval01').innerHTML = "<td colspan=\"2\" id=\"chgval01\">" + "<img src=\"" + list[chgNo][0] + "\"" + " name=\"chgval01\" height=\"" + imgheight + "\" style=\"margin-top: " + margintopsize + "px;\"/>" + "</td>";
	//document.getElementById('chgval01').innerHTML = "<img src=\"" + list[chgNo][0] + "\"" + " id=\"chgval01\" name=\"chgval01\" height=\"" + imgheight + "\" style=\"margin-top: " + margintopsize + "px;\"/>";
	
	//サムネイル画像
	wsize = false;
	if(list[chgNo][3] > list[chgNo][4]){
		wsize = true;
	}
	imghtml = "<td valign=\"bottom\" id=\"chgval02\" style=\"text-align: center;\">";
	//imghtml = imghtml + "<img src=\"" + list[chgNo][0] + "\"" + "width=\"400\" style=\"margin-bottom: " + list[chgNo][2] + "px;\" " + " id=\"VideoTag\"\"/>";
	//imghtml = imghtml + "</td>";
	htmlsrc = "";
	if(wsize){
		htmlsrc = "<img src=\"" + list[chgNo][0] + "\"" + " width=\"400\" style=\"margin-bottom: " + list[chgNo][2] + "px;\" " + " id=\"VideoTag\"\"/>";
	}else{
		htmlsrc = "<img src=\"" + list[chgNo][0] + "\"" + " height=\"400\" style=\"margin-bottom: " + list[chgNo][2] + "px;\" " + " id=\"VideoTag\"\"/>";
	}
	imghtml = imghtml + htmlsrc + "</td>";
	document.getElementById('chgval02').innerHTML = imghtml;
	
	//説明削除
	showNm(null);
	
	//初期表示用のサムネイルhtmlを返す
	return htmlsrc;
}

function showNm(val){
	if(val != null){
		RotateState = 4;
		Rotate();
		document.getElementById('showNm').innerHTML = "<span id=\"showNm\">" + list[chgNo][1] + "</span>"
	}else{
		document.getElementById('showNm').innerHTML = "<span id=\"showNm\"></span>"
	}
}

function chgMove(val){
	if(val == "tunnel"){
		document.images["tunnel"].src = "img/parts/tunnelb.gif"
	}else if(val == "entrance"){
		document.images["entranceimg"].src = "img/top/entranceb.gif"
	}else if(val == "easel"){
		document.images["easelimg"].src = "img/top/easelb.gif"
	}else if(val == "subway"){
		document.images["subwayimg"].src = "img/top/subwayb.gif"
	}else if(val == "newyork"){
		document.images["newyorkimg"].src = "img/top/newyorkb.gif"
	}else if(val == "tokyo"){
		document.images["tokyoimg"].src = "img/top/tokyob.gif"
	}else if(val == "worker"){
		document.images["workerimg"].src = "img/top/workerb.gif"
	}else if(val == "mobiles"){
		document.images["mobiles"].src = "img/top/mobilesb.gif"
	}else if(val == "brooklyn"){
		document.images["brooklyn"].src = "img/top/brooklynb.gif"	
	}
}

function rtnMove(val){
	if(val == "tunnel"){
		document.images["tunnel"].src = "img/parts/tunnela.gif"
	}else if(val == "entrance"){
		document.images["entranceimg"].src = "img/top/entrancea.png"
	}else if(val == "easel"){
		document.images["easelimg"].src = "img/top/easela.png"
	}else if(val == "subway"){
		document.images["subwayimg"].src = "img/top/subwaya.png"
	}else if(val == "newyork"){
		document.images["newyorkimg"].src = "img/top/newyorka.png"
	}else if(val == "tokyo"){
		document.images["tokyoimg"].src = "img/top/tokyoa.png"
	}else if(val == "worker"){
		document.images["workerimg"].src = "img/top/workera.png"
	}else if(val == "mobiles"){
		document.images["mobiles"].src = "img/top/mobilesa.png"
	}else if(val == "brooklyn"){
		document.images["brooklyn"].src = "img/top/brooklyna.png"	
	}
}
