/*
 * Plugins
 */
//  set_png_support
jQuery.set_png_support=function(B){var C={spacer_path:"/asp-bm/images/spacer.gif"};if(B){jQuery.extend(C,B)}navigator.userAgent.match(/msie\s*(\d)/i);var A=RegExp.$1;if((A<=6&&A>5)&&$.browser.msie){$("img[@src$=png]").each(function(){$(this).css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this.src+"', sizingMethod='scale')"}).attr({src:C.spacer_path,width:this.width,height:this.height})})}};
//  set_rollovers
(function(A){jQuery.fn.set_rollovers=function(C){var D={extension:"_o",active_hover:true,hover_extension:"_h",active_extension:false,fade:false,menu:{},menu_type:"files"};if(C){jQuery.extend(D,C)}if(!D.active_extension){D.active_extension=D.hover_extension}var F=String(document.location);var E=false;var B=0;A.each(D.menu,function(G){if(D.menu_type=="files"){if(G.match(/|/)){menu_path_arr=G.split("|");for(k=0;k<menu_path_arr.length;k++){if(F.match(menu_path_arr[k])&&menu_path_arr[k].length>B){E=D.menu[menu_path_arr[k]];B=menu_path_arr[k].length}}}else{if(F.match(G)&&G.length>B){E=D.menu[G];B=G.length}}}else{if(D.menu_type=="nodes"){if(A(G).length){E=D.menu[G]}}}});return this.filter("[@src*="+D.extension+".]").each(function(){var H=new Image;H.src=this.src.replace(D.extension+".",D.hover_extension+".");if(this.src.match(/[^\/]+$/)[0]==E){this.src=this.src.replace(new RegExp(D.extension+"(.[a-z]+)$"),D.active_extension+"$1");if(D.active_hover){A(this).hover(function(){this.src=this.src.replace(new RegExp(D.active_extension+"(.[a-z]+)$"),D.hover_extension+"$1")},function(){this.src=this.src.replace(new RegExp(D.hover_extension+"(.[a-z]+)$"),D.active_extension+"$1")})}}else{if(!D.fade){A(this).hover(function(){this.src=this.src.replace(new RegExp(D.extension+"(.[a-z]+)$"),D.hover_extension+"$1")},function(){this.src=this.src.replace(new RegExp(D.hover_extension+"(.[a-z]+)$"),D.extension+"$1")})}else{var G=A(this).wrap('<span style="position:relative; display:block;"></span>').parent();G.append('<img src="../../../../shared/js/'+H.src+'" style="position:absolute; top:0; left:0;" />');G.find("> :last-child").hide();G.hover(function(){A("> img:last-child",this).fadeIn(D.fade)},function(){A("> img:last-child",this).fadeOut(D.fade)})}if(this.parentNode.nodeName.match(/^a$/i)){A(this).parent().focus(function(){A(">img",this).trigger("mouseover")}).blur(function(){A(">img",this).trigger("mouseout")})}else{if(this.parentNode.nodeName.match(/span/i)&&this.parentNode.parentNode.nodeName.match(/a/i)){A(this).parents("a").focus(function(){A("> span > img:last-child",this).fadeIn(D.fade)}).blur(function(){A("> span > :last-child",this).fadeOut(D.fade)})}}}})}})(jQuery);
//  set_links
(function(A){A.set_links=function(B){A("a[@rel=popup],a[@rel=external],area[@rel=popup],area[@rel=external]").click(function(){if(this.rel=="external"){window.open(this.href,"_blank");return false}var I="";var D=0;var C="";for(i in B){if(i.match(">>")){data=i.split(">>");if(String(window.location).match(data[0])&&this.href.match(data[1])){C=i;break}}if(i.match(/^\.(.*)/)){var E=new RegExp("\\b"+RegExp.$1+"\\b");if(this.className.match(E)){for(param in B[i]){if(param=="name"){continue}I+=param+"="+B[i][param]+","}if(this.href.match(/width=(\d+).*height=(\d+)/)){var F=RegExp.$1;var H=RegExp.$2;if(I.match("width")&&I.match("height")){I=I.replace(/width=\d+/,"width="+F);I=I.replace(/height=\d+/,"height="+H)}else{I+="width="+F+",height="+H}}var G=B[i]["name"]?B[i]["name"]:"popup";window.open(this.href,G,I.split(/,$/)[0]).focus();this.blur();return false}}else{if(this.href.match(i)&&i.length>D){C=i;D=i.length}}}for(param in B[C]){if(param=="name"){continue}I+=param+"="+B[C][param]+","}var G=B[C]["name"]?B[C]["name"]:"popup";window.open(this.href,G,I.split(/,$/)[0]).focus();this.blur();return false});return this}})(jQuery);
//  set_height
(function(A){A.fn.set_height=function(P){var G={items_per_row:false,one_height:false,delay:1000,group_by_parent:false};if(P){jQuery.extend(G,P)}if(A("#js_etalon").length){var N=A("#js_etalon").get(0)}else{var N=A("body").append('<span style="position:absolute;left:-9999px;top:0;" id="js_etalon">?</span>').find("#js_etalon").get(0)}var E=function(S,R){for(var Q=0;Q<S.length;Q++){if(S[Q]==R){return }}S.push(R)};var B=this;var F=[];var L=[];var K=[];var J=function(){for(var S=0;S<F.length;S++){var R=0;var T=F[S][0].currentStyle?parseInt(F[S][0].currentStyle.paddingTop)+parseInt(F[S][0].currentStyle.paddingBottom):parseInt(document.defaultView.getComputedStyle(F[S][0],null).getPropertyValue("padding-top"))+parseInt(document.defaultView.getComputedStyle(F[S][0],null).getPropertyValue("padding-bottom"));for(var Q=0;Q<F[S].length;Q++){F[S][Q].style.height="auto";R=Math.max(F[S][Q].offsetHeight-T,R)}for(var Q=0;Q<F[S].length;Q++){F[S][Q].style.height=R+"px"}}};var M=function(){var Y=0;var W=0;var Q=null;var T=null;F[Y]=[];var Z=false;for(var U=0;U<B.length;U++){if(G.group_by_parent){Q=A(B[U]).parents(G.group_by_parent)[0];if(U>0&&Q!=T&&!Z){F[++Y]=[];W=0}T=Q}if(G.items_per_row){B[U].className+=" nb"+parseInt(W%G.items_per_row+1);if(!(W%G.items_per_row)&&W>0){F[++Y]=[];W=0;Z=true}}F[Y][W++]=B[U];Z=false}for(var U=0;U<F.length;U++){if(!F[U][0].offsetHeight){var X=F[U][0];while(X.style.display!="none"){X=X.parentNode}L.push(X)}for(var S=0;S<F[U].length;S++){var V=F[U][S].getElementsByTagName("img");for(var R=0;R<V.length;R++){E(K,V[R].src)}}}};if(B.length){M();var D=N.offsetHeight;var C=setInterval(function(){var S=N.offsetHeight;if(S!=D){D=S;J()}for(var R=0;R<L.length;R++){if(L[R].style.display!="none"){J();L=[];for(var Q=0;Q<F.length;Q++){if(!F[Q][0].offsetHeight){var T=F[Q][0];while(T.style.display!="none"){T=T.parentNode}L.push(T)}}}}},G.delay);J();if(K.length){var H=[];var O=0;for(var I=0;I<K.length;I++){H[I]=document.createElement("img");H[I].onload=function(){O++;if(O==K.length){J()}};H[I].src=K[I]}}}if(navigator.userAgent.match("MSIE 5.5")&&B.length){setTimeout(function(){main(B),0})}return this}})(jQuery);


$(function(){
    $("a img, input[type='image']").set_rollovers({ menu: { "/asp-bm/bistromate/": "gnv_bistromate_c.gif", "/asp-bm/advantage/": "gnv_advantage_c.gif", "/asp-bm/function/": "gnv_function_c.gif", "/asp-bm/operation/": "gnv_operation_c.gif", "/asp-bm/interview/": "gnv_interview_c.gif", "/asp-bm/faq/": "gnv_faq_c.gif" } });
    $('a[@rel="external"]:not(a[@href$=".pdf"])').each(function(){
        if(!$("img", this).length && !$(this).parents("#copyright").length){
            $(this).addClass('window').append('<img src="/asp-bm/image/40BM/shared/icon/icon_window.gif" alt="別ウインドウで開きます" /> ');
        }
    });
    $('a[@rel="external"]').click(function(){
        window.open(this.href,'_blank');
        return false;
    });
    $("a[@rel='popup']").click(function(){
        window.open(this.href, 'popup', 'width=630, height=600, scrollbars=yes');
        return false;
    });
    $("dd > ul > li", "#local-nav").hover(function(){
        $(this).addClass("hover");
    },function(){
        $(this).removeClass("hover");
    });
	$('a[@href^="/asp-bm"]'+'a[@href$=".pdf"]').addClass('pdf').append('<img src="/asp-bm/image/40BM/shared/icon/icon_pdf.gif" alt="PDFファイルをダウンロードします。" />');

    $("div.global-nav li", "#header").hover(function(){
        $(this).addClass("hover");
    },function(){
        $(this).removeClass("hover");
    });

    $("dt", "#local-nav").hover(function(){
        $(this).addClass("hover");
    },function(){
        $(this).removeClass("hover");
    });
    $(".btn span", "#main-content").hover(function(){
        $(this).addClass("hover");
    }, function(){
        $(this).removeClass("hover");
    });
    document.body.onbeforeprint = function(){
        $("img", "#ci-02").attr("src", "/asp-bm/image/40BM/shared/header/logo_bistromate.jpg");
    }
    document.body.onafterprint = function(){
        $("img", "#ci-02").attr("src", "/asp-bm/image/40BM/shared/header/logo_bistromate.png");
        $.set_png_support({ spacer_path: "/asp-bm/image/40BM/shared/spacer.gif" });
    }
});

var init = function(){
    $.set_png_support({ spacer_path: "http://www.bistromate.com/asp-bm/image/40BM/shared/spacer.gif" });
    $("#local-nav > dd > ul ul").hide();
    var _loc = location.pathname.replace("index.html", "");
    $("a", "#local-nav").each(function(){
        var _href = $(this).attr("href").replace("index.html", "");
        if(_loc == _href){
            $(this).parent("li").addClass("current selected");
        }
    });
    $(".current", "#local-nav").parents("li").addClass("current");
    $(".current > ul", "#local-nav").show();
    var heightAdjust = function(){
        $("ul.double,div.double").each(function(){
            $("> li,> .block",this).set_height({ items_per_row: 2, delay: 2000 });
        })
//        $("ul.double > li, div.double > .block").set_height({ items_per_row: 2, delay: 2000 });
        $("ul.triple > li, div.triple > .block > .inner, div.triple > .block,").set_height({ items_per_row: 3, delay: 2000 });
        $("div.double-intro > .block > .layout-01").set_height({ items_per_row: 2, delay: 2000 });
        $("div.box-contact > div").set_height({ items_per_row: 2, delay: 2000 });
    }
    $("input.text", "#search").click(function(){
        $(this).val("");
    });
    var adjust = function(){
        $(".layout", "#main-content").each(function(){
            _c = $(this).attr("class");
            var _w1 = $(this).width();
            var _w2 = $('> .image img', this).width();
            $(this).width(_w1);
            $(".image", this).width(_w2);
            if(!_c.match("turn")){
                if(_c.match("right")){
                    $("> .content", this).css("margin-right", _w2 + 15);
                } else {
                    $("> .content", this).css("margin-left", _w2 + 15);
                }
            }
        });
    }

    if($.browser.safari){
        setTimeout(function(){
            adjust();
            heightAdjust();
        }, 100);
        $("div.global-nav", "#header").css("font-size", "11px");
    } else {
        adjust();
        heightAdjust();
    }  
/*
    if($("p.not-found").length != 0){
        $("p.not-found").before('<p>お客様の入力されたURLは以下になります。<br /><span style="word-break: break-all;line-height:1;display:block;background:#ffe4e4;font-size:2em;padding:6px 8px;font-weight:bold;">' + location.href + '</span></p>');
    }
*/
}


