//フォームアクション part1
function form_act(url,act)
{
	document.fm.action 	  = url;
	if(document.fm.act!=null) document.fm.act.value = act;
	document.fm.submit();
	return;
}

//フォームアクション part2
function form_act2(url,str)
{
	if(str)
	{
		var set = str.split("&");
		for(i=0;i<set.length;i++)
		{
			var arr = set[i].split("=");
			eval("document.fm."+arr[0]).value = arr[1]; 
		}
	}
	
	document.fm.action = url;
	document.fm.submit();
	
	if(str)
	{
		var set = str.split("&");
		for(i=0;i<set.length;i++)
		{
			var arr = set[i].split("=");
			eval("document.fm."+arr[0]).value = ""; 
		}
	}
}

//フォームアクション confirm
function form_act_confirm(url,str,confirm_str)
{
	if(confirm(confirm_str))
	{
		if(str)
		{
			var set = str.split("&");
			for(i=0;i<set.length;i++)
			{
				var arr = set[i].split("=");
				eval("document.fm."+arr[0]).value = arr[1]; 
			}
		}
	
		document.fm.action = url;
		document.fm.submit();
		
		if(str)
		{
			var set = str.split("&");
			for(i=0;i<set.length;i++)
			{
				var arr = set[i].split("=");
				eval("document.fm."+arr[0]).value = ""; 
			}
		}
	}
}

//ページング
function paging(url,sp)
{
	document.fm.action=url;
	document.fm.sp.value=sp;
	document.fm.submit();
	return;
}

//submitボタン(image)の2度押し防止
function enable_imgbtn(id,photo)
{
	//document.getElementById(id).src = "/images/"+photo;
	//alert(photo);
	document.getElementById(id).disabled = true; 
}

//input に onfocus で背景色や文字を消す
function input_focus(obj,str)
{
	obj.style.background = '#f1f1f1';
	obj.style.fontweight = 'bold';
	obj.style.color = '#000';
	if(obj.value == str)
	{
		obj.value ="";
	}
	return;
}

//input に onbulr で背景色や文字を追加する
function input_blur(obj,str)
{
	if(obj.value == '')
	{
		obj.value = str; 
		obj.style.background = '';
		obj.style.color = '#ccc';
	}
	return;
}

//auto_login処理
function auto_login()
{	
	//enable_idが空もしくは0の時
	if(document.fm.enable_id.value == 0 || document.fm.enable_id.value == "")
	{
		document.getElementById("enable_id").innerHTML  = '<a href="javascript:auto_login();">おとなID入力を自動にする</a>';
		document.fm.enable_id.value = 1;
		
		for(var i=1;i<=4;i++)
		{
			eval("document.fm.pin_code"+i).disabled= false;
			eval("document.fm.pin_code"+i).value= "";
		}
	}
	
	//enable_idが1の時
	else if(document.fm.enable_id.value==1)
	{
		document.getElementById("enable_id").innerHTML  = '<a href="javascript:auto_login();">おとなID入力を有効にする</a>';
		document.fm.enable_id.value = 0;
		
		for(var i=1;i<=4;i++)
		{
			eval("document.fm.pin_code"+i).disabled= true;
			eval("document.fm.pin_code"+i).value= "****";
		}
	}
}

//auto focus ジックID入力時に使用
function focus_next(obj,next)
{
	//FireFoxのバグでエラーになる
	//if(ua_check() != "Firefox")
	//{
		if (obj.value.length == 4)
		{
			nxobj = eval("document.fm."+next);
			if(nxobj != null)
			{
				eval("document.fm."+next).focus();
				return;
			}
			else if(document.getElementById(next))
			{
				document.getElementById(next).focus();
				return;
			}
		}	
	//}
}

//UA判別取得
function ua_check()
{
	if (typeof document.body.style.maxHeight != "undefined") { 
		// IE 7, mozilla, safari, opera 9 
		if(window.opera) return "Opera";
		if(window.createPopup) return "IE7";
		if(navigator.userAgent.indexOf("Safari") > -1) return "Safari";
		if(navigator.userAgent.indexOf("Firefox") > -1) return "Firefox";
	} else { 
		if(window.createPopup) return "IE6";
	} 
}

//window.open
function winOpen(chk_win,url,targetName)
{
	//top=0,left=0,width="+screen.availWidth+",height="+screen.availHeight
	win = window.open(url,targetName,'fullscreen=1 menubar=yes, toolbar=yes, location=yes, scrollbars=yes, resizable=yes');
	win.focus();
}

//子ウインドウの有無確認
function win_closed(win)
{
	if(win)
	{
		if(win.closed) return true;
		
		win.focus();
		return false;		
	}else{

		return true;
	}
}

//パスワード入力欄の履歴が残らないようにする。
function del_pwStr()
{
	document.fm.passwd.value = "";
}

