/* 
========================================================================================================================
Title : 		Default Javascript
Author : 		Dave Tanner
URL : 			www.freshweb.com.au

Description: 	Sets javascript popups (for sources, see below)

Created :  		08 February 2005
Modified : 		08 February 2005
======================================================================================================================== */

/* 
======================================================================
POPUP WINDOWS
======================================================================
Source: http://accessify.com/features/tutorials/the-perfect-popup/
Author: Ian Lloyd
======================================================================
*/
function popUp(strURL,strType,strHeight,strWidth) {
var strOptions="";
if (strType=="console") strOptions="resizable,height="+strHeight+",width="+strWidth;
if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth;
if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location,height="+strHeight+",width="+strWidth;
// Custom option for fullscreen
if (strType=="fullscreen") {
	strHeight=screen.availHeight-40;
	strWidth=screen.availWidth-10;
	strOptions="resizable,height="+strHeight+",width="+strWidth+"left=0,top=0";
}
// launch
window.open(strURL, 'newWin', strOptions);
}
/* 
===========================================
WORKAROUND FOR STRICT
Since 'target=_blank' not part of strict doctype (use 'rel' instead)
Source: http://www.sitepoint.com/article/standards-compliant-world
Author: Kevin Yank
===========================================
*/
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"; // to target generic blank windows
		// anchor.target = "newWin"; // to target win as per fn above
	}
}
window.onload = externalLinks;

/* TO USE THE POPUP FUNCTIONS
===========================================
Transitional doctype:: 
<a href="my-pop-up-window.htm" onclick="popUp(this.href,'console',400,200);return false;" target="newWin">This is my link</a>
<a href="my-pop-up-window.htm" onclick="popUp(this.href,'fullscreen');return false;" target="newWin">This is my link</a>
===========================================
Strict doctype:: 
<a href="my-pop-up-window.htm" onclick="popUp(this.href,'console',400,200);return false;" rel="external">This is my link</a>
<a href="my-pop-up-window.htm" onclick="popUp(this.href,'fullscreen');return false;" rel="external">This is my link</a>
===========================================
*/