// 一時的に対応 110425
$(document).ready(
	function(){
		$(".communicationApplyformListFrameTd1 span").css("color","#EAF6F8");
	}
);

// Drop Down Menu 

function menuC(LID) {
	document.getElementById('dropdown').style.display="block";
	document.getElementById('dropdown1').style.display="none";
	document.getElementById('dropdown2').style.display="none";
	document.getElementById('dropdown3').style.display="none";
	document.getElementById('dropdown4').style.display="none";
	document.getElementById(LID).style.display="block";
}

function menuN() {
	document.getElementById('dropdown').style.display="none";
	document.getElementById('dropdown1').style.display="none";
	document.getElementById('dropdown2').style.display="none";
	document.getElementById('dropdown3').style.display="none";
	document.getElementById('dropdown4').style.display="none";
}



// Calendar List Tab

function calendarListC(LID) {
	document.getElementById('calendarList1').style.display="none";
	document.getElementById('calendarList2').style.display="none";
	document.getElementById(LID).style.display="block";
}



// For Flash

var isFlashInstalled=function(){if(navigator.plugins["Shockwave Flash"]){return true;}try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash");return true;}catch(a){return false;}}();



// オートリンク用プラグイン
jQuery.fn.autolink = function (target) {
    this.each( function(){
		          var re = /((http|https):\/\/[\w?=&.\/-;#~%-]+(?![\w\s?&.\/;#~%"=-]*>))/g;
		          $(this).html( $(this).html().replace(re, '<a href="$1">$1</a> ') );
	              });

    $("a", this).each(function(){
                          if(! $(this).attr("href").match(/http(s|):\/\/(|www)\.jnpc\.or\.jp\//)){
                              $(this).attr("target", "_blank");
                          }
                      });
    return true;
};

// トップページのyoutube を有効化する。
function youtubeEnabler(){
  if(isFlashInstalled){
      var videoID = $("#jnpcytplayer").attr("youtubeobjid");
      var params = { allowScriptAccess: "always", allowFullScreen: true, wmode: "transparent" };
      var atts = { id: "ytPlayer" };
      swfobject.embedSWF("http://www.youtube.com/v/" + videoID + "&enablejsapi=1&fs=1&playerapiid=player1",
                         "jnpcytplayer", "480", "295", "8", null, null, params, atts);
      $("#youtubeCurrentDescription").autolink();
  }
}


var ytPlayer = "";
function onYouTubePlayerReady(playerId) {
    ytPlayer = document.getElementById("ytPlayer");
    
    $(".topMovieThumbnail").click(function(){
                                      $(".topMovieThumbnail").css("border", "none");
                                      $(this).css("border", "solid #AAAAAA 1px");
                                      var ytid = $(".youtubeThumb", this).attr("youtubeobjid");
                                      ytPlayer.loadVideoById(ytid);
                                      var target = this;
                                      $("#youtubeCurrentDescription").slideUp(function(){
                                                                                  $(this).html($(".youtubeDescription",target).html());
                                                                                  $(this).autolink();
                                                                              }).slideDown();
                                  });
    
    
}


