function writit(text, id) {
    if (document.getElementById)
    {
        x = document.getElementById(id);
        x.innerHTML = '';
        x.innerHTML = text;
    }
    else if (document.all)
    {
        x = document.all[id];
        x.innerHTML = text;
    }
    else if (document.layers)
    {
        x = document.layers[id];
        text2 = text;
        x.document.open();
        x.document.write(text2);
        x.document.close();
    }
}

function GetInputField(theform, theid) {

    thestr = "document.getElementById('" + theform + "')." + theid + ".value";
    val    = eval(thestr);
    return val;
}

function CheckInp() {

    theemail = GetInputField('downloaddemo', 'ddemail');
    lcase = theemail.toLowerCase();

    if( theemail.search('@') == -1 ) {       // Not found.   
        writit("Please provide a correct email address.", "ddmessage");
        return;
    }    

    if( theemail.search(/\./) == -1 ) {      // Not found.   
        writit("Please provide a correct email address.", "ddmessage");
        return;
    }    

    if( theemail.search(' ') != -1 ) {       // Found.   
        writit("There's a space in your email address.<br>Please provide a correct email address.", "ddmessage");
        return;
    }    
    
    if( lcase.search('spam') != -1 ) {       // Found   
        ms =  "The email address you provided seems to be used to catch spam message only.<br>";
        ms += "Please provide a true email address. We are NOT going to send you spam and<br>";
        ms += "we guarantee that your email address isn't shared with anyone else.<br>";
        ms += "You may quit the newsletter mailing list when you have received the first newsletter.<br><br>";
        ms += "Please provide another email address.";
        writit(ms, "ddmessage");
        return;
    }    

    if( lcase.search('mhc@') != -1 ) {       // Found   
        ms =  "The email address you provided seems to be used to catch spam message only.<br>";
        ms += "Please provide a true email address. We are NOT going to send you spam and<br>";
        ms += "we guarantee that your email address isn't shared with anyone else.<br>";
        ms += "You may quit the newsletter mailing list when you have received the first newsletter.<br><br>";
        ms += "Please provide another email address.";
        writit(ms, "ddmessage");
        return;
    }    

    // Temp/spam mail accounts.
    // 
    if( lcase.search('mailinator') != -1     || lcase.search('guerrillamail') != -1 || 
        lcase.search('temporaryinbox') != -1 || lcase.search('mailexpire') != -1 || 
        lcase.search('trashymail') != -1     || lcase.search('dodgeit') != -1 || 
        lcase.search('bugmenot') != -1       || lcase.search('jetable') != -1 || 
        lcase.search('dontreg') != -1        || lcase.search('pookmail') != -1 || 
        lcase.search('10minutemail') != -1   || lcase.search('enterto') != -1 || 
        lcase.search('e4ward') != -1         || lcase.search('gishpuppy') != -1 || 
        lcase.search('ipoo') != -1           || lcase.search('mailmoat') != -1 || 
        lcase.search('netmails') != -1       || lcase.search('2prong') != -1 || 
        lcase.search('sneakemail') != -1     || lcase.search('spamgourmet') != -1 || 
        lcase.search('spambob') != -1        || lcase.search('spamex') != -1 || 
        lcase.search('spaml') != -1          || lcase.search('tempinbox') != -1 ) {         
        ms =  "The email address you provided seems to be used to catch spam message only.<br>";
        ms += "Please provide a true email address. We are NOT going to send you spam and<br>";
        ms += "we guarantee that your email address isn't shared with anyone else.<br>";
        ms += "You may quit the newsletter mailing list when you have received the first newsletter.<br><br>";
        ms += "Please provide another email address.";
        writit(ms, "ddmessage");
        return;
    }    

    
    window.location.href = "http://www.mhc.se/software/plugins/downloaddemoemail.php?ddemail=" + theemail; 
}  

