﻿/*global window, document, Event */

"use strict";

var EMAIL = {

	emailPage: {
		mailWindow: null,

		RootPath: '/Content/MailPage/',

		emailPage: function () {
			var sURL =
				this.RootPath +
				'Window-MailPage.asp' +
				'?URL=' + encodeURIComponent(document.location.href) +
				'&Title=' + encodeURIComponent(document.title);

			this.mailWindow =
				window.open(sURL, 'EmailPage',
				'height=575,width=500,toolbar=no,' +
				'scrollbars=yes,resizable=yes');

			if (this.mailWindow !== null) {
				this.mailWindow.Scope = this;
			} else {
				window.alert(
					'Your popup blocker has prevented us from opening a ' +
					'new window.\nPlease disable your popup blocker and ' +
					'try again.');
			}
		},

		closeEmail: function () {
			if (this.mailWindow !== null) {
				this.mailWindow.close();
			}
		}
	}
};
Event.onDOMReady(EMAIL.emailPage, EMAIL, true);
