/* require AjaxCommon.js */
var xmlUrlTarifu = '/kaigai/htl/Ajax/XML/HotelTarifuXml.aspx';
var dataTarifuAry = [];
var stayDaysAry = [];
var historyAry = [];
var months = new Array("01","02","03","04","05","06","07","08","09","10","11","12");
var weekDays = new Array("(日)","(月)","(火)","(水)","(木)","(金)","(土)");
var intCount = 0;
var newURL = "";
var httpTarifuObj,tarifuCheckInMonth,tarifuCheckInDay,tarifuStayDays,tarifuRoomList,tarifuMinPrice,tarifuMaxPrice,tarifuReturnDate,serchMony,serchDay;
function sendTarifuRequest(queryString){
    mv_attr('tab_active','href','bk');
    if(getObject('plan-list'))getObject('plan-list').style.visibility = "hidden";
    if(getObject('change-tab'))getObject('change-tab').style.visibility = "hidden";
    if(getObject('month-last'))getObject('month-last').style.visibility = "hidden";
    if(getObject('month-next'))getObject('month-next').style.visibility = "hidden";
    newURL = xmlUrlTarifu + queryString;
    dataTarifuRequest(xmlUrlTarifu + queryString);
}
function dataTarifuRequest(URL){
    httpTarifuObj=createXMLHttpRequest();
    if(httpTarifuObj){
        httpTarifuObj.onreadystatechange = onReadyTarifu;
        httpTarifuObj.open("GET", URL + "&Count=" + intCount, true);
        httpTarifuObj.send(null);
    }
}
function onReadyTarifu(){
    if(isTarifuReady()){
        xmlTarifuToAry();
        ++intCount;
        if(intCount<6){
            dataTarifuRequest(newURL);
        }
        else{
            mv_attr('tab_active','bk','href');
            if(getObject('plan-list'))getObject('plan-list').style.visibility = "visible";
            if(getObject('change-tab'))getObject('change-tab').style.visibility = "visible";
            if(getObject('month-last'))getObject('month-last').style.visibility = "visible";
            if(getObject('month-next'))getObject('month-next').style.visibility = "visible";
            if(getObject('serch-link'))getObject('serch-link').style.display = "block";
            if(getObject('serch-link2'))getObject('serch-link2').style.display = "none";
        }
    }
}
function isTarifuReady(){
    if ((httpTarifuObj.readyState == 4) && (httpTarifuObj.status == 200)){ return true;}
    else{return false;}
}
function xmlTarifuToAry(){
    var xml = httpTarifuObj.responseXML;
    var Datas = xml.getElementsByTagName('Data');
    var yearMonth = xml.getElementsByTagName('yearMonth');
    var categoryNameJapanese = xml.getElementsByTagName('categoryNameJapanese');
    var fromtoDate = xml.getElementsByTagName('fromtoDate');
    var SGLPrice = xml.getElementsByTagName('SGLPrice');
    var TWNPrice = xml.getElementsByTagName('TWNPrice');
    var TRPPrice = xml.getElementsByTagName('TRPPrice');
    var OVER4 = xml.getElementsByTagName('OVER4');
    var MealType = xml.getElementsByTagName('MealType');
    var landName = xml.getElementsByTagName('landName');
    var CheckInMonth = xml.getElementsByTagName('CheckInMonth');
    var CheckInDay = xml.getElementsByTagName('CheckInDay');
    var StayDays = xml.getElementsByTagName('StayDays');
    var RoomList = xml.getElementsByTagName('RoomList');
    var Price = xml.getElementsByTagName('Price');
    var SerchUrl = xml.getElementsByTagName('SerchUrl');
    var HotelName = xml.getElementsByTagName('HotelName');
    var PayFlg = xml.getElementsByTagName('PayFlg');
    var SearchArea = xml.getElementsByTagName('SearchArea');
    var SearchDeparture = xml.getElementsByTagName('SearchDeparture');
    var SearchPrice = xml.getElementsByTagName('SearchPrice');
    var SearchKeyword = xml.getElementsByTagName('SearchKeyword');
    var SearchHotelRank = xml.getElementsByTagName('SearchHotelRank');
    var SearchTraffic = xml.getElementsByTagName('SearchTraffic');
    var SearchRoomFacilty = xml.getElementsByTagName('SearchRoomFacilty');
    var SearchServiceFacilty = xml.getElementsByTagName('SearchServiceFacilty');
    var DataFlag = xml.getElementsByTagName('DataFlag');
    for(i=0; i<=Datas.length-1; i++){
        dataTarifuAry.push([getNodeValue(yearMonth[i])
                            ,getNodeValue(categoryNameJapanese[i])
                            ,getNodeValue(fromtoDate[i])
                            ,getNodeValue(SGLPrice[i])
                            ,getNodeValue(TWNPrice[i])
                            ,getNodeValue(TRPPrice[i])
                            ,getNodeValue(OVER4[i])
                            ,getNodeValue(MealType[i])
                            ,getNodeValue(landName[i])
                            ,getNodeValue(CheckInMonth[i])
                            ,getNodeValue(CheckInDay[i])
                            ,getNodeValue(StayDays[i])
                            ,getNodeValue(RoomList[i])
                            ,getNodeValue(Price[i])
                            ,getNodeValue(SerchUrl[i])
                            ,getNodeValue(HotelName[i])
                            ,getNodeValue(PayFlg[i])
                            ,getNodeValue(SearchArea[i])
                            ,getNodeValue(SearchDeparture[i])
                            ,getNodeValue(SearchPrice[i])
                            ,getNodeValue(SearchKeyword[i])
                            ,getNodeValue(SearchHotelRank[i])
                            ,getNodeValue(SearchTraffic[i])
                            ,getNodeValue(SearchRoomFacilty[i])
                            ,getNodeValue(SearchServiceFacilty[i])
                            ,getNodeValue(DataFlag[i])
                            ]);
    }
}
function changeTarifuPage(pageNo){
    if(pageNo){
        new_makeTarifuTable('priceDiv',dataTarifuAry,pageNo);//料金表作成
        makeTarifuNextLink('serch-link',dataTarifuAry,pageNo);//次の月へリンク作成
        get_inc("/kaigai/htl/include/planlist/Nihon/Guidance.html","guidance-japan");
    }else if(pageNo == null){
        get_topicpath(2);
        clear_Table('divhotelDetail');
        // clear_Table('divhotelPlan');
        if(boolpop == false)
            historyAry.push("getDetailPage('Tarifu')");
        else if(boolpop == true)
            boolpop = false;
        makeTarifuTable('divhotelTarifu',dataTarifuAry);
        location.href="#TOP";
    }
}
function new_makeTarifuTable(divId, dataTarifuAry, pageNo){
    if(!dataTarifuAry)return;
    var row = dataTarifuAry.length;
    if ( row == 0 ){xmlTarifuToAry();row = dataTarifuAry.length;}
    var col = 0;
    if ( dataTarifuAry.length > 0 ) col = dataTarifuAry[0].length;
    var page = parseInt(pageNo);
    var sYear = (pageNo.substr(0,4))-0;
    var sMonth = (pageNo.substr(4,2))-0;
    var sPreviousMonth = (sMonth == 1) ? 12 : sMonth - 1;
    var sPreviousYear = (sMonth == 1) ? sYear - 1 : sYear;
    var sNextMonth = (sMonth == 12) ? 1 : sMonth + 1;
    var sNextYear  = (sMonth == 12) ? sYear + 1 : sYear;
    //最初のページの年月を設定
    var todayDate = new Date();
    var theYear = todayDate.getFullYear();
    var theMonth = months[todayDate.getMonth()];
    var firstPage = theYear + theMonth;
    //最後のページの年月を設定
    var lMonth = (theMonth-0) + 5;
    lastMonth = (lMonth > 12) ? lMonth - 12  : lMonth;
    lastYear  = (lMonth > 12) ? (theYear-0) + 1 : theYear;
    var lastPage = lastYear + months[lastMonth-1];
    getObject(divId).innerHTML="";
    var strInnerText = '';
    strInnerText += "<p class='fs_12' id='guidance-japan'></p>";
    strInnerText += "<p class='fs_12' >日本円払いの料金表になります。（基本的に６ヶ月先までとなりますが、ホテルにより表示期間は異なります。）</p>"; // ■場所変更 i.JTB_001 2008-02-01
    if(row!=0){
        if(dataTarifuAry[0][15]!=""){
			strInnerText += "<br><p class='fs_12'>※カテゴリー(眺望)について</p>"; // ■1行追加 i.JTB_001 2008-02-01
            strInnerText += "<p class='fs_12'>" + dataTarifuAry[0][15] + "も含むすべての建物のルームタイプが表示されます。</p>";
            strInnerText += "<p class='clear'></p>";
        }
    }
    strInnerText += "<div id='serch-link'>";
    //**************************************
    // 次の月へリンクは表生成後に作成します
    //**************************************
    strInnerText += "</div>";
    if(dataTarifuAry.length>0){
        isExistData=false;
        for(i=0; i<row; i++) {
            if(dataTarifuAry[i][0]==page){
                isExistData=true; break;
            }
        }
        //データ読み込み
        if(isExistData){
            //テーブルヘッダ作成
            strInnerText += "<table border='0' cellspacing='0' cellpadding='0' width='100%'>";
            strInnerText += "<thead>";
            strInnerText += "<tr>";
            strInnerText += "<th><p class='fs_12'>カテゴリー（眺望）</th>";
            strInnerText += "<th class='term'><p class='fs_12'>期間</p></th>";
            strInnerText += "<td><p class='fs_10'>シングル<br>（1名1室）</p></td>";
            strInnerText += "<td><p class='fs_10'>ツイン/ダブル<br>（2名1室）</p></td>";
            strInnerText += "<td><p class='fs_10'>トリプル<br>（3名1室）</p></td>";
            strInnerText += "<td><p class='fs_10'>クワッド<br>（4名1室）</p></td>";
            strInnerText += "<td><p class='fs_12'>食事</p></td>";
            strInnerText += "<td><p class='fs_12'>手配会社</p></td>";
            strInnerText += "<td><p class='fs_12'>&nbsp;</p></td>";
            strInnerText += "</tr>";
            strInnerText += "</thead>";
            strInnerText += "<tbody>";
            for(i=0; i<row; i++){
                if(dataTarifuAry[i][0] == page){
                    strInnerText += "<tr>";
                    strInnerText += "<th><p class='fs_12'>" + dataTarifuAry[i][1] + "</p></th>";
                    strInnerText += "<td class='term'><p class='fs_12'>" + dataTarifuAry[i][2] + "</td>";
                    strInnerText += "<td><p class='fs_12'>" + dataTarifuAry[i][3]+ "</p></td>";
                    strInnerText += "<td><p class='fs_12'>" + dataTarifuAry[i][4]+ "</p></td>";
                    strInnerText += "<td><p class='fs_12'>" + dataTarifuAry[i][5]+ "</p></td>";
                    strInnerText += "<td><p class='fs_12'>" + dataTarifuAry[i][6] + "</p></td>";
                    strInnerText += "<td><p class='fs_12'>" + dataTarifuAry[i][7] + "</p></td>";
                    strInnerText += "<td><p class='fs_12'>" + dataTarifuAry[i][8] + "</p></td>";
                    strInnerText += "<td class='button'><input type='button' value='選択' onClick=\"location.href='" + dataTarifuAry[i][14] + "'\"></td>";
                    strInnerText += "</tr>";
                }
            }
            strInnerText += "</tbody>";
            strInnerText += "</table>";
            strInnerText += "<p class='fs_12'>※JTB：JTB手配　専門：JTB以外</p>";
        } else {
            strInnerText += '<p class="noplan fs_12">恐れ入りますが、該当月にはご紹介できるルームタイプがございません。選択月を変えてください。</p>';
        }
    }
    getObject(divId).innerHTML = strInnerText;
    return;
}
//次の月リンク生成
function makeTarifuNextLink(divId, dataTarifuAry, pageNo){
    if(!dataTarifuAry)return;
    var row = dataTarifuAry.length;
    if ( row == 0 ){xmlTarifuToAry();row = dataTarifuAry.length;}
    var col = 0;
    if ( dataTarifuAry.length > 0 )col = dataTarifuAry[0].length;
    var page = parseInt(pageNo);
    var sYear = (pageNo.substr(0,4))-0;
    var sMonth = (pageNo.substr(4,2))-0;
    var sPreviousMonth = (sMonth == 1) ? 12 : sMonth - 1;
    var sPreviousYear = (sMonth == 1) ? sYear - 1 : sYear;
    var sNextMonth = (sMonth == 12) ? 1 : sMonth + 1;
    var sNextYear  = (sMonth == 12) ? sYear + 1 : sYear;
    //最初のページの年月を設定
    var todayDate = new Date();
    var theYear = todayDate.getFullYear();
    var theMonth = months[todayDate.getMonth()]
        var firstPage = theYear + theMonth;
    //最後のページの年月を設定
    var lMonth = (theMonth-0) + 5;
    lastMonth = (lMonth > 12) ? lMonth - 12  : lMonth;
    lastYear  = (lMonth > 12) ? (theYear-0) + 1 : theYear;
    var lastPage = lastYear + months[lastMonth-1];
    var strInnerTextlink = '';
    //ページ切り替えリンクボタン設定
    strInnerTextlink = "<ul class='change-month fs_12'>";
    if(page > firstPage && page < lastPage){
        strInnerTextlink += "<li class='month-last' id='month-last'><a href=\"javascript:changeTarifuPage('" + sPreviousYear + months[sPreviousMonth - 1] + "')\"><<前の月へ</a></li>";
        strInnerTextlink += "<li class='month-this'>" + sMonth + "月料金表</li>";
        strInnerTextlink += "<li class='month-next' id='month-next'><a href=\"javascript:changeTarifuPage('" + sNextYear + months[sNextMonth - 1] + "')\">次の月へ>></a></li>";
    } else if(page == firstPage && page < lastPage) {
        strInnerTextlink += "<li class='month-last' id='month-last'>&nbsp;</li>";
        strInnerTextlink += "<li class='month-this'>" + sMonth + "月料金表</li>";
        strInnerTextlink += "<li class='month-next' id='month-next'><a href=\"javascript:changeTarifuPage('" + sNextYear + months[sNextMonth - 1] + "')\">次の月へ>></a></li>";
    } else if(page > firstPage && page == lastPage) {
        strInnerTextlink += "<li class='month-last' id='month-last'><a href=\"javascript:changeTarifuPage('" + sPreviousYear + months[sPreviousMonth - 1] + "')\"><<前の月へ</a></li>";
        strInnerTextlink += "<li class='month-this'>" + sMonth + "月料金表</li>";
        strInnerTextlink += "<li class='month-next' id='month-next'>&nbsp;</li>";
    }
    strInnerTextlink += "</ul>";
    getObject("serch-link").innerHTML = strInnerTextlink;
    return;
}
//テーブル表示
function makeTarifuTable(divId, dataTarifuAry){
    if(!dataTarifuAry)return;
    var row = dataTarifuAry.length;
    if ( row == 0 ){
        xmlTarifuToAry();
        if ( 0 == dataTarifuAry.length )return;
        row = dataTarifuAry.length;
    }
    var col = 0;
    if ( dataTarifuAry.length > 0 )col = dataTarifuAry[0].length;
    getObject(divId).innerHTML="";
    var strInnerText = '';
    strInnerText += "<div id='detail-plan'>";
    strInnerText += "<div id='divhotelTarifu'>";
    strInnerText += "<div id='sub-title'>";
    strInnerText += "<h2 class=fs_14>";
    strInnerText += "料金・ルームタイプ</h2>";
    strInnerText += "<p class=fs_12>";
    strInnerText += " <a href='http://www.jtb.co.jp/help/kaigai/htl/readme/info06.asp' target='_blank'><img src='/common/images/window.gif' width='12' height='12' alt=''>このページのご利用案内</a>";
    strInnerText += "</p>";
    strInnerText += "</div>";
    strInnerText += "<p id='task' class='fs_12'>";
    strInnerText += "検索条件を入力して[空室照会]ボタンをクリックしてください。空室照会結果へ進みます。現地払いプランを希望の場合は[現地払いプランの詳細を見る]ボタンをクリックしてください。";
    strInnerText += "</p>";
    //ページ切り替え
    strInnerText += "<ul id='detail_tab' class='tab fs_12'>";
    strInnerText += "<li><a href=\"javascript:getDetailPage('Tarifu')\" id='tab_active'>ホテル情報</a></li>";
    strInnerText += "<li class='present'>料金・ルームタイプ</li>";
    strInnerText += "</ul>";
    //検索ボックス
    strInnerText += "<div id='search-form'>";
    strInnerText += "<h3 class='fs_12'>空室照会</h3>";
    strInnerText += "<table cellSpacing='0' cellPadding='0' border='0' width='100%'>";
    strInnerText += "<thead>";
    strInnerText += "<tr>";
    strInnerText += "<th>";
    strInnerText += "<p class='fs_12'>項目</p>";
    strInnerText += "</th>";
    strInnerText += "<th>";
    strInnerText += "<p class='fs_12'>内容</p>";
    strInnerText += "</th>";
    strInnerText += "<th class='assist'>";
    strInnerText += "<p class='fs_12'>ご注意</p>";
    strInnerText += "</th>";
    strInnerText += "</tr>";
    strInnerText += "</thead>";
     strInnerText += "<tbody>";
    strInnerText += "<tr>";
    strInnerText += "<th><span class='fs_12'>宿泊日</span><em class='fs_10'>※必須</em></th>";
    strInnerText += "<td><p class='fs_12'>";
    strInnerText += "<select id='idCheckInMonth' Width='85'>" + GetControl(9,14) + "</select>";
    strInnerText += "&nbsp;<select id='idCheckInDay' Width='50'>" + GetControl(10,33) + "</select> から <select id='idStayDays' Width='45'>" + GetControl(11,10) + "</select>&nbsp;<A href='javascript:CalendarDept()' ><IMG height=15 alt='' src='/common/images/icon_calendar.gif' width=19 >カレンダーから日付を選ぶ</A>";
    strInnerText += "</p>";
    strInnerText += "</td>";
    strInnerText += "<td>&nbsp;</td>";
    strInnerText += "</tr>";
    strInnerText += "<tr>";
    strInnerText += "<th><span class='fs_12'>室数</span><em class='fs_10'>※必須</em></th>";
    strInnerText += "<td><p class=fs_12 ><select id='idRoomList' >" + GetControl(12,10) + "</select></p></td>";
    strInnerText += "<td>&nbsp;</td>";
    strInnerText += "</tr>";
    strInnerText += "<tr>";
    strInnerText += "<th><p class='fs_12'>金額</p></th>";
    strInnerText += "<td >";
    strInnerText += "<p class='fs_12' >";
    strInnerText += "<select id='idMinPrice' Width='110'>" + GetControl(13,20) + "</select>&nbsp;以上&nbsp;";
    strInnerText += "<select id='idMaxPrice' Width='110'>" + GetControl(13,20) + "</select>&nbsp;未満";
    strInnerText += "</p>";
    strInnerText += "</td>";
    strInnerText += "<td>&nbsp;</td>";
    strInnerText += "</tr>";
    strInnerText += "</tbody>";
    strInnerText += "</table>";
    strInnerText += "<p class='button'><input style='width:150px' type='button' value='空室照会' onClick=\"javascript:serchTarifuData()\"></p>";
    strInnerText += "</div>";
    //************* 入力チェックエラー表示領域 ****************
    strInnerText += "<div id='serch-warnig' class='fs_12'>";
    strInnerText += "</div>";
    //************* 入力チェックエラー表示領域 ****************
    //＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊日本円払い＊＊＊＊＊＊＊＊＊＊＊＊＊＊
    isExistData = false;
    for(i=0;i<row;++i){
        if(dataTarifuAry[i][25]=='1'){
            isExistData=true; break;
        }
    }
    if(isExistData){ //データ存在フラグ（1:有 0:無）
        strInnerText += "<div id='payment-japan'>";
        strInnerText += "<h3 class='fs_12'>日本円払いプラン</h3>";
        strInnerText += "<div id='priceDiv' class='price'></div>";/* new_makeTarifuTable */
        strInnerText += "</div>";
    }
    //＊＊＊＊＊＊＊＊＊＊＊＊＊＊＊日本円払い＊＊＊＊＊＊＊＊＊＊＊＊＊＊
    //＊＊＊＊＊＊＊＊＊＊＊＊＊＊現地払い＊＊＊＊＊＊＊＊＊＊＊＊＊
    if(row > 0 ){
        if(dataTarifuAry[0][16] == "1"){//現地払いフラグ（1:有 0:無）
            strInnerText += "<div id='payment-local'>";
            strInnerText += "<h3 class='fs_12'>現地払いプラン（直接宿泊施設にお支払い）</h3>";
            strInnerText += "<p class='fs_12' id='guidance-local'></p>";
            strInnerText += "<p  class='button'><input style='width:150px' type='button' value='現地払いプランを見る' onClick=\"Apollo('" + tarifuCheckInMonth + tarifuCheckInDay + "','" + hotelId + "','" + tarifuStayDays + "','2')\"></p>";
            strInnerText += "</div>";
        }
    }
    //＊＊＊＊＊＊＊＊＊＊＊＊＊＊現地払い＊＊＊＊＊＊＊＊＊＊＊＊＊
    if(row > 0 ){
        var attentionUrl="";
        if(isExistData && dataTarifuAry[0][16] == "0"){//日本円データ存在フラグ（1:有）・現地払いフラグ（0:無）の時 日本円払いinclude表示
            strInnerText += "<div id=\"attention\"></div>";
            attentionUrl="/kaigai/htl/include/detail/Gochui_Nihon_Tarifu.html";
        }
        if(!isExistData && dataTarifuAry[0][16] == "1"){//日本円データ存在フラグ（0:無）・現地払いフラグ（1:有）の時 現地払いinclude表示
            strInnerText += "<div id=\"attention\"></div>";
            attentionUrl="/kaigai/htl/include/detail/Gochui_Local_Tarifu.html";
        }
        if(isExistData && dataTarifuAry[0][16] == "1"){//日本円データ存在フラグ（1:有）・現地払いフラグ（1:有）の時 全部表示
            strInnerText += "<div id=\"attention\"></div>";
            attentionUrl="/kaigai/htl/include/detail/Gochui_Tarifu.html";
        }
        if(!isExistData && dataTarifuAry[0][16] == "0"){//日本円データ存在フラグ（ 0:無）・現地払いフラグ（0:無）の時 Error表示
            strInnerText += "<p class='noplan fs_12'>恐れ入りますが、ご紹介できるルームタイプがございません。検索条件を変えて、再度検索してください。</p>";
        }
    }
    if(historyAry.length > 0){
        var index = historyAry.length - 1;
        var scr = historyAry[index];
        strInnerText += "<p class='link-return fs_12'><A href=\"javascript:historypop()\;javascript:" + scr + "\">戻る</A>｜<a href='http://www.jtb.co.jp/kaigai/htl/'>海外ホテルトップに戻る</a>";
    } else {
        strInnerText += "<p class='link-return fs_12'><A href='javascript:history.back()'>戻る</A>｜<a href='http://www.jtb.co.jp/kaigai/htl/'>海外ホテルトップに戻る</a>";
    }
    strInnerText += "</p>";
    strInnerText += "</div>";
    strInnerText += "</div>";
    getObject(divId).innerHTML = strInnerText;
    get_inc("/kaigai/htl/include/planlist/Nihon/Guidance.html","guidance-japan");
    get_inc("/kaigai/htl/include/planlist/local/Guidance.html","guidance-local");
    if(attentionUrl.length>0) get_inc(attentionUrl,"attention"); //ご注意・ご案内
    if( departureDate == null || departureDate == ""){
        //初期表示yearMonth（ホテルリスト・ホテル詳細画面からの遷移時）
        var yearMonth = dataTarifuAry[0][0];
    }else if(departureDate.length == 8){
        //検索項目再設定(プラン一覧から再検索遷移用)
        getObject("idCheckInMonth").value = departureDate.substr(0,6);
        getObject("idCheckInDay").value = departureDate.substr(6,2);
        var yearMonth = departureDate.substr(0,6);
    }
    if(!yearMonth||yearMonth.length==0){
        yearMonth=getObject("idCheckInMonth").options[1].value;
    }
    if(!numberOfStay == "") getObject("idStayDays").value = numberOfStay;
    if(!numberOfRoom == "") getObject("idRoomList").value = numberOfRoom;
    if(!minimumPrice == "") getObject("idMinPrice").value = minimumPrice;
    if(!maximumPrice == "") getObject("idMaxPrice").value = maximumPrice;
    if(row > 0 ){
        if(isExistData){//データ存在フラグ（1:有 0:無）
            changeTarifuPage(yearMonth);//ページ変更
        }
    }
    return;
}
//指定された年月がデータに存在するかチェック
function getLinkMonth(val){
    var retMonth = "";
    for(i=0; i<dataTarifuAry.length; i++){
        if(dataTarifuAry[i][0] == val){
            retMonth =val;
        }
    }
    return retMonth;
}
//ドロップダウンリスト生成
function GetControl(cot,count){
    if(!dataTarifuAry)return;
    var retControl = "";
    if(!dataTarifuAry)return;
    if ( 0 < dataTarifuAry.length ) retControl = dataTarifuAry[0][cot];
    for(i=0; i<count;i++) retControl = retControl.replace("str","<option value='").replace("mid","'>").replace("end","</option>");
    return retControl;
}
//空室照会ボタン押下
//200710 詳細画面表示方法変更 Mod -Str
//function serchTarifuData(){
function serchTarifuData(sparam){
//200710 詳細画面表示方法変更 Mod -Str
    getObject("serch-warnig").innerHTML = "";
    tarifuCheckInMonth = getObject("idCheckInMonth").value;
    tarifuCheckInDay = getObject("idCheckInDay").value;
    tarifuStayDays = getObject("idStayDays").value;
    tarifuRoomList = getObject("idRoomList").value;
    tarifuMinPrice = getObject("idMinPrice").value;
    tarifuMaxPrice = getObject("idMaxPrice").value;
    var strInnerText = ""; //エラー表示InnnerText
    if(tarifuCheckInMonth == ""){
        getObject("serch-warnig").innerHTML="";
        strInnerText = "<div id='task'><p class='error'>";
        strInnerText += "宿泊日(年月)を指定してください。";
    }
    if(tarifuCheckInDay == ""){
        if(strInnerText == ""){
            getObject("serch-warnig").innerHTML="";
            strInnerText = "<div id='task'><p class='error'>";
            strInnerText += "宿泊日(日)を指定してください。";
        }else{
            strInnerText += "<br>";
            strInnerText += "宿泊日(日)を指定してください。";
        }
    }
    if(tarifuCheckInMonth.length>0&&tarifuCheckInDay.length>0){
        if(!checkDate(tarifuCheckInMonth.substr(0,4),tarifuCheckInMonth.substr(4,2),tarifuCheckInDay)){
            if(strInnerText == ""){
                getObject("serch-warnig").innerHTML="";
                strInnerText = "<div id='task'><p class='error'>";
                strInnerText += "正しい日付を指定してください。";
            }else{
                strInnerText += "<br>";
                strInnerText += "正しい日付を指定してください。";
            }
        }
        else if(!checkPastDate(tarifuCheckInMonth.substr(0,4),tarifuCheckInMonth.substr(4,2),tarifuCheckInDay)){
            var limitDate=DayOpAdd(new Date(),startDateAdd);
            var limitDateStr=limitDate.getFullYear()+"年"+(limitDate.getMonth()+1)+"月"+limitDate.getDate()+"日";
            if(strInnerText == ""){
                getObject("serch-warnig").innerHTML="";
                strInnerText = "<div id='task'><p class='error'>";
                strInnerText += "宿泊日には、"+limitDateStr+"以降を設定して下さい。";
            }else{
                strInnerText += "<br>";
                strInnerText += "宿泊日には、"+limitDateStr+"以降を設定して下さい。";
            }
        }
    }
 
    var tarifuMinPriceInde = getObject("idMinPrice").selectedIndex;
    var tarifuMaxPriceInde = getObject("idMaxPrice").selectedIndex;
    if(tarifuMinPriceInde>0&&tarifuMaxPriceInde>0){
        if(tarifuMaxPriceInde<=tarifuMinPriceInde){
            if(strInnerText == ""){
                getObject("serch-warnig").innerHTML="";
                strInnerText = "<div id='task'><p class='error'>";
                strInnerText += "金額を正しく指定してください。";
            }else{
                strInnerText += "<br>";
                strInnerText += "金額を正しく指定してください。";
            }
        }
    }
    if(!strInnerText == ""){
        strInnerText += "</p></div>";
        getObject("serch-warnig").innerHTML = strInnerText;
    }else{
        // getObject('divhotelPlan').innerHTML="<div id='detail-plan'><div id='sub-title'><h2 class=fs_14>料金・ルームタイプ</h2></div><p class=fs_12>ただいま検索中です。</p>";
        getReturnDate(tarifuCheckInMonth.substr(0,4),tarifuCheckInMonth.substr(4,2),tarifuCheckInDay);
        // プラン一覧のデータの再取得を行う
        sendSearchPlanRequest( tarifuCheckInMonth + tarifuCheckInDay, tarifuStayDays, tarifuRoomList);
        getNewPlanData(tarifuCheckInMonth + tarifuCheckInDay,tarifuReturnDate,stayDaysAry,serchDay,serchMony);
        //戻るリンク用
        //200710 詳細画面表示方法変更 Mod -Str
         /*
        if(boolpop == false)
		{
            historyAry.push("changePlanToTarifuPage('" + tarifuCheckInMonth + tarifuCheckInDay + "','" + tarifuStayDays + "','" + tarifuRoomList + "','" + tarifuMinPrice + "','" + tarifuMaxPrice + "')");
        }
        else if(boolpop == true)
            boolpop = false;
        */
        //200710 詳細画面表示方法変更 Mod -Str
        get_topicpath(1);
        // makePlanTable('divhotelPlan',dataNewPlanAry,serchDay,serchMony);
    }
}
//日付の妥当性チェック
function checkDate(ckYyyy, ckMm, ckDd){
    return (ckDd-0<=(new Date(ckYyyy-0,ckMm-0,0)).getDate());
}
function checkPastDate(ckYyyy, ckMm, ckDd){
    var target = new Date(ckYyyy-0, ckMm-1, ckDd-0);
    var base = DayOpAdd(new Date(),startDateAdd);
    var intTarget = target.getDate()+((target.getMonth()+(target.getYear()*100))*100);
    var intBase = base.getDate()+((base.getMonth()+(base.getYear()*100))*100);
    if(intBase<=intTarget) return true;
    else return false;
}
function DayOpAdd(objSrcDate,iDay) {
    return new Date(objSrcDate.getTime()+((1000*60*60*24)*iDay));
}
//チェックアウト日の取得
function getReturnDate(gYy, gMm, gDd) {
    var months = new Array("01","02","03","04","05","06","07","08","09","10","11","12");
    var weekDays = new Array("(日)","(月)","(火)","(水)","(木)","(金)","(土)");
    var syear, smonth, sday;
    syear = gYy-0;
    smonth = (gMm-0) - 1;
    sday = gDd-0;
    var stayDays = (tarifuStayDays)?parseInt(tarifuStayDays):1;
    stayDaysAry = [];
    stayDaysAry.push(tarifuCheckInMonth + tarifuCheckInDay);
    var targetDate = new Date(syear,smonth,sday);
    //検索条件表示用日付を生成
    var theYear = targetDate.getFullYear();
    var theMonth = months[targetDate.getMonth()];
    var theDate = targetDate.getDate();
    var theDay = weekDays[targetDate.getDay()];
    if(tarifuRoomList==""){
		//200710 詳細画面表示方法変更 Mod -Str
		//serchDay = "[宿泊日]" + gYy + "年" + gMm + "月" + gDd + "日" + theDay + "から" + stayDays + "泊" + "　[室数]" + "指定なし";
		serchDay = "[室数]&nbsp;" + "指定なし&nbsp;&nbsp;" + "[宿泊日]&nbsp;" + gYy + "年" + gMm + "月" + gDd + "日" + theDay + "から" + stayDays + "泊";
		//200710 詳細画面表示方法変更 Mod -End
    }
    else{
    //200710 詳細画面表示方法変更 Mod -Str
    //serchDay = "[宿泊日]" + gYy + "年" + gMm + "月" + gDd + "日" + theDay + "から" + stayDays + "泊" + "　[室数]" + tarifuRoomList + "室";
    serchDay = "[室数]&nbsp;" + tarifuRoomList + "室&nbsp;&nbsp;" + "[宿泊日]&nbsp;" + gYy + "年" + gMm + "月" + gDd + "日" + theDay + "から" + stayDays + "泊";
    //200710 詳細画面表示方法変更 Mod -End
    }
    var serchMinMony = "" + tarifuMinPrice + "0,000";
    var serchMaxMony = "" + tarifuMaxPrice + "0,000";
    if(tarifuMinPrice == "" && tarifuMaxPrice == "")
        serchMony = "[料金]&nbsp;指定なし";
    else
        serchMony = "[料金]&nbsp;" + ((!tarifuMinPrice == "") ? serchMinMony + "以上" : "") + ((!tarifuMaxPrice == "") ? serchMaxMony + "未満" : "");
    for(i = 1 ; i <= stayDays ; i++){
        var theDate = targetDate.getDate();
        targetDate.setDate(theDate + 1);
        var theYear = targetDate.getFullYear();
        var theMonth = months[targetDate.getMonth()];
        var theDate = targetDate.getDate();
        var theDay = weekDays[targetDate.getDay()];
        tarifuReturnDate = theYear + theMonth + ((theDate < 10) ? "0" +  theDate : theDate);
        stayDaysAry.push( theYear + theMonth + ((theDate < 10) ? "0" +  theDate : theDate));
    }
}
function mv_attr(id,attr1,attr2){
    var obj,attr;
    obj=getObject(id);
    if(obj){
        attr=obj.getAttribute(attr1);
        obj.removeAttribute(attr1);
        obj.setAttribute(attr2,attr);
    }
}

//200710 詳細画面表示方法変更 Add -Str


//MOD 20081111 Aタグのjavascript関数の引数にURLエンコーディングされた文字があると勝手にデコードされしかも文字化けする問題対応 START
//タリフ一覧月別料金表切替
/*
function changeMonthPrice(priceMonth,sQuery){
	var url;
	changeDiv = "month_price";
	url = getUrl(1) + sQuery + "&GetMonthPrice=" + priceMonth;
	var result= httpRequest(url,displayChangePrice);
}
*/
function changeMonthPrice(priceMonth,tbId){

	var sQuery2 = document.getElementById(tbId).value;	//テキストボックスから値を取得
	var url;
	changeDiv = "month_price";
	url = getUrl(1) + sQuery2 + "&GetMonthPrice=" + priceMonth;
	var result= httpRequest(url,displayChangePrice);
}
//MOD 20081111 Aタグのjavascript関数の引数にURLエンコーディングされた文字があると勝手にデコードされしかも文字化けする問題対応 END

//タリフ一覧月別料金表HTML書き換え
function displayChangePrice(res){
	if(res!=""){
		//innerHTML書込み
        if(getObject(changeDiv))getObject(changeDiv).innerHTML = res;
    }
}

//MOD 20081111 Aタグのjavascript関数の引数にURLエンコーディングされた文字があると勝手にデコードされしかも文字化けする問題対応 START
//条件変更リンク（プラン一覧→タリフ一覧）
/*
function changeChoice(Date,Stay,Room,MinPrice,MaxPrice,sparam){
	
	//ぱんくず変更
	//get_topicpath(2);
    //検索条件の取得
    departureDate= Date;
    numberOfStay = Stay;
    numberOfRoom = Room;
    minimumPrice = MinPrice;
    maximumPrice = MaxPrice;
    //戻るリスト
	//historyAry.push("2,null");
	//boolpop = true;
	//タリフ一覧生成
    changeTab(1,sparam);
}
*/
function changeChoice(Date,Stay,Room,MinPrice,MaxPrice,tbId){
	
	var sparam = document.getElementById(tbId).value;	//テキストボックスから値を取得
	
	//ぱんくず変更
	//get_topicpath(2);
    //検索条件の取得
    departureDate= Date;
    numberOfStay = Stay;
    numberOfRoom = Room;
    minimumPrice = MinPrice;
    maximumPrice = MaxPrice;
    //戻るリスト
	//historyAry.push("2,null");
	//boolpop = true;
	//タリフ一覧生成
    changeTab(1,sparam);
}
//MOD 20081111 Aタグのjavascript関数の引数にURLエンコーディングされた文字があると勝手にデコードされしかも文字化けする問題対応 END

//URLからQueryStringを取得
function getQuery(sQuery)
{
	var index = sQuery.indexOf("?",0);
    var query = "";
            
    if(index != -1)
    {
		query = sQuery.substr(index,sQuery.length-index);
    }
    
    return query
}

//200710 詳細画面表示方法変更 Add -End


//ADD 20081111 Aタグのjavascript関数の引数にURLエンコーディングされた文字があると勝手にデコードされしかも文字化けする問題対応 START

// 引数「sQuery」をテキストボックスから取得し、changeMonthPriceを実行する(Aタグの中にURLエンコードされた文字があると文字化けしてしまうため)
/*
function to_changeMonthPrice(priceMonth, tbId){
	var sQuery2 = document.getElementById(tbId).value;	//テキストボックスから値を取得
	changeMonthPrice(priceMonth, sQuery2);
}
*/
//ADD 20081111 Aタグのjavascript関数の引数にURLエンコーディングされた文字があると勝手にデコードされしかも文字化けする問題対応 END