﻿NORMAL_COLOR = "#ffffff";
FOCUS_COLOR  = "#ffee99";

	///////////////////////////////////////////////////////////////////////////
	// 確認プロンプトを表示する
	///////////////////////////////////////////////////////////////////////////
	function dispConfirm()
	{
		if ( confirm('写真の投稿をお忘れではありませんか？\n投稿する場合は「キャンセル」でお戻りください。\n\nこのまま登録してよろしいですか？') )
		{
			return true;
		}

		return false;
	}

	///////////////////////////////////////////////////////////////////////////
	// 背景カラーを変更する
	///////////////////////////////////////////////////////////////////////////
	function focusColor( obj )
	{
		obj.style.backgroundColor = FOCUS_COLOR;
	}

	function orgColor( obj )
	{
		obj.style.backgroundColor = NORMAL_COLOR;
	}

	///////////////////////////////////////////////////////////////////////////
	// 全角文字列を半角に変換する
	///////////////////////////////////////////////////////////////////////////
	function toHankaku( chkstr )
	{
	  	var ZenByte = "あ".length;
		var zenkaku = "０１２３４５６７８９．＠！－＿／＃＄％＆？＝～ＡＢＣＤＥＦＧＨＩＪＫＬＭＮＯＰＱＲＳＴＵＶＷＸＹＺａｂｃｄｅｆｇｈｉｊｋｌｍｎｏｐｑｒｓｔｕｖｗｘｙｚ";
		var hankaku = "0123456789.@!-_/#$%&?=~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

		for ( cnt = 0 ; cnt <= hankaku.length - 1 ; cnt++ )
		{
			chktarget = zenkaku.substring( cnt*ZenByte, cnt*ZenByte+ZenByte );

			while ( chkstr.indexOf( chktarget ) >= 0 )
			{
				chkstr = chkstr.substring( 0, chkstr.indexOf( chktarget ) )
					+ hankaku.charAt( cnt )
					+ chkstr.substring( chkstr.indexOf( chktarget )
						+ ZenByte,chkstr.length );
			}
		}

		return chkstr;
	}

	function trr( target )
	{
		target.value = toHankaku( target.value );
		target.style.backgroundColor = '#ffffff';
	}

	function tr( target )
	{
		target.value = toHankaku( target.value );
	}


