function emailDialog(id, lang)	{
    var myURL = new String(window.location);
    var myResult = myURL.indexOf("Module.aspx");
    var myResult2 = myURL.indexOf("icalendar.esolutionsgroup.ca");
    if (lang == '')
    {
        lang = 'en';
    }
    if (myResult == -1 && myResult2 == -1) {
        window.open("/" + lang + "/email/emailattachment.aspx?id=" + id + "&ref=" + document.location.href, "_blank", "width=625px, height=620px, edge=Raised, center=Yes, help=No, resizable=no, status=No, scrollbars=Yes");
    }
    else {
        alert("Sorry, email is disabled within iCaledar or iBlog generated pages");
    }
};


function mailTo() {

    var str = document.location.href;
    var lang = "/en/";

    if (str.indexOf("/fr/") >= 0)
        lang = "/fr/";

    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=450,status=yes,menubar=no,location=no,resizable=yes");
        }
    }
    else {
        alert("Your browser is not capable of performing this operation!");
    }
};
