<!--
/***
 * ログイン処理
 */
function doLogin(url) {
	 var f = document.forms["loginForm"];
	 f.url.value = url;
	 f.submit();
	 return;
}

/***
 MENU PROCEDURES
 */
var dummyImgs = new Object(); //<= プリロード画像格納用のダミーオブジェクト
var CONTEXT_PATH = ".";
var MENU_IMAGE_PATH = '/images/template/menu/';
$(function() {
	var menuImgPath = CONTEXT_PATH + MENU_IMAGE_PATH; //<=CONTEXT_PATHは呼び出し側で設定する
	// MAIN MENU
	var lIdx = 0;
	$('#mMenu div').each( function() {
		var baseName = menuImgPath + this.id;
		/* PRE LOAD IMAGES */
		dummyImgs[this.id + '_r'] = (new Image());
		dummyImgs[this.id + '_r'].src = baseName + '_r.gif';
		dummyImgs[this.id + '_t'] = (new Image());
		dummyImgs[this.id + '_t'].src = baseName + '_t.gif';

		if( this.id != MENU_ID ) {
			// SET MOUSEOVER
			$(this).mouseover(function() {
				this.style.backgroundImage="url('" + baseName + "_r.gif')";
			});

			// SET MOUSEOUT
			$(this).mouseout(function() {
				if( this.id != MENU_ID )
					this.style.backgroundImage="url('" + baseName + ".gif')";
			});
			this.style.cursor='pointer';
			$(this).click( function() { window.location.href=CONTEXT_PATH + "/viewer.jsp?key=" + this.id;} );
		} else {
			// SET CURRENT MENU INDICATOR
			$('#mMenu2').css('background-image',"url('" + baseName + "_t.gif')");
			$('#mMenu2').css('left',(454 + 80 * lIdx) + 'px');
		}
		lIdx++;
	});
	// BACKGROUND IMAGE
//	$('#mMainArea').css('background-image',"url('" + CONTEXT_PATH + "/images/template/bkg/" + MENU_ID + ".jpg')");

	/** SUB MENUS **/
	var selId = '#mSubMenu .' + MENU_ID + ' div';
	if( $(selId).length > 0 ) {
		var subMenuId = MENU_ID + "_" + SUB_MENU_ID;
		$('#mSubMenu .' + MENU_ID + ' div').each( function() {
			/* GET BASE FILE NAME */
			var baseName = CONTEXT_PATH + '/images/template/menu/' + this.id.replace(/_/,"/") ;

			/* PRE LOAD IMAGES */
			dummyImgs[this.id + '_r'] = new Image();
			dummyImgs[this.id + '_r' ].src = baseName + '_r.gif';
			dummyImgs[this.id + '_t'] = (new Image());
			dummyImgs[this.id + '_t'].src = baseName + '_t.gif';

			if( this.id != subMenuId ) {
				// SET IMAGE
				$(this).css("background-image","url('" +  baseName + ".gif')");

				// SET MOUSEOVER
				$(this).mouseover(function() {
					$(this).css("background-image","url('" + baseName + "_r.gif')");
				});

				// SET MOUSEOUT
				$(this).mouseout(function() {
					if( this.id != SUB_MENU_ID ){
						$(this).css("background-image","url('" + baseName + ".gif')");
					}
				});
				this.style.cursor='pointer';
//				$(this).click( function() { window.location.href=CONTEXT_PATH + "/viewer.jsp?key=" + MENU_ID + "&subKey=" + this.id;} );
			} else {
				this.style.backgroundImage = "url('" + baseName + "_t.gif')";
				if( MENU_ID == 'special' && this.id != "special_message") {
					var posX = $(this).css("left").replace("px","");
					$(this).css("left", posX - 22);
					$(this).css("width", $(this).width() + 22);
				}
			}
			$(this).css("display","block");
		});
		$('#mSubMenu .' + MENU_ID).css('visibility','visible');
		$('#mSubMenu').css('visibility','visible');
	} else { // SUB MENU がないとき
		$('#mRight').css('margin-top','0px');
		$('#mRight').height($('#mRight').height() + 38);
	}
});
/**
 * 入力日付の確認
 * @param szDate yyyyMMdd形式の日付文字列
 * @return 正常時:true/異常時:false
 */
function checkDate(szDate) {
	var re = /(\d\d\d\d)(\d\d)(\d\d)/;
	if( szDate.match(re) ) {
		var inYear = parseInt(RegExp.$1,"10");
		var inMonth = parseInt(RegExp.$2,"10");
		var inDate = parseInt(RegExp.$3,"10");

		if( inYear < 1900  || inYear > 2008 ) return false;

		if( inYear && inMonth && inDate ) {
			var date = new Date(inYear,inMonth-1,inDate);
			var nYear = date.getYear();
			var nMonth = date.getMonth() + 1;
			var nDate = date.getDate();
			var now = new Date();
			if( nYear < 2000) nYear += 1900;
			if( inYear != nYear
					|| inMonth != nMonth
					|| inDate != nDate ) 
				return false;
			return true;
		}
	} else {
		return false;
	}
}



//-->
