function emailDialog(id, lang) {
    var myURL = new String(window.location);
    if (myURL.indexOf("Module.aspx") == -1 && myURL.indexOf("icalendar.esolutionsgroup.ca") == -1) {
        window.open(getCorpHome() + lang + "/email/emailattachment.aspx?id=" + id + "&ref=" + document.location.href, "_blank", "width=625px, height=600px, edge=Raised, center=Yes, help=No, resizable=no, status=No, scrollbars=Yes");
    }
    else {
        alert("Sorry, email is disabled within iCalendar or iBlog generated pages");
    }
}

function emailContact(contactId, lang) {
    var myURL = new String(window.location);
    if (myURL.indexOf("Module.aspx") == -1 && myURL.indexOf("icalendar.esolutionsgroup.ca") == -1) {
        window.open(getCorpHome() + lang + "/email/emailattachment.aspx?contactId=" + contactId + "&ref=" + document.location.href, "_blank", "width=625px, height=620px, edge=Raised, center=Yes, help=No, resizable=no, status=No");
    }
    else {
        alert("Sorry, email is disabled within iCalendar or iBlog generated pages");
    }
}

function mailTo() {

    var str = document.location.href;
    var lang = "/fr/";

    if (str.indexOf("/en/") >= 0)
        lang = "/en/";

    if (document.getElementById != null) {
        var obj = document.getElementById('printAreaContent');
        if (obj != null) {
            var content = "";
            if (document.getElementsByTagName != null) {
                var obj_head = document.getElementsByTagName('head');
                if (obj_head != null) {
                    content += obj_head[0].innerHTML;
                }
            }
            content += "\n<body style='background-color: #fff;'><div id='searchResults'><table cellpadding='8' cellspacing='0' border='0' width='100%'><tr><td>" + obj.innerHTML + "</td></tr></table></div></body>";
            document.forms['frmMailTo'].hdnContent.value = content;
            var newWin = window.open(getCorpHome() + lang + 'email/mailto.aspx', "MailTo", "width=600,height=440,status=yes,menubar=no,location=no,resizable=yes");
        }
    }
    else {
        alert("You're browser is not capable of performing this operation!");
    }
}
