addListener( window, "load", function(){
	
	addListener( $("admin"), "click",
		function(){
			showResult( "　" );
			toggle( "calendar-admin" );
		}
	);
	
	addListener( $( "calendar-submit" ), "click",
		function(){
			showResult( "　" );
			ajaxPost( "20_calendar_admin.php", 
				{
					arg: "pwd="+$( "pwd" ).value,
					callback: function( arg ){
						if( arg == "ng" ){
							showResult( "passwordが違います" );
						} else {
							$( "calendar-admin" ).innerHTML = arg;
						}
					}
				});
		}
	);
	
	//テキスト読み込み
	ajaxLoad( "calendar-pdf", "./f/20_calendar.txt" );

	//キャッシュ回避
	//カレンダーpdfのダウンロードリンク
	var link = $( "calendar-pdf" );
	link.href = link.href.replace( /.[0-9]+/, "" );
	link.href = link.href + "?" + new Date().getTime(); 
	
});

function showResult( str ){
	$( "calendar-result" ).innerHTML = str;
}

function mes(){
	showResult( "送信中...<img src='imgs/common_load.gif' width='16' height='16' />" );
	$( "calendar-send-form" ).submit();
}

function changeLink( str ){
	var link = $( "calendar-pdf" );
	if( str != "" ){
		link.innerHTML = str;
	}
	//キャッシュ回避
	link.href = link.href.replace( /.[0-9]+/, "" );
	link.href = link.href + "?" + new Date().getTime(); 
}

