/* 
========================================================================================================================
Title : 		Australian Industry Services Website
Author : 		Dave Tanner
URL : 			www.freshweb.com.au

Description: 	Sets javascript popups (for sources, see below)

Created :  		08 March 2006
Modified : 		09 March 2006
======================================================================================================================== */

/* 
======================================================================
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 popup
if (strType=="popWin") strOptions="scrollbars,top=30,height=380,width=530";
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";
		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,'vrtour');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,'vrtour');return false;" rel="external">This is my link</a>
===========================================
*/