﻿function xMailInlineForm() {
    ok = true;
    query = "?mailtotype=externalform";
    try { query += "&mailto=" + document.getElementById("ewayEmailRecipient").value; } catch (err) { ok = false; };
    try { query += "&mailfromname=" + encodeURIComponent(document.getElementById("ewayEmailSenderName").value); } catch (err) { }
    try { query += "&mailfrom=" + document.getElementById("ewayEmailSenderEmail").value; } catch (err) { ok = false; }
    try { query += "&subject=" + encodeURIComponent(document.getElementById("ewayEmailSubject").value); } catch (err) { }
    try { query += "&message=" + encodeURIComponent(document.getElementById("ewayEmailMessage").value); } catch (err) { ok = false; }
    try { query += "&langmodule=" + document.getElementById("eWayExtras").value; } catch (err) { ok = false; }
    try { query += "&langid=" + document.getElementById("ewayEmailLangID").value; } catch (err) { ok = false; }
    if (ok == true) {
        window.open('/eway/Custom/Code/modules/email/mailto.aspx' + query, 'ewayMailToWin', 'status=0,toolbar=0,location=0,menubar=0,directories=0,resizeable=0,scrollbars=0,width=300,height=150');
    }
    else {
        alert("Feil: Mangler avsenders epostaddresse eller melding.");
    }
}
function xMailToDesignated(langid, recipient) {
    myUrl = encodeURIComponent(document.location);
    window.open('/eway/custom/code/modules/email/default.aspx?mailtotype=designated&mailto=' + encodeURIComponent(recipient) + '&subject=' + encodeURIComponent(document.title) + '&reflink=' + myUrl + '&langmodule=eWayExtras&langid=' + langid + '&requireslogin=1', 'TipsEnVenn', 'status=0,toolbar=0,location=0,menubar=0,directories=0,resizeable=0,scrollbars=0,width=650,height=560');
}
function xTipAFriend(langid) {
    myUrl = encodeURIComponent(document.location);
    window.open('/eway/custom/code/modules/email/default.aspx?mailtotype=tipafriend&subject=' + encodeURIComponent(document.title) + '&reflink=' + myUrl + '&langmodule=eWayExtras&langid=' + langid + '&requireslogin=1', 'TipsEnVenn', 'status=0,toolbar=0,location=0,menubar=0,directories=0,resizeable=0,scrollbars=0,width=650,height=680');
}
/* 
-------------------------------------------------------------------------------------
Custom
-------------------------------------------------------------------------------------
*/
function xIdunTilbudsbestilling(langid, recipient) {
    myUrl = encodeURIComponent(document.location);
    window.open('/eway/custom/code/modules/email/default.aspx?mailtotype=iduntilbudsbestilling&mailto=' + encodeURIComponent(recipient) + '&subject=' + encodeURIComponent(document.title) + '&reflink=' + myUrl + '&langmodule=xEmailModule&langid=' + langid + '&requireslogin=1', 'Tilbudsbestilling', 'status=0,toolbar=0,location=0,menubar=0,directories=0,resizeable=0,scrollbars=0,width=650,height=560');
}
function xIdunKursPaamelding(langid, recipient, subject) {
    myUrl = encodeURIComponent(document.location);
    window.open('/eway/custom/code/modules/email/default.aspx?mailtotype=idunkurspaamelding&mailto=' + encodeURIComponent(recipient) + '&subject=' + encodeURIComponent(subject) + '&reflink=' + myUrl + '&langmodule=xEmailModule&langid=' + langid + '&requireslogin=1', 'Tilbudsbestilling', 'status=0,toolbar=0,location=0,menubar=0,directories=0,resizeable=0,scrollbars=0,width=650,height=620');
}
function xIdunContact(langid, recipient) {
    myUrl = encodeURIComponent(document.location);
    window.open('/eway/custom/code/modules/email/default.aspx?mailtotype=iduncontact&mailto=' + encodeURIComponent(recipient) + '&subject=' + encodeURIComponent(document.title) + '&reflink=' + myUrl + '&langmodule=xEmailModule&langid=' + langid + '&requireslogin=1', 'Tilbudsbestilling', 'status=0,toolbar=0,location=0,menubar=0,directories=0,resizeable=0,scrollbars=0,width=650,height=560');
}
