function onRegistrationSuccess(responseText, statusText) {
    if (statusText == 'success') {
        if (typeof responseText == 'string') {
            responseText = responseText.replace('<br />', ' ');
            responseText = responseText.replace('<a href="javascript:window.location.reload()">Click here</a> to try again.', '');
            $('#nl-reg-status').html('Thank you!');
        } else {
            $('#nl-reg-status').html('You have been successfully registered for updates from mediabistro.com. Thank you!');
        }
        $('#nl-reg-status').show();
    } else {
        alert('An error occurred during the newsletter registration.');
    }
}

function summitNewsletterRegistration() {
    $('#newsletter-reg-form').ajaxSubmit({
        url: '/memberscenter/quick_mail_register.asp',
        type: 'post',
        dataType: null,
        success: onRegistrationSuccess
    });
}

var maxTimer = 0;
checkSiteChannel();

function checkSiteChannel() {
    if (typeof s_channel != 'undefined') {
        if (document.getElementById('lisch'))
            document.getElementById('lisch').value = s_channel;
    } else {
        maxTimer += 1000;
        if (maxTimer < 15000) //15 seconds
            window.setTimeout("checkSiteChannel();",1000);
    }
}
