﻿// PRINT CONTROL HANDLER
// Javascript Print Function for Print This Page links
function printdoc() {
	window.print();
}

// EMAIL SCRAPING PREVENTION
// Protect Inline Email Addresses from Scraping
function sendMailTo(name, company, domain) {
    locationstring = "mai" + "lto:" + name + "@" + company + "." + domain;
    window.location.replace(locationstring);
}

// ENHANCED MAIL WITH SCRAPING PREVENTION
// Protects Inline Email Addresses from Scraping, with subject & body included
function sendEnhancedMailTo(name, company, domain, subject, body) {
	locationstring = "mai" + "lto:" + name + "@" + company + "." + domain + "?subject=" + subject + "&body=" + body;
	window.location.replace(locationstring);
}

//EXTERNAL LINKS HANDLER
// Open link in new window, without status message
function newWindow(url) {
		window.open(url, null,"");
}
// Open status message, if user clicks "Confirm", then open in new window
function confirmExit(url) {
	var retString = "You are about to leave the website" + '\n\n' + "Are you sure you wish to do so?";
	var answer = confirm (retString);
	if (answer) {
		window.open(url, null,"");
	}
}
$(document).ready( function() {
	jQuery("a[rel=external]").click( function(e) {
		newWindow(jQuery(this).attr("href"));
		e.preventDefault();
	});
});

//SCALABLE POPUP WINDOW HANDLER
function popup(strUrl, iWidth, iHeight, iLeft, iTop, blnCenter, strName, strScroll, strMenus, strTools, strResize, strLocate)
{
	if ( blnCenter )
	{
		iLeft = (screen.width - iWidth) / 2;
		iTop = (screen.height - iHeight) / 2;
	}
	
	var winprops = 	"location=" + strLocate + ",scrollbars=" + strScroll + ",menubar=" + strMenus + ",toolbar=" + strTools + ",resizable=" + strResize + ",left=" + iLeft + ",top=" + iTop + ",width=" + iWidth + ",height=" + iHeight;		

	var popup = window.open(strUrl,strName,winprops);
	popup.focus();
}
