function toggleLayer(divname, sender)
{
	thisdiv = document.getElementById(divname);
	if (thisdiv.style.display != 'block')
	{
		thisdiv.style.display = 'block';
		sender.innerText = "<<";
	}
	else
	{
		thisdiv.style.display = 'none';
		sender.innerText = ">>";
	}
}

function hideLayer(divname)
{
	thisdiv = document.getElementById(divname);
	thisdiv.style.visibility = 'hidden';
}

function showLayer(divname)
{
	thisdiv = document.getElementById(divname);
	thisdiv.style.visibility = 'visible';
	
	thisdiv.onclick = function () {
		thisdiv.style.visibility = 'hidden';
	}
}

function showFlash(filename)
{
	flashwin = window.open("","flashwin","width=420,height=320");
	flashwin.document.write("<html><head><title>Apogee Interactive - Flash Player</title></head><body>");
	flashwin.document.write("<object width=\"400\" height=\"300\" type=\"application/x-shockwave-flash\" data=\"");
	flashwin.document.write(filename);
	flashwin.document.write("\"><param value=\"");
	flashwin.document.write(filename);
	flashwin.document.write("\" name=\"movie\" /></object>");
	flashwin.document.write("</body></html>");
	flashwin.document.close();
}

function showFlashObject(filename,width,height)
{
	document.write("<object width=\"" + width + "\" height=\"" + height + "\" type=\"application/x-shockwave-flash\" data=\"");
	document.write(filename);
	document.write("\"><param value=\"");
	document.write(filename);
	document.write("\" name=\"movie\" /></object>\n");
}

function showPopupWindow(url, width, height)
{
	var popupwin = window.open(url,"popupwin","width=" + width + ",height=" + height + ",menubar=no,resizable=yes,toolbar=no,location=no,status=no");
}

function printPage()
{
	mytitle = document.getElementById("contenttitle");
	mycontent = document.getElementById("content");
	printwin = window.open("","printwin","width=600,height=400");
	printwin.document.write("<html><head><title>" + mytitle.innerHTML + "</title><link href=\"../styles/common.css\" rel=\"stylesheet\" type=\"text/css\" /></head><body onload=\"window.print();window.close();\">");
	printwin.document.write("<h4 id=\"printcontenttitle\">" + mytitle.innerHTML + "</h4>");
	printwin.document.write("<div id=\"printcontent\" style=\"width: 550px\">" + mycontent.innerHTML + "</div>");
	printwin.document.write("</body></html>");
	printwin.document.close();
}

var externallinksprocessed = false;

function makeLinksExternal()
{
	if (!externallinksprocessed)
	{
		if (!document.getElementsByTagName) return;
		var alllinks = document.getElementsByTagName("a");
		for (var i=0; i<alllinks.length; i++)
		{
			var link = alllinks[i];
			if (link.getAttribute("href") && 
				link.getAttribute("rel") == "external")
				link.target = "_blank";
		}
		externallinksprocessed = true;
	}
}

window.onload = makeLinksExternal;