// JavaScript Document
function change_image(obj, url){
	obj.src = url;
}

function confirm_delete(url){
	if(window.confirm('Are you sure you want to delete?')){
		location.href=url;
	}
}
function confirm_submit(){
	if(window.confirm('Are you sure you want to submit?')){
		return true;
	}
	else{
		return false;
	}
}

function check_required(id){
	element = document.getElementById(id);
	if(element.value == ""){
		element.focus();
		return false;
	}
}

function setHeight(){
	//高さ合わせるIDを指定
	var id = new Array("rightbar", "contents");
	var idHeight = new Array();
	var maxHeight = 0;//追記
	//指定IDの高さを取得
	for(i=0; i<id.length; i++){
		idHeight[i] = document.getElementById(id[i]).offsetHeight;
		//alert(idHeight[i]);
	}

	//最大の高さをmaxHeightに格納
	for(i=0; i<id.length; i++){
		/*ここ間違い
		maxHeight = Math.max(idHeight[i], idHeight[i+1]);
		*/
		maxHeight = Math.max(maxHeight, idHeight[i]);
	//	alert(Math.max(maxHeight, idHeight[i]));
	//	alert(Math.max(maxHeight, idHeight[i]) - 50);
	}

	//一番高いのに合わせる
	for(i=0; i<id.length; i++){
		document.getElementById(id[i]).style.height = maxHeight + 0 + "px";
	//	alert('maxheight=>'+maxHeight);
	}
	
}
