//[在庫カレンダー]の「<<」ボタンをクリックする時のファクション
function clickAllLeft()
{
    var openStr="";
    var closeStr="";
    var i=0;
    $(".resultHidden").each(function(){
        if(this.value=="true")
        {
            if(i==0)
            {
                openStr=openStr+this.id.substring(12,this.id.length);
                i++;
            }
            else
            {
                openStr=openStr+","+this.id.substring(12,this.id.length);
                i++;
            }
            
        }
    })
    document.getElementById("showResultOpenCnt").value=openStr;
    
    var i=0;
    $(".resultHidden").each(function(){
        if(this.value=="false")
        {
            if(i==0)
            {
                closeStr=closeStr+this.id.substring(12,this.id.length);
                i++;
            }
            else
            {
                closeStr=closeStr+","+this.id.substring(12,this.id.length);
                i++;
            }
            
        }
    })
     document.getElementById("showResultCloseCnt").value=closeStr;
     //--画面自動的にTOPに戻る--//
    scroll(0,0);
    //----//
    //出発日選択されていない場合なら。
    if(document.getElementById("CalendarOneCalDaySele").value=="")
    {
        //--（出発日とカレンダー移動不一致の対応--//
        //カレンダーの移動数カウントを取る
        //var tempcnt=document.getElementById("arrowCnt").value;
        //カレンダーの移動数カウントは1を減る。
        //var temp=(parseInt(tempcnt,10)-1);
        //カレンダーの移動数カウントを再設定。
        //document.getElementById("arrowCnt").value=""+temp;
        //Flashの移動数カウントを再設定。
        //document.getElementById("flashCnt").value=""+temp;
        //「画面データ読み込み中...」表示する。
        //changeLoading();
        //代理ボタンをクリックする。
        //var id= document.getElementById("allLeft_Hidden").value;
        //document.getElementById(id).click();
        //----//
        
        //--（出発日とカレンダー移動不一致の対応）--//
        if(document.getElementById("CalendarOneCalYearSele").value!="")
        {
            //カレンダーの移動数カウントを取る
            var tempcnt=document.getElementById("arrowCnt").value;
            //カレンダーの移動数カウントは1をプラスする。
            var temp=parseInt(tempcnt,10);
            if(temp==0)
            {
                var i=document.getElementById("CalendarOneCalDaySele").selectedIndex;
                 //出発日年月の選択indexを取る。
                var tempi=document.getElementById("CalendarOneCalYearSele").selectedIndex;
                //出発日年月の選択を1項目を戻す。（例199803 -->199802）
                document.getElementById("CalendarOneCalYearSele").selectedIndex=(tempi-1);
                //出発日のselectエレメントを再設定する。
                changeDay(document.getElementById('CalendarOneCalYearSele'),'CalendarOneCalDaySele');
                document.getElementById("CalendarOneCalDaySele").selectedIndex=(document.getElementById("CalendarOneCalDaySele").options.length-1);
                 //画面はajaxで更新する。
                updatePage();
            }
            else
            {
                //カレンダーの移動数カウントを取る
                var tempcnt=document.getElementById("arrowCnt").value;
                //カレンダーの移動数カウントは1を減る。
                var temp=(parseInt(tempcnt,10)-1);
                //カレンダーの移動数カウントを再設定。
                document.getElementById("arrowCnt").value=""+temp;
                //Flashの移動数カウントを再設定。
                document.getElementById("flashCnt").value=""+temp;
                //「画面データ読み込み中...」表示する。
                changeLoading();
                //代理ボタンをクリックする。
                var id= document.getElementById("allLeft_Hidden").value;
                document.getElementById(id).click();
            }
            
        }
        else
        {
            //カレンダーの移動数カウントを取る
            var tempcnt=document.getElementById("arrowCnt").value;
            //カレンダーの移動数カウントは1を減る。
            var temp=(parseInt(tempcnt,10)-1);
            //カレンダーの移動数カウントを再設定。
            document.getElementById("arrowCnt").value=""+temp;
            //Flashの移動数カウントを再設定。
            document.getElementById("flashCnt").value=""+temp;
            //「画面データ読み込み中...」表示する。
            changeLoading();
            //代理ボタンをクリックする。
            var id= document.getElementById("allLeft_Hidden").value;
            document.getElementById(id).click();
        }
        //----//
    }
    //出発日を選択されている場合なら。
    else
    {
        //出発日の選択indexを取る。
        var i=document.getElementById("CalendarOneCalDaySele").selectedIndex;
        //出発日の値は01の場合なら。
        if(document.getElementById("CalendarOneCalDaySele").value=="01")
        {
            //出発日年月の選択indexを取る。
            var tempi=document.getElementById("CalendarOneCalYearSele").selectedIndex;
            //出発日年月の選択を1項目を戻す。（例199803 -->199802）
            document.getElementById("CalendarOneCalYearSele").selectedIndex=(tempi-1);
            //出発日のselectエレメントを再設定する。
            changeDay(document.getElementById('CalendarOneCalYearSele'),'CalendarOneCalDaySele');
            document.getElementById("CalendarOneCalDaySele").selectedIndex=(document.getElementById("CalendarOneCalDaySele").options.length-1);
        }
        //出発日の値は01ではない場合なら。
        else
        {
            //出発日のselectエレメントを再設定する。（例　21日 ---> 20日）
            document.getElementById("CalendarOneCalDaySele").selectedIndex=(i-1);
        }
        //画面はajaxで更新する。
        updatePage();
    }
}

//[在庫カレンダー]の「>>」ボタンをクリックする時のファクション  
function clickAllRight()
{
var openStr="";
    var closeStr="";
    var i=0;
    $(".resultHidden").each(function(){
        if(this.value=="true")
        {
            if(i==0)
            {
                openStr=openStr+this.id.substring(12,this.id.length);
                i++;
            }
            else
            {
                openStr=openStr+","+this.id.substring(12,this.id.length);
                i++;
            }
            
        }
    })
    document.getElementById("showResultOpenCnt").value=openStr;
    
    var i=0;
    $(".resultHidden").each(function(){
        if(this.value=="false")
        {
            if(i==0)
            {
                closeStr=closeStr+this.id.substring(12,this.id.length);
                i++;
            }
            else
            {
                closeStr=closeStr+","+this.id.substring(12,this.id.length);
                i++;
            }
            
        }
    })
     document.getElementById("showResultCloseCnt").value=closeStr;
   //--画面自動的にTOPに戻る--//
    scroll(0,0);
    //----//
    //出発日選択されていない場合なら。
    if(document.getElementById("CalendarOneCalDaySele").value=="")
    {
        //--（出発日とカレンダー移動不一致の対応）--//
        //カレンダーの移動数カウントを取る
        //var tempcnt=document.getElementById("arrowCnt").value;
        //カレンダーの移動数カウントは1をプラスする。
        //var temp=(parseInt(tempcnt,10)+1);
        //カレンダーの移動数カウントを再設定。
        //document.getElementById("arrowCnt").value=""+temp;
        //Flashの移動数カウントを再設定。
        //document.getElementById("flashCnt").value=""+temp;
        //「画面データ読み込み中...」表示する。
        //changeLoading();
        //代理ボタンをクリックする。
        //var id= document.getElementById("allRight_Hidden").value;
        //document.getElementById(id).click();
        //----//
    
        //--（出発日とカレンダー移動不一致の対応）--//
        if(document.getElementById("CalendarOneCalYearSele").value!="")
        {
             var tempYear=document.getElementById("CalendarOneCalYearSele").value.substring(0,4);
            //月の値を取る。
            var tempMonth=document.getElementById("CalendarOneCalYearSele").value.substring(4,6);       
            //--出発日とカレンダー移動不一致の対応--// 
            var cnt=document.getElementById("CalendarOneCalDaySele").options.length;
            //----//
            //カレンダーの移動数カウントを取る
            var tempcnt=document.getElementById("arrowCnt").value;
            //カレンダーの移動数カウントは1をプラスする。
            var temp=parseInt(tempcnt,10);
            //--出発日とカレンダー移動不一致の対応--//
            if((cnt-2)==temp)
            {
                //出発日の選択indexを取る。
                var i=document.getElementById("CalendarOneCalDaySele").selectedIndex;
                //出発日年月の選択indexを取る。
                var tempi=document.getElementById("CalendarOneCalYearSele").selectedIndex;
                //出発日年月の選択を1項目を戻す。（例199803 -->199804）
                document.getElementById("CalendarOneCalYearSele").selectedIndex=(tempi+1);
                //出発日のselectエレメントを再設定する。
                changeDay(document.getElementById('CalendarOneCalYearSele'),'CalendarOneCalDaySele');
                document.getElementById("CalendarOneCalDaySele").selectedIndex=1;
                //画面はajaxで更新する
                updatePage();
            }
            else
            {
                 //カレンダーの移動数カウントを取る
                var tempcnt=document.getElementById("arrowCnt").value;
                //カレンダーの移動数カウントは1をプラスする。
                var temp=(parseInt(tempcnt,10)+1);
                //カレンダーの移動数カウントを再設定。
                document.getElementById("arrowCnt").value=""+temp;
                //Flashの移動数カウントを再設定。
                document.getElementById("flashCnt").value=""+temp;
                //「画面データ読み込み中...」表示する。
                changeLoading();
                //代理ボタンをクリックする。
                var id= document.getElementById("allRight_Hidden").value;
                document.getElementById(id).click();
            }
        }
        else
        {
            //カレンダーの移動数カウントを取る
            var tempcnt=document.getElementById("arrowCnt").value;
            //カレンダーの移動数カウントは1をプラスする。
            var temp=(parseInt(tempcnt,10)+1);
            //カレンダーの移動数カウントを再設定。
            document.getElementById("arrowCnt").value=""+temp;
            //Flashの移動数カウントを再設定。
            document.getElementById("flashCnt").value=""+temp;
            //「画面データ読み込み中...」表示する。
            changeLoading();
            //代理ボタンをクリックする。
            var id= document.getElementById("allRight_Hidden").value;
            document.getElementById(id).click();
        }
        //----//
        
    }
    //出発日を選択されている場合なら。
    else
    {
        //出発日の選択indexを取る。
        var i=document.getElementById("CalendarOneCalDaySele").selectedIndex;
        //出発日の範囲が超えているなら。
        if((i+1)>(document.getElementById("CalendarOneCalDaySele").options.length-1))
        {
            //出発日年月の選択indexを取る。
            var tempi=document.getElementById("CalendarOneCalYearSele").selectedIndex;
            //出発日年月の選択を1項目を戻す。（例199803 -->199804）
            document.getElementById("CalendarOneCalYearSele").selectedIndex=(tempi+1);
            //出発日のselectエレメントを再設定する。
            changeDay(document.getElementById('CalendarOneCalYearSele'),'CalendarOneCalDaySele');
            document.getElementById("CalendarOneCalDaySele").selectedIndex=1;
        }
        //ほかの場合なら
        else
        {    
            //出発日のselectエレメントを再設定する。（例　21日 ---> 22日）
            document.getElementById("CalendarOneCalDaySele").selectedIndex=(i+1);
        }
        //画面はajaxで更新する
        updatePage();
    }
}

//flash「<<」ボタンをクリックするイベント
function flashLeftMove()
{
    //在庫カレンダー「＜＜」部分が表示されているかどうか判断する変数を取る
    var leftArrowId=document.getElementById("calendarLeftHidden").value;    
    var leftArrowValue=document.getElementById(leftArrowId).value; 
    //在庫カレンダー「＜＜」部分が表示されていない時
    if(leftArrowValue=="0")
    {
        //flash用のカウントを取る
        var tempcnt=document.getElementById("flashCnt").value;
        //flash用のカウント-1
        var temp=(parseInt(tempcnt,10)-1);
        //flash用のカウントを改めて設定する。
        document.getElementById("flashCnt").value=""+temp;
        //flash更新する。
        updateFlashUrl();
    }
    //在庫カレンダー「＜＜」部分が表示されている時
    else if(leftArrowValue=="1")
    {
        //在庫カレンダー「＜＜」をクリックする時使うファクションを行う
        clickAllLeft();
    }
}

//flash「>>」ボタンをクリックするイベント
function flashRightMove()
{
    //在庫カレンダー「>>」部分が表示されているかどうか判断する変数を取る
    var rightArrowId=document.getElementById("calendarRightHidden").value;    
    var rightArrowValue=document.getElementById(rightArrowId).value; 
    //在庫カレンダー「>>」部分が表示されていない時
    if(rightArrowValue=="0")
    {
        //flash用のカウントを取る
        var tempcnt=document.getElementById("flashCnt").value;
        //flash用のカウント+1
        var temp=(parseInt(tempcnt,10)+1);
        //flash用のカウントを改めて設定する。
        document.getElementById("flashCnt").value=""+temp;
        //flash更新する。
        updateFlashUrl();
    }
    //在庫カレンダー「>>」部分が表示されている時
    else if(rightArrowValue=="1")
    {
        //在庫カレンダー「＜＜」をクリックする時使うファクションを行う
        clickAllRight();
    }
}

//flashを更新するファクション
function updateFlashUrl()
{
    //画面すべての条件の値を取る。
    var pageValues=getValus();
    //検索結果画面なら
    if($get("conditionMode").value=="2")
    {
        //キーワードが存在する時
        if(document.getElementById("FreeWordHidden"))
        {
            //キーワードの値を条件の値を後に加える。
            pageValues=pageValues+"$FreeWord:"+document.getElementById("FreeWordHidden").value;
        }
    }
    //Websrviceを呼び出す、更新用のURLを作成する。
    FlashWebService.GetFlashUrl(pageValues,document.getElementById("flashCnt").value,updateFlashUrlSucceeded,onFailed);
}

//flashを更新のWebsrviceを成功して後行うファクション
function updateFlashUrlSucceeded(result)
{
    //---(2009/04/03 保守タスク0028 Start1)---//
    //flashの[<<]は表示させない時
    if(result["arrowLeft"]=="0")
    {
        //flashの[<<]表示部分を隠す
        //changeArea('flashLeftArrowSpan','none');
        //changeArea('flashLeftArrowSpanNbsp','block');
    }
    //flashの[<<]は表示させる時
    else if(result["arrowLeft"]=="1")
    {
        //flashの[<<]表示部分を表示させる
        //changeArea('flashLeftArrowSpan','block');
        //changeArea('flashLeftArrowSpanNbsp','none');
    }
    //flashの[>>]は表示させない時
    if(result["arrowRight"]=="0")
    {
        //flashの[>>]表示部分を隠す
        //changeArea('flashRightArrowSpan','none');
        //changeArea('flashRightArrowSpanNbsp','block');
    }
    //flashの[>>]は表示させる時
    else if(result["arrowRight"]=="1")
    {
        //flashの[>>]表示部分を表示させる
        //changeArea('flashRightArrowSpan','block');
        //changeArea('flashRightArrowSpanNbsp','none');
    }
    //flashを更新するURLを作成する。
    var urlsrc=""+document.getElementById("clientUrl").value+"/"+result["flashURL"];
    //IEなら。
    if($.browser.msie)
    {
        //flashを更新する。
        //window.Frame1.location.replace(urlsrc);
    } 
    //firefoxの場合なら。
    else if($.browser.mozilla )
    {
        //flashを更新する。
        //document.getElementById("Frame1").contentWindow.location.replace(urlsrc);
    }
    //---(2009/04/03 保守タスク0028 End1)---//
}