﻿
/*
* Funktion zum Holen der Daten für die ModalBox per AJAX und  
* Anzeigen der ModalBox
*/
function OpenModalBox(modalBoxUrl, title, modalBoxId) {
    $.get(modalBoxUrl, function (data) {
        $('#mainModalBox #mainModalContent').html(data);
        $('#mainModalBox .titleModalBoxMiddleText').html(URLDecode(title));
        $('#mainModalBox').modal({ overlayClose: true, closeClass: "modalCloseImg" });
    });
}

// This function decodes the any string
// that's been encoded using URL encoding technique
function URLDecode(psEncodeString) {
    // Create a regular expression to search all +s in the string
    var lsRegExp = /\+/g;
    // Return the decoded string
    return unescape(String(psEncodeString).replace(lsRegExp, " "));
} 


function InitButtons(sender, args) {
    $('.btnSubmit').click(function () {
        //
        var receiver = 1;
        if ($('#rbtnSandoz:checked') != null) { receiver = 2; }
        var msg = $('#message').val();
        var name = $('#senderName').val();
        var company = $('#senderCompany').val();
        var eMail = $('#senderEmail').val();

        $.get(
                    '/Pages/MailSend.aspx',
                    { receiver: receiver, message: msg, senderName: name, senderCompany: company, senderEMail: eMail },
                    function (data) {
                        $('#contactForm').attr('style', 'display:none');
                        $('#confirmation').attr('style', 'display:block');
                    });
    });
}
