// ヘッダーやフッター等、共通的な個所の表示・遷移先を制御する
function fnDispCommonArea(url_dir, update_session, site_flg) {
    // 表示制御情報の取得
    var updateSession = '';
    if (update_session) updateSession = 'true';
    $j.getJSON( url_dir + 'ajax/common.php?update_session=' + updateSession
        + '&site_flg=' + site_flg ,
        function( disp_info ) {
            // common.phpにアクセスして表示制御情報を受信
            // disp_info = { "is_login" : true/false, "is_sale" : true/false, "site_flg" : "01"/"02"/"" };
            if ( disp_info == null ) return;

            // 表示画面の更新
            if ( disp_info.is_sale ) {
                $j("ul#gn").css('width','595px');

                var appendTag = "";
                appendTag = "<li id=\"gn1\" class=\"title\"><a class=\"title\" href=\"" + url_dir + "products/list.php?product_flag=6";
                if ( disp_info.site_flg != "" ) {
                    appendTag += "&brand_code=" + disp_info.site_flg;
                }
                appendTag += "\"></a></li>";
                $j("li#gn2").before(appendTag);

                appendTag = "<li class=\"menu_content\">";
                if ( disp_info.site_flg == "02" ) {
                    appendTag += "<a class=\"inline\" href=\"" + url_dir + "products/list.php?product_flag=6&brand_code=02\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('head11','','" + disp_info.tpl_dir + "img/cmn/cmn_box3_head6_top_f2.jpg',1)\"><img src=\"" + disp_info.tpl_dir + "img/cmn/cmn_box3_head6_top.jpg\" name=\"head11\" alt=\"SALE\" /></a>";
                    appendTag += "</li>";
                    $j("li#men_top_new").before(appendTag);
                } else {
                    appendTag += "<a class=\"inline\" href=\"" + url_dir + "products/list.php?product_flag=6&brand_code=01\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('head11','','" + disp_info.tpl_dir + "img/cmn/cmn_box3_head6_top_f2.jpg',1)\"><img src=\"" + disp_info.tpl_dir + "img/cmn/cmn_box3_head6_top.jpg\" name=\"head11\" alt=\"SALE\" /></a>";
                    appendTag += "</li>";
                    $j("li#women_top_new").before(appendTag);
                }
            }

            // 検索ボックスのラジオボタンのチェック状態の切り替え
            if ( disp_info.site_flg == "01" ) {
                $j("input#women").attr("checked", "checked");
                $j("input#men").attr("checked", "");
                $j("input#all").attr("checked", "");
            } else if ( disp_info.site_flg == "02" ) {
                $j("input#women").attr("checked", "");
                $j("input#men").attr("checked", "checked");
                $j("input#all").attr("checked", "");
            } else {
                $j("input#women").attr("checked", "");
                $j("input#men").attr("checked", "");
                $j("input#all").attr("checked", "checked");
            }

            // site_flgによるリンク先の切り替え
            var top_url = url_dir;
            if ( disp_info.site_flg == "02" ) {
                top_url += "menstop.php";
            }
            var new_url = url_dir + "products/list.php?product_flag=1";
            if ( disp_info.site_flg != "" ) {
                new_url += "&brand_code=" + disp_info.site_flg;
            }
            var style_url = url_dir + "style/";
            if ( disp_info.site_flg == "02" ) {
                style_url += "men.html";
            }

            // ヘッダー.ロゴ
            $j("a#header_logo_link").attr("href", top_url);
            // ヘッダー.NEW
            $j("a#header_new").attr("href", new_url);
            // ヘッダー.STYLING
            $j("a#header_style").attr("href", style_url);
            // フッター.LINK THEORY JAPAN CO.,LTD ALL RIGHTS RESERVED
            $j("a#footer_copy").attr("href", top_url);
            // パンくず.HOME
            $j("a#pan_home").attr("href", top_url);

            // ログイン有無によるリンク先の切り替え
            // ヘッダー.JOIN IN MEMBERS
            if ( disp_info.is_login ) {
                $j("li.header_join_li").attr("id", "gn6_login");
                $j("a#header_join").attr("href", "#");
            } else {
                $j("li.header_join_li").attr("id", "gn6");
                $j("a#header_join").attr("href", url_dir + "entry/kiyaku.php");
            }
        }
    );
}

