window.onload = externalLinks;

/*
	Taken from: http://www.sitepoint.com/article/standards-compliant-world/3

	This is used to make the site XHTML/1.0 (Strict) compliant. Why is this JavaScript workaround
	not cheating?

	The Document Object Model (DOM), which governs the document objects and attributes that
	are available to JavaScript code, is a totally separate standard from (X)HTML. Also
	consider that the DOM 2.0 standard that was published in January 2003 (well after XHTML 1.0,
	let alone HTML 4.0) still includes this attribute. It seems clear that while this attribute
	is slated to be phased out of (X)HTML, it will be available to JavaScript through the DOM
	for the foreseeable future.
*/
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";
		}
	}
}

/*
	Intended to be attached onClick events, this opens a pop-up window for the gallery
*/
function openGallery(ID){
	window.open('/gallery?ns='+ID, 'slideshow', 'status=no,toolbar=no,location=no,menubar=no,directories=no,resizable=yes,scrollbars=yes,width=875,height=710');
	return false;
}
function openGallery_FF(ID){
	window.open('/gallery?ns='+ID, 'slideshow', 'status=no,toolbar=no,location=no,menubar=no,directories=no,resizable=yes,scrollbars=yes,width=850,height=665');
	return false;
}

function openGallery_large(ID){
	window.open('/gallery_large?ns='+ID, 'slideshow', 'status=no,toolbar=no,location=no,menubar=no,directories=no,resizable=yes,scrollbars=yes,width=1370,height=920');
	return false;
}

