$(function(){

	// pdf等のリンクにiconを付与
	$('a').each(
		function(){
			if( $(this).attr('href') ) {
				//データアイコン
				if( $(this).attr('href').match( /\.(pdf|ppt|doc|docx|xls|xlsx)$/ ) )
 {
					$(this).append( '<img src="/view/images/icons/'+RegExp.
$1
	+'.gif" alt="'+RegExp.$1 +'形式" title="'+RegExp.$1 +'形式" class="iconsimg" />' )
 ;
				}
			}
		}
	) ;

	// 日付から受付中か終了かを動的に判定する
	$('table.dynamicdate td').each(function(){
		if( $(this).html().match(/^\d{4}/) ) {
			var now = new Date() ;
			var ymd = $(this).html() ;
			var thedate = new Date( ymd ) ;
			$(this).html( DateFormatter.format( thedate , 'Y年n月j日(J)' ) ) ;
			if( now > thedate ) {
				$(this).css('background-color','#cccccc');
				$(this).next().html('終了').css('background-color','#cccccc');
			} else {
				$(this).css('background-color','#ffffcc');
				$(this).next().html('終了').css('background-color','#ffffcc');
				var type_text = $(this).parent().parent().parent().find('thead th').html() ;
				$(this).next().html( '受付中 &nbsp; <a href="/general/inquiry-fureaisalon.html?date=' + ymd + '&amp;type=' + encodeURI(type_text) + '" title="申込みフォームに入力する">申込み</a>' ) ;
			}
		}
	});

	// 研修会の申込みリンクをurlencode()する
	$('table.workshop td a').each(function(){
		$(this).attr('href', encodeURI($(this).attr('href')) );
	}) ;



});

