/*
	Links Functionality
*/

//Opens a link to an external site
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";   
 }   
}   
window.onload = externalLinks;

// Creates a Backlink
function backlink() {
	this.text = '< Back';
	this.type = 'link';
	this.write = backlink_write;
	this.form = true;
}

// Writes the HTML for the Backlink
function backlink_write() {
	if (! window.history) return;
	if (window.history.length == 0)return;

	this.type = this.type.toLowerCase();
	if (this.type == 'button') {
		if (this.form)
			document.write('<form>');
		document.write('<input type="button" onClick="history.back(-1)" value="', this.text, '"');
		if (this.otheratts) document.write(' ', this.otheratts);
		document.write('>');
		if (this.form)document.write('<\/form>');
	} else {
		document.write('<a href="javascript:history.back(-1)"');
		if (this.otheratts)
			document.write(' ', this.otheratts);
		document.write('>');
		if (this.type == 'image' || this.type == 'img') {
			document.write('<img src="', this.src, '" alt="', this.text, '"');
			if (this.width) document.write(' width=', this.width);
			if (this.height) document.write(' height=', this.height);
			if (this.otherimgatts) document.write(' ', this.otherimgatts);
			document.write(' style="border: 0;" />');
		}
		else
			document.write(this.text);
		document.write('<\/a>');
	}
}
