﻿ 
    function dge(e) {
    
        return document.getElementById(e);
    
    }

    function SMLGenCallBack(result) {

    if (result && result.value) {
        var ti = dge('timerImage');
        if (ti) {
            ti.style.display = 'none';
        }

        var smartLink = dge('smartLink');
        if (smartLink) {

            resultTable.style.display = 'block';
            if (result.value.indexOf('http://') < 0) {
                smartLink.style.color = 'red';
            } else {
                try {
                    smartLink.select();
                    smartLink.focus();
                    bottom.focus();
                }
                catch (ex) {
                }
            }
            smartLink.value = result.value;
            try {
                smartLink.scrollIntoView(false);
                bottom.scrollIntoView(false);
            }
            catch (ex) {
            }

        }
    }
}

function SMLGen() {

    resultTable.style.display = 'none';

    var ti = dge('timerImage');
    var url = dge('url');
    var email = dge('email');
    var accept = dge('accept');

    if (url && email && accept && ti) {
        ti.style.display = 'block';
        
        AjaxPro.timeoutPeriod = 120000;
        SmartLink._Default.SMLGen(url.value, email.value, accept.checked, SMLGenCallBack);
    }

}        

