﻿    function SendEmail(To,
                        CC,
                        Subject,                              
                        Comments)
{
	var theApp;	//Reference to Outlook.Application 
	var theMailItem;	//Outlook.mailItem
    //Attach Files to the email

    //Construct the Email including To(address),subject,body
    //var recipient
 
    var msg = "<html xmlns:v=\'urn:schemas-microsoft-com:vml\'";
        msg += "xmlns:o=\'urn:schemas-microsoft-com:office:office\' ";
        msg += "xmlns:w=\'urn:schemas-microsoft-com:office:word\' ";
        msg += "xmlns:x=\'urn:schemas-microsoft-com:office:excel\' ";
        msg += "xmlns:p=\'urn:schemas-microsoft-com:office:powerpoint\' ";
        msg += "xmlns:a=\'urn:schemas-microsoft-com:office:access\' ";
        msg += "xmlns:dt=\'uuid:C2F41010-65B3-11d1-A29F-00AA00C14882\' ";
        msg += "xmlns:s=\'uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882\' ";
        msg += "xmlns:rs=\'urn:schemas-microsoft-com:rowset\' ";
        msg += "xmlns:z=\'#RowsetSchema\' ";
        msg += "xmlns:b=\'urn:schemas-microsoft-com:office:publisher\' ";
        msg += "xmlns:ss=\'urn:schemas-microsoft-com:office:spreadsheet\' ";
        msg += "xmlns:c=\'urn:schemas-microsoft-com:office:component:spreadsheet\' ";
        msg += "xmlns:odc=\'urn:schemas-microsoft-com:office:odc\' ";
        msg += "xmlns:oa=\'urn:schemas-microsoft-com:office:activation\' ";
        msg += "xmlns:html=\'http://www.w3.org/TR/REC-html40\' ";
        msg += "xmlns:q=\'http://schemas.xmlsoap.org/soap/envelope/\' ";
        msg += "xmlns:rtc=\'http://microsoft.com/officenet/conferencing\' ";
        msg += "xmlns:D=\'DAV:\' ";
        msg += "xmlns:Repl=\'http://schemas.microsoft.com/repl/\' ";
        msg += "xmlns:mt=\'http://schemas.microsoft.com/sharepoint/soap/meetings/\' ";
        msg += "xmlns:x2=\'http://schemas.microsoft.com/office/excel/2003/xml\' ";
        msg += "xmlns:ppda=\'http://www.passport.com/NameSpace.xsd\' ";
        msg += "xmlns:ois=\'http://schemas.microsoft.com/sharepoint/soap/ois/\' ";
        msg += "xmlns:dir=\'http://schemas.microsoft.com/sharepoint/soap/directory/\' ";
        msg += "xmlns:ds=\'http://www.w3.org/2000/09/xmldsig#\' ";
        msg += "xmlns:dsp=\'http://schemas.microsoft.com/sharepoint/dsp\' ";
        msg += "xmlns:udc=\'http://schemas.microsoft.com/data/udc\' ";
        msg += "xmlns:xsd=\'http://www.w3.org/2001/XMLSchema\'";
        msg += "xmlns:sub=\'http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/\' ";
        msg += "xmlns:ec=\'http://www.w3.org/2001/04/xmlenc#\' ";
        msg += "xmlns:sp=\'http://schemas.microsoft.com/sharepoint/\' ";
        msg += "xmlns:sps=\'http://schemas.microsoft.com/sharepoint/soap/\' ";
        msg += "xmlns:xsi=\'http://www.w3.org/2001/XMLSchema-instance\' ";
        msg += "xmlns:udcs=\'http://schemas.microsoft.com/data/udc/soap\' ";
        msg += "xmlns:udcxf=\'http://schemas.microsoft.com/data/udc/xmlfile\' ";
        msg += "xmlns:udcp2p=\'http://schemas.microsoft.com/data/udc/parttopart\' ";
        msg += "xmlns:wf=\'http://schemas.microsoft.com/sharepoint/soap/workflow/\' ";
        msg += "xmlns:dsss=\'http://schemas.microsoft.com/office/2006/digsig-setup\' ";
        msg += "xmlns:dssi=\'http://schemas.microsoft.com/office/2006/digsig\' ";
        msg += "xmlns:mdssi=\'http://schemas.openxmlformats.org/package/2006/digital-signature\' ";
        msg += "xmlns:mver=\'http://schemas.openxmlformats.org/markup-compatibility/2006\' ";
        msg += "xmlns:m=\'http://schemas.microsoft.com/office/2004/12/omml\' ";
        msg += "xmlns:mrels=\'http://schemas.openxmlformats.org/package/2006/relationships\' ";
        msg += "xmlns:spwp=\'http://microsoft.com/sharepoint/webpartpages\' ";
        msg += "xmlns:ex12t=\'http://schemas.microsoft.com/exchange/services/2006/types\' ";
        msg += "xmlns:ex12m=\'http://schemas.microsoft.com/exchange/services/2006/messages\'" ;
        msg += "xmlns:pptsl=\'http://schemas.microsoft.com/sharepoint/soap/SlideLibrary/\' ";
        msg += "xmlns:spsl=\'http://microsoft.com/webservices/SharePointPortalServer/PublishedLinksService\' ";
        msg += "xmlns:Z=\'urn:schemas-microsoft-com:\' ";
        msg += "xmlns:st=\'&#1;\' ";
        msg += "xmlns=\'http://www.w3.org/TR/REC-html40\'>";
        msg += "<head>";
        msg += "<meta http-equiv=Content-Type content=\'text/html; charset=us-ascii\'>";
        msg += "<meta name=Generator content=\'Microsoft Word 12 (filtered medium)\'>";
        msg += "<!--[if !mso]>";
        msg += "<style>";
        msg += "v\:* {behavior:url(#default#VML);}";
        msg += "o\:* {behavior:url(#default#VML);}";
        msg += "w\:* {behavior:url(#default#VML);}";
        msg += ".shape {behavior:url(#default#VML);}";
        msg += "</style>";
        msg += "<![endif]-->";
        msg += "<style>";
        msg += "<!--";
        msg += "/* Font Definitions */";
        msg += "@font-face";
        msg += "{font-family:\'Cambria Math\';";
        msg += "panose-1:2 4 5 3 5 4 6 3 2 4;}";
        msg += "@font-face";
        msg += "{font-family:Calibri;";
        msg += "panose-1:2 15 5 2 2 2 4 3 2 4;}";
        msg += "@font-face";
        msg += "{font-family:Tahoma;";
        msg += "panose-1:2 11 6 4 3 5 4 4 2 4;}";
        msg += "@font-face";
        msg += "{font-family:Verdana;";
        msg += "panose-1:2 11 6 4 3 5 4 4 2 4;}";
        msg += "/* Style Definitions */";
        msg += "p.MsoNormal, li.MsoNormal, div.MsoNormal";
        msg += "{margin:0in;";
        msg += "margin-bottom:.0001pt;";
        msg += "font-size:11.0pt;";
        msg += "font-family:\'Calibri\',\'sans-serif\';}";
        msg += "a:link, span.MsoHyperlink";
        msg += "{mso-style-priority:99;";
        msg += "color:blue;";
        msg += "text-decoration:underline;}";
        msg += "a:visited, span.MsoHyperlinkFollowed";
        msg += "{mso-style-priority:99;";
        msg += "color:purple;";
        msg += "text-decoration:underline;}";
        msg += "p.MsoAcetate, li.MsoAcetate, div.MsoAcetate";
        msg += "{mso-style-priority:99;";
        msg += "mso-style-link:\'Balloon Text Char\';";
        msg += "margin:0in;";
        msg += "margin-bottom:.0001pt;";
        msg += "font-size:8.0pt;";
        msg += "font-family:\'Tahoma\',\'sans-serif\';}";
        msg += "span.EmailStyle17";
        msg += "{mso-style-type:personal-compose;";
        msg += "font-family:\'Times New Roman\',\'serif\';}";
        msg += "span.BalloonTextChar";
        msg += "{mso-style-name:\'Balloon Text Char\';";
        msg += "mso-style-priority:99;";
        msg += "mso-style-link:\'Balloon Text\';";
        msg += "font-family:\'Tahoma\',\'sans-serif\';}";
        msg += ".MsoChpDefault";
        msg += "{mso-style-type:export-only;}";
        msg += "@page Section1";
        msg += "{size:8.5in 11.0in;";
        msg += "margin:1.0in 1.0in 1.0in 1.0in;}";
        msg += "div.Section1";
        msg += "{page:Section1;}";
        msg += "-->";
        msg += "</style>";
        msg += "<!--[if gte mso 9]><xml>";
        msg += "<o:shapedefaults v:ext=\'edit\' spidmax=\'2050\' />";
        msg += "</xml><![endif]--><!--[if gte mso 9]><xml>";
        msg += "<o:shapelayout v:ext=\'edit\'>";
        msg += "<o:idmap v:ext=\'edit\' data=\'1\' />";
        msg += "</o:shapelayout></xml><![endif]-->";
        msg += "</head>";
        msg += "<body lang=EN-US link=blue vlink=purple>";
        msg += "<div class=Section1>"; 
        msg += "<p class=MsoNormal>" + Comments + "<o:p></o:p></p>";
        msg += "<p class=MsoNormal><span style='font-size:12.0pt;font-family:\'Times New Roman\',\'serif\''><o:p>&nbsp;</o:p></span></p>";
        msg += "<p class=MsoNormal><span style='font-size:12.0pt;font-family:\'Times New Roman\',\'serif\''><o:p>&nbsp;</o:p></span></p>";
        msg += "<p class=MsoNormal><span style='font-size:10.0pt;font-family:\'Arial\',\'sans-serif\';";
        msg += "color:#353535'>Regards,</span><b><span lang=EN-AU style='font-family:\'Verdana\',\'sans-serif\''><o:p></o:p></span></b></p>";
        msg += "<p class=MsoNormal><b><span lang=EN-AU style='font-family:\'Verdana\',\'sans-serif\''>";
        msg += "<%=GetUserFullName(JMSMembershipProvider.GetUserID()) %>";
        msg += "</span></b><span lang=EN-AU><o:p></o:p></span></p>";
        msg += "</div>";
        msg += "</body>";
        msg += "</html>";
    //Create a object of Outlook.Application
   
    try
    {
        var theApp = new ActiveXObject("Outlook.Application");            
	    var theMailItem = theApp.CreateItem(0); // value 0 = MailItem
	    //Bind the variables with the email
	    theMailItem.to = To;
	    theMailItem.CC = CC;
	    theMailItem.Subject = (Subject);
	    theMailItem.HTMLBody = msg;
	    theMailItem.display();
	
	}
    catch(err)
    {
        alert(err);
    }
    return false;
}


