//写真クリック
function chg_i(strN, intNo, strImgSize) {
	document.getElementsByName(strN)[1].src = document.getElementsByName(strN)[intNo].src;
	document.getElementsByName(strN)[0].value = document.getElementsByName(strN)[intNo].src;
	tmp_size = strImgSize.split(':');
	document.getElementsByName(strN)[0].style.width = tmp_size[0] + 'px';
	document.getElementsByName(strN)[0].style.height = tmp_size[1] + 'px';
}

//写真マウスオーバー
function mouse_over(strN, intNo, strImgSize) {
	document.getElementsByName(strN)[1].src = img_data(strN)[intNo];
	tmp_size = strImgSize.split(':');
	document.getElementsByName(strN)[1].style.width = tmp_size[0] + 'px';
	document.getElementsByName(strN)[1].style.height = tmp_size[1] + 'px';
}

//写真マウスアウト
function mouse_out(strN, intNo) {
	document.getElementsByName(strN)[1].style.width = document.getElementsByName(strN)[0].style.width;
	document.getElementsByName(strN)[1].style.height = document.getElementsByName(strN)[0].style.height;
	document.getElementsByName(strN)[1].src = document.getElementsByName(strN)[0].value;
}

//画像ファイル情報
function img_data(strN) {
	var image = new Array();
	image[document.getElementsByName(strN).length - 1] = new Image();

	for (i=0;i < image.length; i++) {
		image[i] = document.getElementsByName(strN)[i].src;
	}

	return image;
}

//画像ポップアップ
function popup(strN, test) {
	var para = '';

	var imgValArray = document.getElementsByName(strN)[0].value.split('/');

	para = '/pt/' + imgValArray[imgValArray.length - 1];
	NewWindow(test + para,'','680','600','yes');
}

//お気に入りに追加
function add_favorite(intNum) {
	var strTmpVal = '';
	var InfoPath = '';

	for (i=0;i < document.getElementsByName('PropId').length; i++) {
		if (document.getElementsByName('PropId')[i].checked) {
			strTmpVal += document.getElementsByName('PropId')[i].value + ','; 
		}
	}

	if (strTmpVal == '') {
		alert('お気に入りに追加する物件を選択してください');
		document.getElementsByName('PropId')[0].focus();
		return;
	} else {
		InfoPath = 'PropId/' + strTmpVal.substring(0, strTmpVal.length - 1);

		if (intNum == 1) {
			document.favorite1.action = document.favorite1.action + InfoPath;
			document.favorite1.submit();
		} else {
			document.favorite2.action = document.favorite2.action + InfoPath;
			document.favorite2.submit();
		}
	}
}

//問合せ
function inquiry_input(intNum, param) {
	var strTmpVal = '';
	var InfoPath = '';

	for (i=0;i < document.getElementsByName('PropId').length; i++) {
		if (document.getElementsByName('PropId')[i].checked) {
			strTmpVal += document.getElementsByName('PropId')[i].value + ','; 
		}
	}

	if (strTmpVal == '') {
		alert('お問い合わせする物件を選択してください');
		document.getElementsByName('PropId')[0].focus();
		return;
	} else {
		if (param == '') {
			InfoPath = '/PropId/' + strTmpVal.substring(0, strTmpVal.length - 1);
		} else {
			InfoPath = '/PropId/' + strTmpVal.substring(0, strTmpVal.length - 1);
		}

		if (intNum == 1) {
			document.inquiry1.action = document.inquiry1.action + param + InfoPath;
			document.inquiry1.submit();
		} else {
			document.inquiry2.action = document.inquiry2.action + param + InfoPath;
			document.inquiry2.submit();
		}
	}
}

