dispatcher('^', function () {
               $('.search').css({
                                    cursor:'pointer'
                                });
               //透過度変化部分
               $('div#top_head_banner_set a img')
                   .mouseover(function(){
                                  opacityChange(this,0.6);
                              })
                   .mouseout(function(){
                                 opacityChange(this,1);
                             });
               $('div#quick_menu_block a img')
                   .mouseover(function(){
                                  opacityChange(this,0.6);
                              })
                   .mouseout(function(){
                                 opacityChange(this,1);
                             });
               $('div#top_main_contents_inner a img')
                   .mouseover(function(){
                                  opacityChange(this,0.6);
                              })
                   .mouseout(function(){
                                 opacityChange(this,1);
                             });
               $('div#foot_searth_block a img')
                   .mouseover(function(){
                                  opacityChange(this,0.6);
                              })
                   .mouseout(function(){
                                 opacityChange(this,1);
                             });
               $('div#foot_copy_block a img')
                   .mouseover(function(){
                                  opacityChange(this,0.6);
                              })
                   .mouseout(function(){
                                 opacityChange(this,1);
                             });
               $('div#small_window_contents_box a img')
                   .mouseover(function(){
                                  opacityChange(this,0.6);
                              })
                   .mouseout(function(){
                                 opacityChange(this,1);
                             });

               // colorboxの設定
               if(typeof $.colorbox == 'function') {
                   $('.floatingbox').colorbox();
               }

               // ajaxzip3の設定
               if (typeof(AjaxZip3) != 'undefined') {
                   AjaxZip3.JSONDATA = getPath() + 'zipdata';
               }

               /*
                * 透過度を変化させる。
                */
               function opacityChange(id,opacity){
                   $(id).fadeTo(200, opacity);
               }

               //アコーディオン部分

               //要素の数を取得
               var row_length = $('dl#campaign_panel_dl dt').length;
               //idをdtとddそれぞれに振る。
               var i = 0;
               $('dl#campaign_panel_dl dt').each(function(){
                                                     $(this).attr('id','dt_campaign_panel' + i);
                                                     i++;
                                                 });
               var j = 0;
               $('dl#campaign_panel_dl dd').each(function(){
                                                     $(this).attr('id','dd_campaign_img' + j);
                                                     j++;
                                                 });
               //最初は一番目が呼ばれる。
               //表示する場所のカウンター
               var counter = 0;
               //初めに一番上。
               $('dl#campaign_panel_dl dd').hide();
               accordionChange(counter);
               //セットインターバルで一定時間ごとに取得
               var timerId = setInterval(function(){timerChange();},17000);
               /*
                * タイマーのカウンター制御
                */
               function timerChange(){
                   if (counter >= row_length - 1){
                       counter = 0;
                   }else{
                       counter++;
                   }
                   accordionChange(counter);
               }

               //列の長さの取得
               //自動移動分
               $('dl#campaign_panel_dl dt').css('cursor','pointer');
               //ddをクリックしたとき
               $('dl#campaign_panel_dl dt').click(function(){
                                                      var row_no = this.id.replace(/dt_campaign_panel/g, '');
                                                      //タイマーをいったんクリアして再度セットインターバルを走らせる。
                                                      clearInterval(timerId);
                                                      timerId = setInterval(function(){timerChange();},17000);
                                                      //カウンターはクリックした列番号から
                                                      counter = row_no;
                                                      accordionChange(row_no);
                                                  });
               /*
                * accordionChange
                *
                * 列番号から表示する詳細項目を表示させる。
                */
               function accordionChange(num){
                   //すべていったん非表示。
                   $('dl#campaign_panel_dl dd').slideUp(500);
                   $('dd#dd_campaign_img' + num).slideDown(500);
               }

               /**
                * TOPページ検索ボックス
                */
               $('a#top_head_search_link').click(function(){
                                                     /*
                                                      if ( $('#head_search_text').val() == '' ) {
                                                      // mes:検索文字列が未入力です。
                                                      var mes = '\u691C\u7D22\u6587\u5B57\u5217\u304C\u672A\u5165\u529B\u3067\u3059\u3002';
                                                      alert(mes);
                                                      return false;
                                                      }
                                                      */
                                                     var searchUrl = $(this).attr('href');
                                                     var params = '';

                                                     $('#top_head_search_box :input').each(function(){
                                                                                               if ( params != '' ) {
                                                                                                   params += '&';
                                                                                               }
                                                                                               params += $(this).attr('name')+"="+encodeURI($(this).val());
                                                                                           });

                                                     if ( params != '' ) {
                                                         searchUrl += '?'+params;
                                                     }

                                                     location.href = searchUrl;
                                                     return false;
                                                 });

               /**
                * TOPページ検索ボックス(ENTERで検索
                */
               $('#top_head_search_box :input').keypress(function(event) {
                                                             if (event.keyCode == 13) {
                                                                 //               $('a#top_head_search_link').click(function(){
                                                                 /*
                                                                  if ( $('#head_search_text').val() == '' ) {
                                                                  // mes:検索文字列が未入力です。
                                                                  var mes = '\u691C\u7D22\u6587\u5B57\u5217\u304C\u672A\u5165\u529B\u3067\u3059\u3002';
                                                                  alert(mes);
                                                                  return false;
                                                                  }
                                                                  */
                                                                 var searchUrl = $('#top_head_search_link').attr('href');
                                                                 var params = '';

                                                                 $('#top_head_search_box :input').each(function(){
                                                                                                           if ( params != '' ) {
                                                                                                               params += '&';
                                                                                                           }
                                                                                                           params += $(this).attr('name')+"="+encodeURI($(this).val());
                                                                                                       });

                                                                 if ( params != '' ) {
                                                                     searchUrl += '?'+params;
                                                                 }

                                                                 location.href = searchUrl;
                                                                 return false;
                                                             }
                                                             return null;
                                                         });

               /**
                * header検索ボックス(汎用)
                */
               $('a#head_search_link').click(function(){
                                                 /*
                                                  if ( $('#head_search_text').val() == '' ) {
                                                  // mes:検索文字列が未入力です。
                                                  var mes = '\u691C\u7D22\u6587\u5B57\u5217\u304C\u672A\u5165\u529B\u3067\u3059\u3002';
                                                  alert(mes);
                                                  return false;
                                                  }
                                                  */
                                                 var searchUrl = $(this).attr('href');
                                                 var params = '';

                                                 $('#head_search_box :input').each(function(){
                                                                                       if ( params != '' ) {
                                                                                           params += '&';
                                                                                       }
                                                                                       params += $(this).attr('name')+"="+encodeURI($(this).val());
                                                                                   });
                                                 if ( params != '' ) {
                                                     searchUrl += '?'+params;
                                                 }

                                                 location.href = searchUrl;
                                                 return false;
                                             });

               /**
                * header検索ボックス(汎用)（ENTERで検索
                */
               $('#head_search_box :input').keypress(function(event){
                                                         if (event.keyCode == 13) {
                                                             /*
                                                              if ( $('#head_search_text').val() == '' ) {
                                                              // mes:検索文字列が未入力です。
                                                              var mes = '\u691C\u7D22\u6587\u5B57\u5217\u304C\u672A\u5165\u529B\u3067\u3059\u3002';
                                                              alert(mes);
                                                              return false;
                                                              }
                                                              */

                                                             var searchUrl = $('a#head_search_link').attr('href');
                                                             var params = '';

                                                             $('#head_search_box :input').each(function(){
                                                                                                   if ( params != '' ) {
                                                                                                       params += '&';
                                                                                                   }
                                                                                                   params += $(this).attr('name')+"="+encodeURI($(this).val());
                                                                                               });

                                                             if ( params != '' ) {
                                                                 searchUrl += '?'+params;
                                                             }

                                                             location.href = searchUrl;
                                                             return false;
                                                         }
                                                         return null;
                                                     });

               /**
                * footer検索ボックス(汎用)
                */
               $('a#foot_search_link').click(function(){
                                                 /*
                                                  if ( $('#foot_search_text').val() == '' ) {
                                                  // mes:検索文字列が未入力です。
                                                  var mes = '\u691C\u7D22\u6587\u5B57\u5217\u304C\u672A\u5165\u529B\u3067\u3059\u3002';
                                                  alert(mes);
                                                  return false;
                                                  }
                                                  */
                                                 var searchUrl = $(this).attr('href');
                                                 var params = '';

                                                 $('#foot_search_unit :input').each(function(){
                                                                                        if ( params != '' ) {
                                                                                            params += '&';
                                                                                        }
                                                                                        params += $(this).attr('name')+"="+encodeURI($(this).val());
                                                                                    });

                                                 if ( params != '' ) {
                                                     searchUrl += '?'+params;
                                                 }

                                                 location.href = searchUrl;
                                                 return false;
                                             });

               /**
                * footer検索ボックス(汎用)(Enterで検索
                */
               $('#foot_search_unit :input').keypress(function(event){
                                                          if (event.keyCode == 13) {
                                                              /*
                                                               if ( $('#foot_search_text').val() == '' ) {
                                                               // mes:検索文字列が未入力です。
                                                               var mes = '\u691C\u7D22\u6587\u5B57\u5217\u304C\u672A\u5165\u529B\u3067\u3059\u3002';
                                                               alert(mes);
                                                               return false;
                                                               }
                                                               */
                                                              var searchUrl = $('a#foot_search_link').attr('href');
                                                              var params = '';

                                                              $('#foot_search_unit :input').each(function(){
                                                                                                     if ( params != '' ) {
                                                                                                         params += '&';
                                                                                                     }
                                                                                                     params += $(this).attr('name')+"="+encodeURI($(this).val());
                                                                                                 });

                                                              if ( params != '' ) {
                                                                  searchUrl += '?'+params;
                                                              }

                                                              location.href = searchUrl;
                                                              return false;
                                                          }
                                                          return null;
                                                      });

               /**
                * トップheader検索のメニュートグル処理
                */
               function topHeadSearchMenuToggle(time) {
                   setTimeout(function(){
                                  $('div#top_head_search_menu img').each(function(){
                                                                             var img = $(this);
                                                                             // imgの親要素がAタグ
                                                                             var link = img.parent();

                                                                             // 検索対象URLのメニューをONにする
                                                                             if ( $('#top_head_search_link').attr('href') == link.attr('rel') ) {
                                                                                 img.attr('src', img.attr('src').replace("_off.", "_on."));
                                                                             } else {
                                                                                 img.attr('src', img.attr('src').replace("_on.", "_off."));
                                                                             }
                                                                         });
                              } , time);
               }
               /**
                * トップheader検索のメニューのクリック処理
                */
               $('div#top_head_search_menu a').click(function(){
                                                         // 検索対象URLを入れ替える
                                                         var rel = $(this).attr('rel');
                                                         $('#top_head_search_link').attr('href', rel);
                                                         // トグル処理
                                                         topHeadSearchMenuToggle(0);

                                                         if ( $('#head_search_text').val() ) {
                                                             var searchUrl = rel;
                                                             var params = '';

                                                             $('#top_head_search_box :input').each(function(){
                                                                                                       if ( params != '' ) {
                                                                                                           params += '&';
                                                                                                       }
                                                                                                       params += $(this).attr('name')+"="+encodeURI($(this).val());
                                                                                                   });

                                                             if ( params != '' ) {
                                                                 searchUrl += '?'+params;
                                                             }

                                                             location.href = searchUrl;
                                                         }
                                                         return false;
                                                     });

               /**
                * header検索のメニュートグル処理
                */
               function headSearchMenuToggle(time) {
                   setTimeout(function(){
                                  $('div#head_search_menu img').each(function(){
                                                                         var img = $(this);
                                                                         // imgの親要素がAタグ
                                                                         var link = img.parent();

                                                                         // 検索対象URLのメニューをONにする
                                                                         if ( $('#head_search_link').attr('href') == link.attr('rel') ) {
                                                                             img.attr('src', img.attr('src').replace("_off.", "_on."));
                                                                         } else {
                                                                             img.attr('src', img.attr('src').replace("_on.", "_off."));
                                                                         }
                                                                     });
                              } , time);
               }
               /**
                * header検索のメニューのクリック処理
                */
               $('div#head_search_menu a').click(function(){
                                                     // 検索対象URLを入れ替える
                                                     var rel = $(this).attr('rel');
                                                     $('#head_search_link').attr('href', rel);
                                                     // トグル処理
                                                     headSearchMenuToggle(0);

                                                     if ( $('#head_search_text').val() ) {
                                                         var searchUrl = rel;
                                                         var params = '';

                                                         $('#head_search_box :input').each(function(){
                                                                                               if ( params != '' ) {
                                                                                                   params += '&';
                                                                                               }
                                                                                               params += $(this).attr('name')+"="+encodeURI($(this).val());
                                                                                           });

                                                         if ( params != '' ) {
                                                             searchUrl += '?'+params;
                                                         }

                                                         location.href = searchUrl;
                                                     }
                                                     return false;
                                                 });

               // rollover.jsから逃れる為リスナに登録して実行
               if(window.addEventListener) {
                   window.addEventListener("load", function(){topHeadSearchMenuToggle(500)}, false);
                   window.addEventListener("load", function(){headSearchMenuToggle(500)}, false);
               } else if(window.attachEvent) {
                   window.attachEvent("onload", function(){topHeadSearchMenuToggle(500)});
                   window.attachEvent("onload",function(){headSearchMenuToggle(500)});
               }

           });


dispatcher('^/$|^/index.*?html', function () {
               var imageNo = 0;                         // 表示画像
               var nextimageNo = 1;                     // フェードイン画像
               var dummyimagedir = '/dzero/dummy/';     // 切り替え画像ファイルディレクトリ

               campaignNo = 0;     // 表示するキャンペーン
               sceneNo = 0;        // シーン番号

               // 切替画像データ作成
               img = new Array(
                   '/img_common/cat_top/head_main_image_personal.jpg',
                   dummyimagedir + 'dummy01.jpg',
                   dummyimagedir + 'dummy02.jpg',
                   dummyimagedir + 'dummy03.jpg',
                   dummyimagedir + 'dummy04.jpg',
                   dummyimagedir + 'dummy05.jpg',
                   dummyimagedir + 'dummy06.jpg',
                   dummyimagedir + 'dummy07.jpg'
               );

               // キャンペーンデータの作成
               campaignList = new Array();
               $('ul#campaign > li').each(function(index, elem){
                                              campaignList[index] = $(elem).html();
                                          });

               $(function() {
                     /**
                      *  トップ画像の自動切換え
                      */
                     /*
                      setInterval(function() {

                      $('#head_main_image_box_personal').css('background-image', 'url(' + img[nextimageNo] + ')');

                      $('#head_main_nextimage_box_personal').attr('src', img[imageNo]);
                      $('#head_main_nextimage_box_personal').css('opacity', 1);
                      $('#head_main_nextimage_box_personal').fadeTo(1200, 0.0);

                      imageNo++;
                      nextimageNo++;

                      if(!img[nextimageNo]) {
                      nextimageNo = 0;
                      }

                      if(!img[imageNo]) {
                      imageNo = 0;
                      }
                      }, 3000);
                      */


/* スマートフォンページへのリンクボタンの生成 */
function createSmartPhoneButton() {
	var $main_container = $('#main_container');
	var $smartPhoneButton = $('<div>').attr({
		id: 'smartPhoneButton'
	});
	var $a = $('<a>').attr({
		href: '/sp/' // リンク先のパス
	});
	
	/* 外部でCSSを記述する場合はここは削除してください */
	$smartPhoneButton.css({// div#smartPhoneButton要素へのCSS
		height: '120px',
		background: '#2e2e2e',
		padding: '30px 0px 0px 0px'
	});
	$a.css({// a要素へのCSS
		display:'block',
		width: '100%',
		height: '100%'
	});
	/* 削除ここまで */
	
	$smartPhoneButton.append($a.html('<img src="/img_common/cat_top/head_spbt.jpg" alt="スマートフォン専用サイト">'));
	$main_container.prepend($smartPhoneButton);
}
// UA判定
if (/iPhone|Android/i.test(navigator.userAgent)) {
//	createSmartPhoneButton();
}



/* 時刻によるヘッダの背景画像の変換 */
// 条件定義（いくつでも追加できます。順番はバラバラでも大丈夫です）
var confs = [
	{
		// 時間(0から23の整数のみ)
		hours: 0,
		// このJSファイルからでなくhtmlページからの相対パスもしくは絶対パス
		src: '/img_common/cat_top/head_main_image_personal.jpg',
		pos1top: '265',
		pos1left: '50'
	}
];
confs.sort(function (a, b){
	return b.hours - a.hours;
}
);
for (var i = 0; i < confs.length; i++) {
	var hours = (new Date()).getHours();
	if (hours >= confs[i].hours) {
		//console.log(confs[i].src);

		$('#head_main_image_box_personal').css({background: 'url(' + confs[i].src + ') no-repeat scroll'});

		$('#top_head_search_bg').css({top: confs[i].pos1top + 'px'});
		$('#top_head_search_bg').css({left: confs[i].pos1left + 'px'});
		$('#top_head_search_bg').css({visibility: 'visible'});

		$('#top_head_search_box').css({top: parseInt(confs[i].pos1top) + 3 + 'px'});
		$('#top_head_search_box').css({left: parseInt(confs[i].pos1left) + 3 + 'px'});
		$('#top_head_search_box').css({visibility: 'visible'});

		$('#top_head_search_menu').css({top: parseInt(confs[i].pos1top) + 38 + 'px'});
		$('#top_head_search_menu').css({left: parseInt(confs[i].pos1left) + 3 + 'px'});
		$('#top_head_search_menu').css({visibility: 'visible'});

		$('#head_search_help_cattop').css({top: parseInt(confs[i].pos1top) + 38 + 'px'});
		$('#head_search_help_cattop').css({left: parseInt(confs[i].pos1left) + 353 + 'px'});
		$('#head_search_help_cattop').css({visibility: 'visible'});

		break;
	}
}





                      // キャンペーン情報が存在する場合はタイマーを設定
                     if(campaignList) {
                         setInterval(function(){

                                         // キャンペーン情報一つ分のスライドが終了
                                         if(sceneNo == 17) {
                                             sceneNo = 0;    // シーンを戻す
                                             campaignNo++;   // 次のキャンペーンの表示
                                         }

                                         // 初期設定
                                         if(sceneNo == 0) {
                                             if(!campaignList[campaignNo]) {
                                                 campaignNo = 0;
                                             }

                                             var cssObj = {
                                                 'paddingLeft': '1700px',
                                                 'whiteSpace': 'nowrap'
                                             };
                                             $("#campaign_ticker_text > p").css(cssObj);
                                             $("#campaign_ticker_text > p").html(campaignList[campaignNo]);

                                             // 右からスライドして入ってくる
                                             $("#campaign_ticker_text > p").animate({
                                                                                        paddingLeft:'810px'
                                                                                    }, 7000);
                                         }

                                         // 基本位置で停止した場合、左へスライドして消えていく
                                         if(sceneNo == 10) {
                                             $("#campaign_ticker_text > p").animate({
                                                                                        paddingLeft:'0px'
                                                                                    }, 6000);
                                         }

                                         sceneNo++;
                                     }, 1000);
                     }

                 });
           });

// /search/
dispatcher('/search/\??', function () {
               //クリック時
               $('.site_search_menu a').click(function(){
                                                  var click_class = $(this).attr('class');
                                                  var flag_value = click_class.replace('site_menu_','');
                                                  //hidden値の書き換え
                                                  //同じクラス名のものの区別のため
                                                  var flag_form = $(this).parent().parent().parent().children('input').get(0);
                                                  $(flag_form).val(flag_value);
                                                  //画像の切り替え
                                                  $(this).parent().parent().children('li').children('a').children('img').map(function(){
                                                                                                                                 $(this).attr('src',this.src.replace('_on','_off'));
                                                                                                                             });
                                                  var flag_img = $(this).children('img');
                                                  //その後クリックしたものだけオンに
                                                  var click_img_path = flag_img.get(0);
                                                  $(flag_img).attr('src',click_img_path.src.replace('_off','_on'));

                                                  var word = $(this).parents('div.site_search_box').find('input#word').val();
                                                  if (word) {
                                                      // 検索対象URLを入れ替える
                                                      var rel = $(this).attr('rel');

                                                      var searchUrl = rel;
                                                      var params = '';
                                                      params += "q="+encodeURI(word);
                                                      if ( params != '' ) {
                                                          searchUrl += '?'+params;
                                                      }
                                                      location.href = searchUrl;
                                                  }

                                                  return false;
                                              });

               //マウスオーバー時
               $('.site_search_menu a').mouseover(function(){
                                                      var flag_img = $(this).children('img');
                                                      //その後クリックしたものだけオンに
                                                      var click_img_path = flag_img.get(0);
                                                      $(flag_img).attr('src',click_img_path.src.replace('_off','_on'));
                                                  });
               //マウスアウト時
               $('.site_search_menu a').mouseout(function(){
                                                     var flag_form = $(this).parent().parent().parent().children('input').get(0);
                                                     var flag = $(flag_form).val();
                                                     var this_class = $(this).attr('class');
                                                     //現在選択中のもの以外ならoffに
                                                     if (this_class != 'site_menu_' + flag){
                                                         var flag_img = $(this).children('img');
                                                         var click_img_path = flag_img.get(0);
                                                         $(flag_img).attr('src',click_img_path.src.replace('_on','_off'));
                                                     }
                                                 });

               //rollover.jsのonloadより後に読ませるため
               $(window).load(function(){
                                  setTimeout(function(){
                                                 $('img').map(function(){
                                                                  var image_path = this.src;
                                                                  //2と3を読み込み時にoffにする。
                                                                  //rollover.jsに対応させないためにはじめはすべてonにしてある。
                                                                  if (image_path.match('search_menu02_on.gif') || image_path.match('search_menu03_on.gif')){
                                                                      $(this).attr('src',image_path.replace('_on','_off'));
                                                                  }
                                                              });
                                             } , 500);
                              });

               //件数表示変更プルダウン
               $('#result_view').change(function(){
                                            var this_url = $('#this_url').val();
                                            location.href = this_url + '&limit=' + $(this).val();
                                        });
           });

// /faq/search/
dispatcher('/faq/search/', function () {
               //件数表示変更プルダウン
               $('#result_view').change(function(){
                                            var this_url = $('#this_url').val();
                                            location.href = this_url + '&limit=' + $(this).val();
                                        });
           });

// /faq/
// /faq/と/faq/category1/subcategory1/PAGE_*.htmlが対象
dispatcher('/faq/', function () {
               /**
                * faqの検索
                */
               $('a#faq_search_link').click(function(){
                                                /*
                                                 if ( $('#head_search_text').val() == '' ) {
                                                 // mes:検索文字列が未入力です。
                                                 var mes = '\u691C\u7D22\u6587\u5B57\u5217\u304C\u672A\u5165\u529B\u3067\u3059\u3002';
                                                 alert(mes);
                                                 return false;
                                                 }
                                                 */
                                                var searchUrl = $(this).attr('href');
                                                var params = '';

                                                $('#faq_search_unit :input').each(function(){
                                                                                      if ( params != '' ) {
                                                                                          params += '&';
                                                                                      }
                                                                                      params += $(this).attr('name')+"="+encodeURI($(this).val());
                                                                                  });
                                                var category = '';
                                                $('#faq_category_list :input').each(function(){
                                                                                        if ($(this).attr('checked')){
                                                                                            if ( category != '' ) {
                                                                                                category += ',';
                                                                                            }
                                                                                            category += encodeURI($(this).val());
                                                                                        }
                                                                                    });
                                                if (category != ''){
                                                    if ( params != '' ) {
                                                        params += '&';
                                                    }
                                                    params += "CategoryCheck"+"="+category;
                                                }
                                                if ( params != '' ) {
                                                    searchUrl += '?'+params;
                                                }
                                                location.href = searchUrl;
                                                return false;
                                            });

               /**
                * faqの検索(ENTERで検索
                */
               $('#faq_search_unit :input').keypress(function(event) {
                                                         if (event.keyCode == 13) {
                                                             //               $('a#top_head_search_link').click(function(){
                                                             /*
                                                              if ( $('#head_search_text').val() == '' ) {
                                                              // mes:検索文字列が未入力です。
                                                              var mes = '\u691C\u7D22\u6587\u5B57\u5217\u304C\u672A\u5165\u529B\u3067\u3059\u3002';
                                                              alert(mes);
                                                              return false;
                                                              }
                                                              */
                                                             var searchUrl = $('a#faq_search_link').attr('href');
                                                             var params = '';

                                                             $('#faq_search_unit :input').each(function(){
                                                                                                   if ( params != '' ) {
                                                                                                       params += '&';
                                                                                                   }
                                                                                                   params += $(this).attr('name')+"="+encodeURI($(this).val());
                                                                                               });
                                                             var category = '';
                                                             $('#faq_category_list :input').each(function(){
                                                                                                     if ($(this).attr('checked')){
                                                                                                         if ( category != '' ) {
                                                                                                             category += ',';
                                                                                                         }
                                                                                                         category += encodeURI($(this).val());
                                                                                                     }
                                                                                                 });
                                                             if (category != ''){
                                                                 if ( params != '' ) {
                                                                     params += '&';
                                                                 }
                                                                 params += "CategoryCheck"+"="+category;
                                                             }
                                                             if ( params != '' ) {
                                                                 searchUrl += '?'+params;
                                                             }
                                                             location.href = searchUrl;
                                                             return false;
                                                         }
                                                         return null;
                                                     });
           });

///faq/category1/と/faq/category1/subcategory1/が対象
//本来は/faq/や/faq/search/や/faq/category1/subcategory1/PAGE_*.html対象外
dispatcher('/faq/', function () {
               //リンクのURL書き換え
               $('#search_type_select :input').click(function(){
                                                         if (this.id == 'site_all'){
                                                             $('a#search_link').attr('href','/search');
                                                         } else{
                                                             $('a#search_link').attr('href','/faq/search');
                                                         }
                                                     });
               /**
                * faqの検索
                */
               $('a#search_link').click(function(){
                                            /*
                                             if ( $('#head_search_text').val() == '' ) {
                                             // mes:検索文字列が未入力です。
                                             var mes = '\u691C\u7D22\u6587\u5B57\u5217\u304C\u672A\u5165\u529B\u3067\u3059\u3002';
                                             alert(mes);
                                             return false;
                                             }
                                             */
                                            var searchUrl = $(this).attr('href');
                                            var params = '';

                                            $('#search_unit :input').each(function(){
                                                                              if ( params != '' ) {
                                                                                  params += '&';
                                                                              }
                                                                              params += $(this).attr('name')+"="+encodeURI($(this).val());
                                                                          });
                                            var search_type = $("input[name=search_type]:checked").val();
                                            //現在のカテゴリの時にCategoryCheckを入れる。
                                            if (search_type == 'now_category'){
                                                if ( params != '' ) {
                                                    params += '&';
                                                }
                                                params += "CategoryCheck"+"="+encodeURI($('#now_category_id').val());
                                            }
                                            if ( params != '' ) {
                                                searchUrl += '?'+params;
                                            }
                                            location.href = searchUrl;
                                            return false;
                                        });

               /**
                * faqの検索(ENTERで検索
                */
               $('#search_unit :input').keypress(function(event) {
                                                     if (event.keyCode == 13) {
                                                         //               $('a#top_head_search_link').click(function(){
                                                         /*
                                                          if ( $('#head_search_text').val() == '' ) {
                                                          // mes:検索文字列が未入力です。
                                                          var mes = '\u691C\u7D22\u6587\u5B57\u5217\u304C\u672A\u5165\u529B\u3067\u3059\u3002';
                                                          alert(mes);
                                                          return false;
                                                          }
                                                          */
                                                         var searchUrl = $('a#search_link').attr('href');
                                                         var params = '';

                                                         $('#search_unit :input').each(function(){
                                                                                           if ( params != '' ) {
                                                                                               params += '&';
                                                                                           }
                                                                                           params += $(this).attr('name')+"="+encodeURI($(this).val());
                                                                                       });
                                                         var search_type = $("input[name=search_type]:checked").val();
                                                         //現在のカテゴリの時にCategoryCheckを入れる。
                                                         if (search_type == 'now_category'){
                                                             if ( params != '' ) {
                                                                 params += '&';
                                                             }
                                                             params += "CategoryCheck"+"="+encodeURI($('#now_category_id').val());
                                                         }
                                                         if ( params != '' ) {
                                                             searchUrl += '?'+params;
                                                         }
                                                         location.href = searchUrl;
                                                         return false;
                                                     }
                                                     return null;
                                                 });
           });

// /shop_search/kana
dispatcher('/shop_search/branches/kana', function () {
               $('img#select_branch').css({cursor:'pointer'}).click(function() {
                                                                        var branch_name = $('input[type=radio]:checked').val();
                                                                        var branch_no = $('input[type=radio]:checked').attr('id').replace(/^shop/, '');
                                                                        if(branch_name && branch_no) {
                                                                            parent.$.fn.closeSearch(branch_name, branch_no);
                                                                        }
                                                                    });
           });

// /shop_search/kana
dispatcher('/shop_search/branches/hope_kana', function () {
               $('img#select_branch').css({cursor:'pointer'}).click(function() {
                                                                        var branch_name = $('input[type=radio]:checked').val();
                                                                        var branch_no = $('input[type=radio]:checked').attr('id').replace(/^shop/, '');
                                                                        if(branch_name && branch_no) {
                                                                            parent.$.fn.closeHopeSearch(branch_name, branch_no);
                                                                        }
                                                                    });
           });

// /dzero/
dispatcher('.', function () {

               //透過度変化部分
               /*
                $('div#head_block a img')
                .mouseover(function(){
                opacityChange(this,0.6);
                })
                .mouseout(function(){
                opacityChange(this,1);
                });
                */
               $('div#quick_menu_block a img')
                   .mouseover(function(){
                                  opacityChange(this,0.6);
                              })
                   .mouseout(function(){
                                 opacityChange(this,1);
                             });
               $('div#contents_area_block a img')
                   .mouseover(function(){
                                  opacityChange(this,0.6);
                              })
                   .mouseout(function(){
                                 opacityChange(this,1);
                             });
               $('div#foot_searth_block a img')
                   .mouseover(function(){
                                  opacityChange(this,0.6);
                              })
                   .mouseout(function(){
                                 opacityChange(this,1);
                             });
               $('div#foot_copy_block a img')
                   .mouseover(function(){
                                  opacityChange(this,0.6);
                              })
                   .mouseout(function(){
                                 opacityChange(this,1);
                             });

               /*
                * 透過度を変化させる。
                */
               function opacityChange(id,opacity){
                   $(id).fadeTo(200, opacity);
               }

               //アコーディオン部分
               //idをdtとddそれぞれに振る。
               var i = 0;
               $('dl#accordion_list_block_dl dt').each(function(){
                                                           $(this).attr('id','dt_accordion_list_block' + i);
                                                           i++;
                                                       });
               var j = 0;
               $('dl#accordion_list_block_dl dd').each(function(){
                                                           $(this).attr('id','dd_accordion_list_block' + j);
                                                           j++;
                                                       });
               $('dl#accordion_list_block_dl dd').hide();
               $('dl#accordion_list_block_dl dt').css('cursor','pointer');
               //ddをクリックしたとき
               $('dl#accordion_list_block_dl dt').click(function(){
                                                            var row_no = this.id.replace(/dt_accordion_list_block/g, '');
                                                            accordionListBlock(row_no);
                                                        });
               /*
                * accordionListBlock
                *
                * 列番号から表示する詳細項目を表示させる。
                */
               function accordionListBlock(num){
                   $('dd#dd_accordion_list_block' + num).slideToggle(500);
               }
           });

/**
 * 支店検索
 */
function bindBranchSearch() {
    var href = getPath().replace(/js/, 'shop_search');
    $('a#branch_search')
        .attr({
                  name:"branch_search",
                  href:href
              });
}
function unbindBranchSearch() {
    /*
     $('a#branch_search')
     .attr({
     name:"branch_search",
     href:"#branch_search"
     });
     */
}
$(function () {
      var href = getPath().replace(/js/, 'shop_search');
      var href_hope = getPath().replace(/js/, 'shop_search/branches/hope');

      var href_help = getPath().replace(/js/, 'search/help/');
      if ($.colorbox != undefined) {
          /**
           * 検索ヘルプ
           */
          $('a#search_help')
              .attr({
                        href:href_help
                    })
              .colorbox({
                            iframe: true,
                            width: '740px',
                            height: '700px',
                            opacity: 0.5,
                            overlayClose: true,
                            close: '',
                            escKey: false,
                            onOpen: function(){
                            },
                            onComplete: function() {
                            },
                            onClosed: function() {
                            }
                        });


          /**
           * 店舗検索
           */
          $('a#branch_search')
              .attr({
                        name:"branch_search",
                        href:href
                    })
              .colorbox({
                            iframe: true,
                            width: '560px',
                            height: '400px',
                            opacity: 0.5,
                            overlayClose: true,
                            close: '',
                            escKey: false,
                            onOpen: function(){
                            },
                            onComplete: function() {
                            },
                            onClosed: function() {
                            }
                        });

          $.fn.closeSearch = function(branchName, branchNo){
              $('tr#input_branch input').val(branchName);
              $('tr#input_branch input').blur();
              $('input[name=branch_code]').val(branchNo);
              $('input[name=branch]').val(branchName);
              $('input[name=branch]').blur();
              $('span#branch_id').html(branchName);
              $.colorbox.close();
          };
          if ($('input[name=branch]').val()) {
              $('span#branch_id').html($('input[name=branch]').val());
          }

          $('img#branch_clear').css({cursor:'pointer'}).click(function() {
                                                                  $('input[name=branch_code]').val('');
                                                                  $('input[name=branch]').val('');
                                                                  $('span#branch_id').html('----');
                                                                  $('input[name=branch]').blur();
                                                              });

          /**
           * 希望店検索
           */
          $('a#branch_hope_search')
              .attr({
                        name:"branch_hope_search",
                        href:href_hope
                    })
              .colorbox({
                            iframe: true,
                            width: '560px',
                            height: '400px',
                            opacity: 0.5,
                            overlayClose: true,
                            close: '',
                            escKey: false,
                            onOpen: function(){
                            },
                            onComplete: function() {
                            },
                            onClosed: function() {
                            }
                        });

          $.fn.closeHopeSearch = function(branchName, branchNo){
              $('input[name=branch_hope_code]').val(branchNo);
              $('input[name=branch_hope]').val(branchName);
              $('input[name=branch_hope]').blur();
              $('span#branch_hope_id').html(branchName);
              $.colorbox.close();
          };
          if ($('input[name=branch_hope]').val()) {
              $('span#branch_hope_id').html($('input[name=branch_hope]').val());
          }

          $('img#branch_hope_clear').css({cursor:'pointer'}).click(function() {
                                                                       $('input[name=branch_hope_code]').val('');
                                                                       $('input[name=branch_hope]').val('');
                                                                       $('span#branch_hope_id').html('----');
                                                                       $('input[name=branch_hope]').blur();
                                                                   });
      }
  });

/**
 * getPath
 * jsディレクトリを取得する
 */
function getPath() {
    var root;
    var scripts = document.getElementsByTagName("script");
    var i = scripts.length;
    while (i--) {
        var match = scripts[i].src.match(/(^|.*\/)bof\.js$/);
        if (match) {
            root = match[1];
            break;
        }
        var match_sjis = scripts[i].src.match(/(^|.*\/)bof_sjis\.js$/);
        if (match_sjis) {
            root = match_sjis[1];
            break;
        }
    }
    return root;
}

/*
 * jQuery pagescroller (jQuery Plugin)
 *
 * Copyright (c) 2010 Tom Shimada
 *
 * Depends Script:
 *	js/jquery.js (1.3.2~)
 */

(function($) {
     $.pagescroller = {
         defaults: {
             selector: 'body',
             anchor_top: null,
             margin_top: 0,
             margin_left: 0,
             easing: 'swing',
             speed: 0.8
         },
         is_msie6: (!$.support.style && typeof document.documentElement.style.maxHeight === 'undefined'),
         is_webkit: ($.support.checkOn !== undefined ? !$.support.checkOn : $.browser.safari),
         uri: (location.protocol + '//' + location.hostname + '/' + (location.pathname).replace(/^\//, '') + location.search).toLowerCase()
     };

     $.pagescroller.init = function(configs) {
         configs = $.extend(this.defaults, configs);

         var anchorPattern = 'a[href*=#]';
         if (configs.anchor_top !== null) {
             anchorPattern += ':not([href$=#])';
         }
         $(anchorPattern, configs.selector).each(function() {
                                                     var target_uri = (this.protocol + '//' + this.hostname + '/' + (this.pathname).replace(/^\//, '') + this.search).toLowerCase();
                                                     if (this.uri != target_uri) {
                                                         var anchor = null;
                                                         if (this.hash) anchor = this.hash == '#' + configs.anchor_top ? 'body' : this.hash;
                                                         else anchor = 'body';
                                                         $(this).click(function(){
                                                                           $.pagescroller.go(anchor, configs);
                                                                           return false;
                                                                       });
                                                     }
                                                 });
     };

     $.pagescroller.go = function(anchor, configs, afterFunc) {
         if (!anchor) return;
         configs = $.extend(this.defaults, configs);
         var $anchor = $(anchor);
         if ($anchor.length === 0) return;
         var $window = $(window),
         offset = $anchor.offset(),
         top = offset.top - configs.margin_top,
         left = offset.left - configs.margin_left;
         if (top < 0)  top = 0;
         if (left < 0)  left = 0;

         var action;
         if (anchor == 'body') {
             action = 'top';
             top = 0;
             left = 0;
         } else {
             var $window = $(window);
             if (top > $window.scrollTop()) action = 'down';
             else action = 'up';
             var $document = $(document),
             doc_height = $document.height(),
             doc_width = $document.width();;
             if (configs.is_msie6 && doc_height > document.body.clientHeight) doc_height = document.documentElement.clientHeight;
             var max_top = doc_height - $window.height();
             if (top > max_top) top = max_top;
             if (configs.is_msie6 && doc_width > document.body.clientWidth) doc_width = document.documentElement.clientWidth;
             var max_left = doc_width - $window.width();
             if (left > max_left) left = max_left;
         }

         var $scroll = $(!this.is_webkit ? 'html' : 'body'),
         distance = Math.ceil(Math.sqrt(Math.pow(Math.abs($scroll.scrollTop() - top), 2) + Math.pow(Math.abs($scroll.scrollLeft() - left), 2)));

         $scroll.animate(
             {
                 scrollTop: top,
                 scrollLeft: left
             },
             Math.ceil(distance * configs.speed),
             configs.easing,
             function() {
                 if ($.isFunction(afterFunc)) afterFunc();
             }
         );
     };
 })(jQuery);

function scrollValidationPoint() {
    var baloon_top = ($('div.baloon_red:visible:first').offset() == null) ? 999999 : $('div.baloon_red:first').offset().top;
    var ng_top = ($('span.ng:visible:first').offset() == null) ? 999999 : $('span.ng:visible').offset().top;

    if (baloon_top < ng_top) {
        $.pagescroller.go($('div.baloon_red:visible:first'), {
                              selector: 'body',
                              anchor_top: null,
                              margin_top: 5,
                              margin_left: 0,
                              easing: 'swing',
                              speed: 0.8
                          });
    } else {
        $.pagescroller.go($('span.ng:visible:first'), {
                              selector: 'body',
                              anchor_top: null,
                              margin_top: 80,
                              margin_left: 0,
                              easing: 'swing',
                              speed: 0.8
                          });
    }
}

/**
 * dispatcher
 // */
function dispatcher (path, func) {
    dispatcher.path_func = dispatcher.path_func || [];
    if (func) return dispatcher.path_func.push([path, func]);
    for(var i = 0, l = dispatcher.path_func.length; i < l; ++i) {
        var p_func = dispatcher.path_func[i];
        var match = path.match(p_func[0]);
        match && p_func[1](match);
    };
    return null;
};
dispatcher(location.pathname);

