//  sampling.js
//  Last Update:2008.08.11
//
//	History
//		2018.12.xx N.Watanabe alertおよびconfimの代替対応
//                                      alertをmyAlertに置き換え 

// Check Input
function fncCheckInputAutoSkip(){
    var wResult = fncCheckRadioSelect();
    if( wResult )
        wResult = fncCheckInputNumberValue('txtGetCount', false, false);
    if( wResult )
        fncShowWait();
    return wResult;
}
function fncCheckInputNextStart(){
    var wResult = fncCheckRadioSelect();
    if( wResult )
        wResult = fncCheckInputNumberValue('txtGetCount', false, false);
    if( wResult )
        wResult = fncCheckInputNumberValue('txtGetSkip', false, false);
    if( wResult )
        wResult = fncCheckInputNumberValue('txtGetStart', false, false);
    if( wResult )
        fncShowWait();
    return wResult;
}
function fncCheckInputSearch(){
    var wResult = fncCheckRadioSelect();
    if( wResult ){
        var wAllShow = false;
        try{
            wAllShow = document.getElementById('chkAllShow').checked;
        }catch(ex){
            myAlert('入力確認ができません。');
            wResult = false;
        }
        if( !wAllShow ){
            if( wResult )
                wResult = fncCheckInputNumberValue('txtGetCount', false, false);
            if( wResult )
                wResult = fncCheckInputNumberValue('txtGetSkip', false, false);
            if( wResult )
                wResult = fncCheckInputNumberValue('txtGetStart', false, false);
        }
    }
    if( wResult )
        fncShowWait();
    return wResult;
}
function fncCheckRadioSelect(){
    var wResult = true;
    try{
        var wRadio1 = document.getElementById('rdoSexAll').checked;
        var wRadio2 = document.getElementById('rdoSexOnlyM').checked;
        var wRadio3 = document.getElementById('rdoSexOnlyF').checked;
        wResult = (wRadio1 || wRadio2 || wRadio3)
        if( !wResult )
            myAlert('性別が選択されていません。');
    }catch(ex){
        myAlert('入力確認ができません。');
        wResult = false;
    }
    return wResult;
}

// Check All Show
function fncInitializeAllShow(){
    var wObj = document.getElementById('chkAllShow');
    if( wObj ){
        fncSetCountEnabled(wObj);
        wObj.onclick = function(){fncSetCountEnabled(this);};
    }
}
function fncSetCountEnabled( objAllShow ){
    if( objAllShow ){
        try{
            var wChecked = objAllShow.checked;
            var wDList = document.getElementById('dlInputCount');
            var wInputs = wDList.getElementsByTagName('input');
            for( var ix = 0; ix < wInputs.length; ix ++ ){
                var wFlagText = (wInputs[ix].className.indexOf('cssTextBox') >= 0);
                var wFlagButton = (wInputs[ix].className.indexOf('cssButton') >= 0);
                if( wFlagText )
                    wInputs[ix].readOnly = wChecked;
                if( wFlagButton )
                    wInputs[ix].disabled = wChecked;
                if( wFlagText || wFlagButton )
                    wInputs[ix].className = fncGetDisabledClass(wInputs[ix].className, wChecked);
            }
        }catch(ex){
        }
    }
}

// File Out Put
function fncShowWaitOutPut(){
    fncShowWait();
    var wSec = 500;
    var wObj = document.getElementById('sprList');
    if( wObj )
        wSec = wObj.GetRowCount() * 6 + 100;
    window.setTimeout("fncHideWait()", wSec);
}

// Load Event
function window.onload(){
    fncInitializeInputNumber();
    fncInitializeInputCode();
    fncInitializeInputDate();
    fncInitializeList();
    fncInitializeMove();
    fncListScrollSet();
    fncInitializeAllShow();
    fncShowMessage();
}

// All Timer Stop
function document.onmouseup(){
    fncStopInput();
    fncMoveStop();
}
