//<![CDATA[

    /*========================*/
    /*   検索時アンカー移動   */
    /*========================*/

    function moveAnchor(){
        window.location.hash = "MP";
        document.getElementById("MP").focus();
    }


    /*=========================*/
    /*   TEXTBOXフォーカス時   */
    /*=========================*/

    function focusInput(){
        var inputObj = $('keywordBOX');
        if(inputObj.value != ''){ inputObj.value = ''; }
        inputObj.style.background = '#ffffbb';
    }

    function blurInput(){
        var inputObj = $('keywordBOX');
        if(inputObj.value == ''){ inputObj.value = 'キーボードで入力'; }
        inputObj.style.background = '#ffffff';
    }

    /*==================================*/
    /*   ベンダー・ジャンル　変更時時   */
    /*==================================*/
    function initInput(){
        var inputObj = $('keywordBOX');
        inputObj.value = 'キーボードで入力';
        inputObj.style.background = '#ffffff';
    }


    /*==================================*/
    /*   出力用インラインフレーム関連   */
    /*==================================*/


    /********************************/
    /***   iFrame内表示エリアID   ***/
    /********************************/

    function LoadObj(){
        var LoadObj = document.getElementById("L_search").contentWindow.document.getElementById("mainList");
        return LoadObj;
    }

    /********************************************/
    /***   絞込み検索へ切替時iFrame表示処理   ***/
    /********************************************/

    function chdispWindow(){
        if(dispFlag == null){
            window.dispFlag = 1;
            var dispFrameArea = $('ListselSearch');
            Element.toggle(dispFrameArea);
        }
    }


    /*================*/
    /*   絞込み検索   */
    /*================*/


    /*************************************/
    /***   リスト1/リスト2の項目抽出   ***/
    /*************************************/

    function FirstLoad(){
        /* リスト1の項目取得 */
        var LoadValue = new Ajax.Updater('List_P','./search/script/ListUpdater.php',{
            method: 'post',
            postBody: 'mode=load_OptionLP'
        });

        /* リスト2の項目取得 */
        var LoadValue = new Ajax.Updater('List_C','./search/script/ListUpdater.php',{
            method: 'post',
            postBody: 'mode=load_OptionLC'
        });
    }

    /************************/
    /***   リスト選択時   ***/
    /************************/

    function changeList(status){
        /* 表示フレームの表示/非表示の切り替え */
        chdispWindow();

        /* ステータス */
        var currentID = status;

        var IndexObj_P = document.getElementById("mainForm").List_P.selectedIndex;
        var ValueObj_P = document.getElementById("mainForm").List_P.options[IndexObj_P].value;
        var IndexObj_C = document.getElementById("mainForm").List_C.selectedIndex;
        var ValueObj_C = document.getElementById("mainForm").List_C.options[IndexObj_C].value;

        /* 絞込み結果 */
        var LoadValue = new Ajax.Updater(LoadObj(),'./search/script/Ret_process.php',{
            method: 'post',
            postBody: 'mode='+ currentID + '&ColValP='+ ValueObj_P +'&ColValC='+ ValueObj_C,
            onSuccess: function ChildList(){
                /* リストの選択した項目によって非選択リストの項目を更新 */
                if(currentID == "chListP"){
                    var LoadValue_C = new Ajax.Updater('List_C','./search/script/ListUpdater.php',{
                        method: 'post',
                        postBody: 'mode=ChildList_P&ChildVal='+ ValueObj_P +'&SelectVal='+ ValueObj_C,
                        /* 『--- 選択して下さい ---』があった場合その要素を削除 */
                        onSuccess: function deleteDefCol(){ if(document.getElementById("mainForm").List_P.options[0].value == "DefaultCorp"){ Element.remove($('DefColP')); } }
                    });
                }else if(currentID == "chListC"){
                    var LoadValue_P = new Ajax.Updater('List_P','./search/script/ListUpdater.php',{
                        method: 'post',
                        postBody: 'mode=ChildList_C&ChildVal='+ ValueObj_C +'&SelectVal='+ ValueObj_P,
                        /* 『--- 選択して下さい ---』があった場合その要素を削除 */
                        onSuccess: function deleteDefCol(){ if(document.getElementById("mainForm").List_C.options[0].value == "DefaultGenre"){ Element.remove($('DefColC')); } }
                    });
                }
            },
            onComplete: function chFrameHeight(){
                /* 処理完了後にiFrame内のブロックの高さを取得し、iFrame自体の高さに代入 */
                document.getElementById("L_search").style.height = LoadObj().offsetHeight + 35 + "px";
                moveAnchor();
            }
        });

        //キーワード検索欄初期化 add ONITSUKA 2009/04/14
        initInput();
    }


    /*================*/
    /*   初回起動用   */
    /*================*/


    /**************************/
    /***   ページ読込み時   ***/
    /**************************/

    function init(){
        Event.observe('keywordBOX', 'focus', focusInput, false);
        Event.observe('keywordBOX', 'blur', blurInput, false);
        dispFlag = null;
        FirstLoad();
    }
//]]>