//==========================================================================
// マウスオーバー
//==========================================================================
$(function () {
	var lang = ( $( "html" ).attr( 'lang' ) == '' ) ? 'ja' : $( "html" ).attr( 'lang' ) ;
	var img_dir = 'img/' ;
	
	switch ( lang ) {
		case 'en' :
		    img_dir = 'img_en/';
		    break;
		case 'tl':
			img_dir = 'img_tl/' ;
			break ;
		case 'zh' :
			img_dir = 'img_zh/' ;
			break ;
	}
	
    var is_with_kana = false;
    var location_this = location.href;
    var location_kana = "http://trans.hiragana.jp/ruby/";
    var length_kana = location_kana.length;
    if (location_this.search(/hiragana.jp/) != -1) {
        // ふりがながついているかの判定とON・OFF画像の切り替え
        // locatin_thisの整形（常にhttp://develop.s58.coreserver.jp/で始まるようにする）
        is_with_kana = true;
        $("body").removeClass("kana02").addClass("kana01");
        location_this = location_this.slice(length_kana);
    }
    var location_with_kana = "http://trans.hiragana.jp/ruby/" + location_this;
    // ふりがな
    //==========================================================================
    /*▼on▼*/
    $(".kana_over01").mouseover(function () {
        $(this).attr("src", img_dir + "he_kana_on_over.gif");
    }).mouseout(function () {
        $(this).attr("src", img_dir + "he_kana_on.gif");
    }).click(function () {
        if (!is_with_kana) {
            $("body").removeClass("kana02").addClass("kana01");
            location.assign(location_with_kana);
        }
        return false;
    });
    /*▼off▼*/
    $(".kana_over02").mouseover(function () {
        $(this).attr("src", img_dir + "he_kana_off_over.gif");
    }).mouseout(function () {
        $(this).attr("src", img_dir + "he_kana_off.gif");
    }).click(function () {
        $("body").removeClass("kana01").addClass("kana02");
        location.assign(location_this);
        return false;
    });
    // 言語
    //==========================================================================
    /*▼日本語▼*/
    $(".language_over01").mouseover(function () {
        $(this).attr("src", "img/he_language_japanese_over.gif");
    }).mouseout(function () {
        $(this).attr("src", "img/he_language_japanese.gif");
    });
    /*▼英語▼*/
    $(".language_over02").mouseover(function () {
        $(this).attr("src", "img/he_language_english_over.gif");
    }).mouseout(function () {
        $(this).attr("src", "img/he_language_english.gif");
    });
    /*▼中国語▼*/
    $(".language_over03").mouseover(function () {
        $(this).attr("src", "img/he_language_chinese_over.gif");
    }).mouseout(function () {
        $(this).attr("src", "img/he_language_chinese.gif");
    });
    /*▼タガログ語▼*/
    $(".language_over04").mouseover(function () {
        $(this).attr("src", "img/he_language_tagalog_over.gif");
    }).mouseout(function () {
        $(this).attr("src", "img/he_language_tagalog.gif");
    });
    // メニュー
    //==========================================================================
    /*▼HOME▼*/
    $(".menu_over01").mouseover(function () {
        $(this).attr("src", img_dir + "he_menu_home_over.gif");
    }).mouseout(function () {
        $(this).attr("src", img_dir + "he_menu_home.gif");
    });
    /*▼お問い合わせ▼*/
    $(".menu_over02").mouseover(function () {
        $(this).attr("src", img_dir + "he_menu_contact_over.gif");
    }).mouseout(function () {
        $(this).attr("src", img_dir + "he_menu_contact.gif");
    });
    /*▼サイトマップ▼*/
    $(".menu_over03").mouseover(function () {
        $(this).attr("src", img_dir + "he_menu_site_map_over.gif");
    }).mouseout(function () {
        $(this).attr("src", img_dir + "he_menu_site_map.gif");
    });
    /*▼組織概要▼*/
    $(".menu_over04").mouseover(function () {
        $(this).attr("src", img_dir + "he_menu_access_map_over.gif");
    }).mouseout(function () {
        $(this).attr("src", img_dir + "he_menu_access_map.gif");
    });
    // サイト内検索
    //==========================================================================
    /*▼検索▼*/
    $(".search_over01").mouseover(function () {
        $(this).attr("src", img_dir + "he_search_btn_over.gif");
    }).mouseout(function () {
        $(this).attr("src", img_dir + "he_search_btn.gif");
    });
    // コンテンツメニュー
    //==========================================================================
    /*▼詳細ページへ▼*/
    $(".btn_l, .btn_r, .btn_l_en, .btn_l_zh,").mouseover(function () {
        $(this).attr("src", img_dir + "co_menu_btn_over.gif");
    }).mouseout(function () {
        $(this).attr("src", img_dir + "co_menu_btn.gif");
    });
	/*▼お知らせ情報一覧▼*/
    $(".new_btn, .new_btn_en, .new_btn_zh,").mouseover(function () {
        $(this).attr("src", img_dir + "co_see_more_btn_over.gif");
    }).mouseout(function () {
        $(this).attr("src", img_dir + "co_see_more_btn.gif");
    });
	/*▼イベントカレンダー▼*/
    $(".events01_btn, .events01_btn_en, .events01_btn_zh,").mouseover(function () {
        $(this).attr("src", img_dir + "co_events01_btn_over.gif");
    }).mouseout(function () {
        $(this).attr("src", img_dir + "co_events01_btn.gif");
    });
	/*▼国際交流財団一覧▼*/
    $(".events02_btn, .events02_btn_en, .events02_btn_zh,").mouseover(function () {
        $(this).attr("src", img_dir + "co_events02_btn_over.gif");
    }).mouseout(function () {
        $(this).attr("src", img_dir + "co_events02_btn.gif");
    });
    // サイドバー
    //==========================================================================
    /*▼ブログ画像▼*/
    var length_img = 4;
    var array_img = new Array(
    	img_dir + "si_bnr_blog01_a.jpg",
    	img_dir + "si_bnr_blog01_b.jpg",
		img_dir + "si_bnr_blog01_c.jpg",
    	img_dir + "si_bnr_blog01_d.jpg"
    );
    var rand = Math.floor(Math.random() * length_img);
    $(".blog_box img", $("#sideber")).attr("src", array_img[rand]);

    /*▼制度のご案内.PDF▼*/
    $(".banner_over01").mouseover(function () {
        $(this).attr("src", img_dir + "si_btn_seido_over.jpg");
    }).mouseout(function () {
        $(this).attr("src", img_dir + "si_btn_seido.jpg");
    });
    /*▼派遣依頼書.PDF▼*/
    $(".banner_over02").mouseover(function () {
        $(this).attr("src", img_dir + "si_btn_haken_over.jpg");
    }).mouseout(function () {
        $(this).attr("src", img_dir + "si_btn_haken.jpg");
    });
    /*▼業務・財務状況▼*/
    $(".banner_over03").mouseover(function () {
        $(this).attr("src", img_dir + "si_bnr_sosiki_over.gif");
    }).mouseout(function () {
        $(this).attr("src", img_dir + "si_bnr_sosiki.gif");
    });
    // フッター
    //==========================================================================
    /*▼マップボタン▼*/
    $(".map_over").mouseover(function () {
        $(this).attr("src", "img/fo_btn_map_over.gif");
    }).mouseout(function () {
        $(this).attr("src", "img/fo_btn_map.gif");
    });
    //==========================================================================
    //アンカー
    //==========================================================================
    $( "[href^='#']" ).each( function() {
        $( this ).attr( 'href', location.pathname + location.search + $( this ).attr( 'href' ) ) ;
    } ) ;
    
    if ( ss != undefined ) ss.fixAllLinks();
});
//==========================================================================
// 透明効果
//==========================================================================
$(document).ready(function () {
    $(".toumei").hover(function () {
        $(this).fadeTo(0, 0.8);
    }, function () {
        $(this).fadeTo(200, 1.0);
    });
});
//==========================================================================
// リンク領域拡大
//==========================================================================
$(function () {
    $('.link_up').biggerlink();
});


//==========================================================================
// colorbox
//==========================================================================

//Examples of how to assign the ColorBox event to elements
			$(document).ready(function(){
				$("a[rel='example1']").colorbox();
				$("a[rel='example2']").colorbox({transition:"fade"});
				$("a[rel='example3']").colorbox({transition:"none", width:"75%", height:"75%"});
				$("a[rel='example4']").colorbox({slideshow:true});
				$(".example5").colorbox();
				$(".example6").colorbox({iframe:true, innerWidth:425, innerHeight:344});
				$(".example7").colorbox({width:"80%", height:"80%", iframe:true});
				$(".example8").colorbox({width:"50%", inline:true, href:"#inline_example1"});
				$(".example9").colorbox({
					onOpen:function(){ alert('onOpen: colorbox is about to open'); },
					onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
					onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
					onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
					onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
				});
				
				//Example of preserving a JavaScript event for inline calls.
				$("#click").click(function(){ 
					$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
					return false;
				});
			});

$(function(){
	var vars = [], hash;
	var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
	for(var i = 0; i < hashes.length; i++) {
		hash = hashes[i].split('=');
		vars.push(hash[0]);
		vars[hash[0]] = hash[1];
	}

	if( vars['id'] == "441" || vars['preview'] == "441" || vars['id'] == "442" || vars['preview'] == "442"){
		$("#updated").hide();
		$("#blog_archive").hide();
	}
});

