﻿// 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,"");
	}
}
function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	
	for (var i = 0; i < anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
			anchor.setAttribute("href", "javascript:newWindow('" + anchor.getAttribute("href") + "');" );
		}
	}
}
window.onload = externalLinks;

//	StylesheetPicker Script provided courtesy of Lee Sykes at DNN Creative Magazine.
//	Providing DotNetNuke Tutorials, Reviews, Videos, MP3 Interviews to 
//	help you get the most from DNN
//
//	Copyright ©2008 Lee Sykes from DNN Creative Magazine

//	BEGIN: styleSheetPicker object definition
/*
<![CDATA[
function styleSheetPicker()
{
   this.ieScreen = this.iePrint = this.otherScreen = this.otherPrint = "";
}

styleSheetPicker.prototype.render = function()
{
   if (document.createStyleSheet)
   {
    if (this.ieScreen)
     document.createStyleSheet(this.ieScreen);

    if (this.iePrint)
        {
     var ieP = document.createStyleSheet(this.iePrint);
            ieP.media = "print";
        }
   }
   else
   {
        var head = document.getElementsByTagName("head")[0];
    if (this.otherScreen != "")
            head.innerHTML += "<link rel=\"stylesheet\" href=\"" + this.otherScreen + "\"/>";

    if (this.otherPrint != "")
            head.innerHTML += "<link rel=\"stylesheet\" media=\"print\" href=\"" + this.otherPrint + "\"/>";

   }
}
// END: styleSheetPicker object definition

var picker = new styleSheetPicker();

// IE stylesheets
picker.ieScreen = "iehacks.css";
picker.iePrint = "print.css";

// Other browser stylesheets
// Don't need this: picker.otherScreen = "default.css";
picker.otherPrint = "print.css";
picker.render();
]]>
*/