//==============================================================================================================================
// ZeekMailer
// This utility is for mailing from a browser.  It dynamically constructs the email with recipient and email body.
// This utility helps obscure the email from spiders that might snatch emails for marketing purposes.
//
//
//
//==============================================================================================================================


//-----------------------------------------------------------------------------------------------------
// Formally declare the DIConstants namespace object.
//-----------------------------------------------------------------------------------------------------
if (typeof ZeekMailer != "object") {
	ZeekMailer = new Object(); 
}


//----------------------------------------------------------------------------------------------------------------------------------------
// SET MAIL CONFIGURATION CONSTANTS
//	These settings configure the ZeekMailer browser object with the site-specific settings for configuring email.
//----------------------------------------------------------------------------------------------------------------------------------------
ZeekMailer.setMailConfig = function() {
	ZeekMailer.subject = "Interested in Castle Zeek Systems services";
	ZeekMailer.recipient = "castlezeek@castlezeek.com";	
	ZeekMailer.sender = "Castle Zeek Systems";
	ZeekMailer.proto = "mailto";
	ZeekMailer.emailBody = "Thank You for your interest in Castle Zeek Systems.  Please send us an email with your questions.";
};



ZeekMailer.getEmail = function() {
	try {
		return ZeekMailer.proto + ":" + ZeekMailer.recipient + "?subject=" + ZeekMailer.subject + "&body=" + ZeekMailer.emailBody;
	} catch(errNbr) {
		switch (errNbr) {
			case -1: alert("(-1): getEmail(): Foo Err."); break;
			default: alert("(DfltErr): getEmail(): \n" + errNbr); break;
	 	}
    }
};



//==== e.m.s. "Email Spoof"
ZeekMailer.ems = function(tagRef) {
	try {
		if (tagRef===null || tagRef==="") { throw -1; }
		tagRef.href = ZeekMailer.getEmail();
	} catch(errNbr) {
		switch (errNbr) {
			case -1: alert("(-1): ems(): The tabRef arg is null."); break;
			default: alert("(DfltErr): ems(): \n" + errNbr); break;
	 	}
    }
};
