// ============================================================
// Unobtrusive Print Page Link
// Thanks to Roger Johansson 
// http://www.456bereastreet.com/archive/200709/how_to_create_an_unobtrusive_print_this_page_link_with_javascript/
// This is a (slightly) modified version of this script, originally written by Roger Johansson. For original, visit above link.
/*
addPrintLink function by Roger Johansson, www.456bereastreet.com
*/
var addPrintLink = {
	init:function(sTargetEl,sLinkText) {
		if (!document.getElementById || !document.createTextNode) {return;} // Check for DOM support
		if (!document.getElementById(sTargetEl)) {return;} // Check that the target element actually exists
		if (!window.print) {return;} // Check that the browser supports window.print
		var oTarget = document.getElementById(sTargetEl);
		var oLinkContainer = document.createElement('span'); // Create span container element
		oLinkContainer.id = 'ico_print';
		var oLink = document.createElement('a');
		oLink.id = 'ico_print_link'; // Give the link an id to allow styling
		oLink.href = '#'; // Make the link focusable for keyboard users
		oLink.title = 'Print'; // Add title attribute
		oLink.appendChild(document.createTextNode(sLinkText));
		oLink.onclick = function() {window.print(); return false;} // Return false prevents the browser from following the link and jumping to the top of the page after printing
		oTarget.appendChild(oLinkContainer);
		oLinkContainer.appendChild(oLink);
	},
	
/*
addEvent function included here for portability. Replace with your own addEvent function if you use one.
*/
/* addEvent function from http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html */
	addEvent:function(obj, type, fn) {
		if (obj.addEventListener)
			obj.addEventListener(type, fn, false);
		else if (obj.attachEvent) {
			obj["e"+type+fn] = fn;
			obj[type+fn] = function() {obj["e"+type+fn](window.event);}
			obj.attachEvent("on"+type, obj[type+fn]);
		}
	}
};


//============================================================
// Text Resize Widget, Unobtrusive Style
// Thanks to Roger Johansson & Paul Sowden
//============================================================


var setTextSize = {
	init:function(lTextEl,lLinkText,lTextSize) {
		if (!document.getElementById || !document.createTextNode) {return;} // Check for DOM support
		if (!document.getElementById(lTextEl)) {return;} // Check that the target element actually exists
		var lTextTarget = document.getElementById(lTextEl);
		var lTextContainer = document.createElement('span'); // create span container element
		lTextContainer.id = 'ico_textplus';
		var lTextLink = document.createElement('a');
		lTextLink.id = 'ltext_link'; // give the link an id to allow styling
		lTextLink.href = '#'; // make the link focusable for keyboard users
		lTextLink.title = 'Increase Text Size'; // add title attribute
		lTextLink.appendChild(document.createTextNode(lLinkText));
		lTextLink.onclick = function() {setActiveStyleSheet(lTextSize); return false;} // return false prevents browser from following link and jumping to top of the page
		lTextTarget.appendChild(lTextContainer);
		lTextContainer.appendChild(lTextLink);
	}	
};

var setTextSizeSmall = {
	init:function(sTextEl,sLinkText,sTextSize) {
		if (!document.getElementById || !document.createTextNode) {return;} // Check for DOM support
		if (!document.getElementById(sTextEl)) {return;} // Check that the target element actually exists
		var sTextTarget = document.getElementById(sTextEl);
		var sTextContainer = document.createElement('span'); // create span container element
		sTextContainer.id = 'ico_textneg';
		var sTextLink = document.createElement('a');
		sTextLink.id = 'stext_link'; // give the link an id to allow styling
		sTextLink.href = '#'; // make the link focusable for keyboard users
		sTextLink.title = 'Decrease Text Size'; // add title attribute
		sTextLink.appendChild(document.createTextNode(sLinkText));
		sTextLink.onclick = function() {setActiveStyleSheet(sTextSize); return false;} // return false prevents browser from following link and jumping to top of the page
		sTextTarget.appendChild(sTextContainer);
		sTextContainer.appendChild(sTextLink);
	}	
};




addPrintLink.addEvent(window, 'load', function(){addPrintLink.init('print','Print');});

window.onload = function() {
	setTextSize.init('textplus','A+','Text Large')
	setTextSizeSmall.init('textneg','A-','Text Small')
}



