/* Flash Tags
==================================================================================================== */
/* Flash Plugin Check
---------------------------------------------------------------------------------------------------- */
var MM_contentVersion = 8;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if (plugin) {
  var words = navigator.plugins["Shockwave Flash"].description.split(" ");
  for (var i = 0; i < words.length; ++i) {
    if (isNaN(parseInt(words[i]))) continue;
    var MM_PluginVersion = words[i];
  }
  var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
} else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) {
  document.write('<scr' + 'ipt language="VBScript"\> \n');	//FS hide this from IE4.5 Mac by splitting the tag
  document.write('on error resume next \n');
  document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
  document.write('</scr' + 'ipt\> \n');
}

/* Write Flash Tags
---------------------------------------------------------------------------------------------------- */
function flashTagsTop() {
  var flashFileName = "common/swf/index"
  if (MM_FlashCanPlay) {
    //document.write('<p>');
    AC_FL_RunContent('codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width','890','height','365','src',flashFileName,'quality','high','pluginspage','http://www.adobe.com/go/getflashplayer','imageTop',flashFileName,'wmode','transparent' ); //end AC code
    //document.write('</p>');
  } else {
    document.write('<p><img src="'+flashFileName+'.jpg" alt="" width="890" height="365" /></p>');
    document.write('<blockquote class="fontSmall">');
    document.write('<p class="fontCaution"><strong>x</strong> Flashムービーが再生できません！</p>');
    document.write('<p>Flashムービーをご覧になるためには、最新のAdobe Flash Playerのダウンロードが必要となります。</p>');
    document.write('<ul><li><a href="http://www.adobe.com/go/getflashplayer" target="_blank">Adobe Flash Playerのダウンロード</a></li></ul>');
    document.write('</blockquote>');
  }
}
  
// 文字サイズ切り替え　Cookie使用
/*$(function(){
	$("#contents").css("font-size",$.cookie('fsize'));
});
function font(size){
	$("#contents").css("font-size",size);
	$.cookie("fsize",size,{expires:30,path:'/'});
}*/

// カルーセル(jCarousel)
/*$(function(){
	$(".carousel").carousel({ 
		dispItems: 4,
		loop: true,
		autoSlide: true, 
		autoSlideInterval: 10000
	});
});*/



/* ナビゲーション */
$(function () {
	if ($.browser.msie && $.browser.version < 7) return; 
		$('#navigation li')
		.removeClass('highlight')
		.find('a')
		.append('<span class="hover" />').each(function () {
			var $span = $('> span.hover', this).css('opacity', 0);
			$(this).hover(function () {
				$span.stop().fadeTo(500, 1);// on hover
			}, function () {
				$span.stop().fadeTo(500, 0);// off hover
			});
	});
	
	$("select.jcalendar-select-day").attr("disabled","disabled");
	/*$("select.jcalendar-select-month").change(function(){
		$("select.jcalendar-select-day").removeAttr("disabled");
	});*/
	$('form#aform-form-2').submit(function (){
		$("select.jcalendar-select-day").removeAttr("disabled");
	});
	
	//alert(ny);
	
	var n = new Date();
	var ny = n.getYear();
	if (ny < 2000) { ny += 1900; };
	var nyn = ny+1;
	var nm = n.getMonth() +1;
	//var nm = 12;
	var nmn = nm+1;
	$("select.jcalendar-select-year").append($("<option>"+ny+"</option>"));//.attr({value:ny}));
	$("select.jcalendar-select-year").width();
	$("select.jcalendar-select-month").append($("<option>"+nm+"</option>"));//.attr({value:nm}));
	$("select.jcalendar-select-month").width();
	if(nm==12){
		$("select.jcalendar-select-year").append($("<option>"+nyn+"</option>"));//.attr({value:nyn}));
		$("select.jcalendar-select-year").width();
		$("select.jcalendar-select-month").append($("<option>"+1+"</option>"));//.attr({value:1}));
		$("select.jcalendar-select-month").width();
	} else {
		$("select.jcalendar-select-month").append($("<option>"+nmn+"</option>"));//.attr({value:nmn}));
		$("select.jcalendar-select-month").width();
	}
	$("tr#time select").focus(function (){
		$("div.jcalendar").slideDown('fast');
	});
	$("span#calendar_btn").click(function (){
		$("div.jcalendar").slideToggle('fast');
	});
	
	// blog rss読み込ませ （途中）
	/*
	$.ajax({
		dataType:';xml',
		type:'GET',
		url:'http://itoyasu.co.jp/blog/index.php?mode=rss',
		success: function(html){
    	$alert(html);
    }
  }

	});
	
	$('h4#blog_post a').val();
	$('h4#blog_post a').attr({href: });
	$('div#blog_info p').val();
	$('div#blog_info p#date').val();
	*/
	
});




function setDay(obj){
	obj = obj.form;
	var years = parseInt(obj.years.options[obj.years.selectedIndex].value);
	var months = parseInt(obj.months.options[obj.months.selectedIndex].value);
	var lastday = monthday(years,months);
	var itemnum = obj.days.length;
	if (lastday - 1 < obj.days.selectedIndex) {
		obj.days.selectedIndex = lastday - 1;
	}
	obj.days.length = lastday;
	for (cnt = itemnum + 1;cnt <= lastday;cnt++) {
		obj.days.options[cnt - 1].text = cnt;
	}
}
function monthday(years,months){
	var lastday = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
	if (((years % 4 == 0) && (years % 100 != 0)) || (years % 400 == 0)){
		lastday[1] = 29;
	}
	return lastday[months - 1];
}



