/* lists_hijacks.js */

var preferencesURI = '?p=preferences&uid=';
var unsubscribeURI = '?p=unsubscribe&';
var subscribeComfirmURI = '?p=subscribe&submitted=1';
var confirmURI = '?p=confirm&';

function hide_default_subscribe_form() {
    if ($('form').length > 0 ) {        
        if ( $('div#error-user-exists').length > 0 ) {
            var msg = $('div#error-user-exists').html();
            var new_html = '<p><b>' + msg + '</b></p>';
            new_html += '<p><b>To return to the subscription form, <a href="index.php">click here</a></b></p><br />';
            new_html += '<span class="poweredphplist">powered by <a target="_blank" class="poweredphplist" href="http://www.phplist.com">phplist</a> v 2.10.10, &copy; <a class="poweredphplist" target="_blank" href="http://tincan.co.uk/powered">tincan ltd</a></span>';
            $('div#content_padding').html(new_html);
        }
        else if ( $('form').length > 0 ) {
            $('div#content_padding').html('<b>Redirecting you to the subscription form...</b>');
            window.location = 'index.php';
        }
    }
    else {
        setTimeout('hide_default_subscribe_form()', 25);
    }
}

if (location.href.substring(location.href.indexOf(subscribeComfirmURI)).length == subscribeComfirmURI.length) {
    hide_default_subscribe_form();
}

