MJL.event.add(window, "load", function() {
    // MJL に関係するコードはこの中に記述	
   // MJL.enable.flash("flash");
    MJL.enable.window("popup");
    MJL.enable.window("popup-560", {width: 540, height:700,
		menubar:  "no", // メニューバーを非表示
		toolbar:  "no", // ツールバーを非表示
		location: "no", // ロケーションバー（アドレスバー）を非表示
		status:   "no"  // ステータスバーを非表示});
	});
    MJL.enable.tab("tabs");
   // MJL.enable.styleSwitcher("styleSwitcher");
    MJL.enable.heightEqualizer("equalize");
    MJL.enable.rollover("roll", {disable: "unroll"});
});

// MJL と無関係なコードはこの先に記述

$(function(){
	var $main = $('#content');
	var $nav = $('#nav');

    (function(){
		if(!jQuery.support.opacity){
			if(!jQuery.support.style){
				if (typeof document.documentElement.style.maxHeight != "undefined" && window.location.pathname == '/services/actpromo.html') {
					$("#anchor03").before('<div style="page-break-before:always;font-size:1;margin:0;border:0;"><span style="visibility: hidden;">-</span></div>');
				}
			}
		}
	})();

// global navigation
	if(location.pathname != "/") {  
		var now = location.href.split('/');  
		var endDir = now.slice(now.length-2,now.length-1); 
		var av = $('ul#nav-global li a[href$="'+endDir+'/"]').closest('li').addClass('unroll').find("a img");
		if(av.attr('src')){
			var ac = av.attr('src').replace('.gif', '_a.gif');
			$('ul#nav-global li.unroll a img').attr('src', ac);
		}
		if(endDir == 'services'){
			$main.addClass('services');
		}
		if(endDir == 'casestudy'){
			$main.addClass('casestudy');
		}
		if(endDir == 'corporate'){
			$main.addClass('corporate');
		}
		if(endDir == 'advantage'){
			$main.addClass('advantage');
		}
		if(endDir == 'recruit_mid'){
			$main.addClass('recruit_mid');
		}	
		if(endDir == 'sitemap'){
			$main.addClass('sitemap');
		}
		
	}

    (function() {
       if ($("#nav .nav-local-01") != undefined) {
            var condIndex = /\/index\.html?/;
            var path = location.pathname.replace(condIndex, '/');
            var checks = [path];
            // 文字列末尾から 1 ディレクトリずつ削り、URL を収集
            while (path && '/' !== path) {
                path = path.replace(/[^/]*\/?$/, '');
                checks.push(path);
            }
            // メニューの href 属性値をすべて取得
			var hrefs = $('a', $nav).map(function(){
				return $(this).attr('href').replace(condIndex, '/');
			});
            // URL と href 属性値の一致を判定
            checkStart : for (var i = 0; i<checks.length; i++) {
                for (var j = 0; j<hrefs.length; j++) {
                    if (checks[i] == hrefs[j]) {
                        $('#nav .nav-local-01 a').eq(j)  
							.closest('li').addClass("current");
                        break checkStart;
                    }
                }
            }
        }
    })();

	
		
//フォームセレクト切り替え

	$("#formDivision").change(function(){
		var index = this.selectedIndex;
		if(index == 3){
			$(".cate").css("display", "none");
		}else {
			$(".cate").css("display", "");
		}
	});
	
	var fromin = $('#formDivision').val();
	if(fromin == "採用情報について"){
		$(".cate").css("display", "none");		
	}
									 

 // リンク先種別ごとにアイコンを付与
    $('a:not(:has(img))', $main).each(function(){
        var obj = $(this);
        if (obj.attr('href').match(/\.pdf/)) {
            // PDF ファイルへのリンクは PDF アイコンを付与
            obj.append('<img src="/shared/images/link_icon_03.gif" class="blank" alt="PDFファイルを新しいウィンドウで開きます" />');
        } else if (obj.attr('target') == '_blank') {
            // 新しいウィンドウで開くリンクはブランクアイコンを付与
            obj.append('<img src="/shared/images/link_icon_02.gif" width="13" height="11" class="blank" alt="新しいウィンドウで開きます" />');
        }
    });
	
});


(function(a){a.fn.set_flash=function(b){var c={version:6,movie:"",name:"",title:"",height:0,width:0,no_version:"no version",no_flash:"no flash"};if(b){jQuery.extend(c,b)}return this.each(function(f){_flash_version=function(){if(navigator.plugins&&navigator.plugins.length){if(!navigator.plugins["Shockwave Flash"]){return false}if(navigator.plugins["Shockwave Flash"].description){navigator.plugins["Shockwave Flash"].description.match(/(\d+)\.\d/);return parseInt(RegExp.$1)}}else{for(var i=15;i>=0;i--){try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);return i}catch(k){}}return false}return false};var d={};if(c.height&&c.width&&c.movie!=""){d=c}else{var e=this.className.match(/[a-z]+\[[^\]]+\]/g);for(f=0;f<e.length;f++){e[f].match(/([a-z]+)\[([^\]]+)\]/);d[RegExp.$1]=RegExp.$2}}var h="";var g="";if(d.wmode){h+=' wmode="'+d.wmode+'"';g+='<param name="wmode" value="'+d.wmode+'">'}if(!_flash_version()){a(this).html(c.no_flash);return}if(_flash_version()<(d.version||c.version)){a(this).html(c.no_version);return}a("> *",this).hide();a(this).html('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" height="'+d.height+'" width="'+d.width+'" name="'+d.name+'" title="'+d.title+'"><param name="movie" value="'+d.movie+'"><param name="name" value="'+d.name+'"><param name="quality" value="high">'+g+'<embed src="'+d.movie+'" quality="high" type="application/x-shockwave-flash" height="'+d.height+'" width="'+d.width+'"'+h+"></object>")})}})(jQuery);
