//
function Shouto() 
{
    this.targetURL = null;
    this.targetID = null;
    this.strValue = null;
    this.pollInterval = null;
    this.timeoutThreshold = null;
    this.ajax = new DAX();
    this.pollHand = null;
    this.timeoutHand = null;

    this.init = function()
    {
        this.doPoll();
    };

    this.doPoll = function()
    {
        var url = this.targetURL;
        this.ajax.doGet(this.targetURL, this.showPoll);
        this.timeoutHand = setTimeout(this.handleTimeout, this.timeoutThreshold*1000);
    };

    this.showPoll = function(str)
    {
        this.strValue = str;
        clearTimeout(this.pollHand);
        clearTimeout(this.timeoutHand);
        _printResult(this.strValue);
        doPollDelay();
    };

    this.doPollDelay = function()
    {
        this.pollHand = setTimeout(this.doPoll, this.pollInterval*1000);
    };

    this.stopPoll = function()
    {
        clearTimeout(this.pollHand);
        clearTimeout(this.timeoutHand);
    };

    this.handleTimeout = function()
    {
        _printResult(this.strValue);
        this.doPollDelay();
        //alert('+');
    };

    var _printResult = function()
    {
        alert(this.targetID);
        DAXPrintResult(this.targetID, this.strValue);
        DAXEval(this.strValue);
        //alert('p2');
    };

}

