/*
	Used by the find a provider page to print a section ... receives the div object
*/

function printSelection(node) {
	var content="<h1>" + node.id + "</h1>" + node.innerHTML
	var pwin=window.open('','print_content','width=100,height=100');
	
	pwin.document.open();
	pwin.document.write('<html><head><title>Printed document</title><style type="text/css">body{ font: normal 1em/1.2em tahoma,verdana,sans-serif;}</style></head><body onload="window.print()">'+content+'</body></html>');
	pwin.document.close();
	
	setTimeout(function(){pwin.close();},1000);
}

/*
	This is an accessibility and xhtml strict hack for making links open in a new window
*/

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.target = "_blank";
			anchor.onclick = gaLinker;
		}
	} 
} 


function gaLinker() {
	try {
//		pageTracker._trackEvent("Media", "Download", this.href, 1);
//		alert('Tracking link -- ' + this.href);
//		return(false);
	} catch(err) {}
}

/*
	Load our startup functions
*/

var tempFunc = window.onload;
window.onload = function(){
	if (typeof (tempFunc) == "function"){
		try{
			tempFunc();
		} catch(e){}
	}
	
	// also, fix external links
	externalLinks();	
}

