/* 介護ハンドトゥハート 汎用 */
/* hand 2 hart */


function dummylink(mes){
	alert(mes);
}

function kiyaku(n){
	var a=document.getElementById("doui2").value;
	if(n==0){
		document.getElementById("submitbox").style.display="none";
	} else {
		document.getElementById("submitbox").style.display="block";
	}
}

function confirmLogout(){
//    window.confirm("ログアウトしますか？","ログアウト確認",function(result){
//    	if( result != "ok")
//    		return;
    location.href='logout_do.php';
//    });
}

/* logout 確認 */
function showlogoutinfo(){
	document.getElementById("logoutinfo").style.display="block";
}
function cancelMe(){
	document.getElementById("logoutinfo").style.display="none";
}

function chkBr(){
//alert(navigator.userAgent);
var B="";
	if(navigator.userAgent.indexOf("Opera") != -1){ // 文字列に「Opera」が含まれている場合
		B="o";
	}
	else if(navigator.userAgent.indexOf("MSIE") != -1){ // 文字列に「MSIE」が含まれている場合
		B="m";
	}
	else if(navigator.userAgent.indexOf("Firefox") != -1){ // 文字列に「firefox」が含まれている場合
		B="f";
	} 
	else if(navigator.userAgent.indexOf("Safari") != -1){
		B="s";
	}
	else {
		B="x";
	}
	
	return B;

}

function setprofileGrf(){
var imgX;
var imgY;
	switch(chkBr()){
	case "f":
			imgX=document.profilephoto.naturalWidth;
			imgY=document.profilephoto.naturalHeight;
		break;
	case "s":
			imgX=profilephoto.naturalWidth;
			imgY=profilephoto.naturalHeight;
		break;
	case "m":
			imgX=profilephoto.width;
			imgY=profilephoto.height;
//			alert(imgX);
		break;
	case "o":
			profilephoto.removeAttribute("width");
			profilephoto.removeAttribute("height");
			imgX = profilephoto.width;
			imgY = profilephoto.height;
		break;
	default:
			imgX=document.profilephoto.width;
			imgY=document.profilephoto.height;
	}
	
	if(imgX > imgY){
		document.getElementById("profilephoto").style.width="100px";
	} else {
		document.getElementById("profilephoto").style.height="100px";
	}
	document.getElementById("profilephoto").style.display="block";
}

function setmypageGrf(){
var imgX;
var imgY;
	switch(chkBr()){
	case "f":
			imgX=document.mpphoto.naturalWidth;
			imgY=document.mpphoto.naturalHeight;
		break;
	case "s":
			imgX=mpphoto.naturalWidth;
			imgY=mpphoto.naturalHeight;
		break;
	case "m":
			imgX=document.getElementById("mpphoto").width;
			imgY=document.getElementById("mpphoto").height;
		break;
	case "o":
			mpphoto.removeAttribute("width");
			mpphoto.removeAttribute("height");
			imgX = mpphoto.width;
			imgY = mpphoto.height;
		break;
	default:
			imgX=document.mpphoto.width;
			imgY=document.mpphoto.height;
	}
	
	if(imgX > imgY){
		document.getElementById("mpphoto").style.width="100px";
	} else {
		document.getElementById("mpphoto").style.height="100px";
	}
	document.getElementById("mpphoto").style.display="block";
}

window.onload = function() {
//chkBr();
	if(document.getElementById("profilephoto")){
		setprofileGrf();
	}
	if(document.getElementById("mpphoto")){
		setmypageGrf();
	}
	
}

