// JavaScript Document
/*
Opens target="_blank" windows;
*/
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;

function RollOver(name)
{
	overs = document.getElementById("content").getElementsByTagName("div");
	
	for(var i=0; i<overs.length; i++)
	{		
		if(overs[i].className == 'rollover_wrapper')
			overs[i].style.display = 'none';
		else if(overs[i].className == 'introText')
			overs[i].style.display = 'block';
	}

	objOver = document.getElementById(name + "_over").style.display = 'block';
	objOff = document.getElementById(name + "_off").style.display = 'none';
}

function ShowResources()
{	
	strHTML = "<ul>";
	numbers = "";

	for(var i=0; i<5; i++)
	{
		rotateimg=Math.floor(r_imgArray.length*Math.random());
		
		//check if the number has been used before
		while(numbers.search(rotateimg) > -1)
		{
			rotateimg=Math.floor(r_imgArray.length*Math.random());
		}

		numbers += rotateimg + ",";

		strHTML +=
			"<li>" +
			"<p id=\"freestuff_wrapper\">" +
			r_imgArray[rotateimg] + 
			"</p>" +
			"<p id=\"freestuff_wrapper\">" +
			"<strong>" + r_linkArray[rotateimg] + "</strong>" +
			"<br/>" +
			r_captionArray[rotateimg] +
			"</p>" +
			"</li>";
	}
	
	return strHTML + "</ul>";
}


r_imgArray=new Array
(
	"<img class=\"thumb\" src=\"http://www.swinburne.edu.au/ncs/images/smartbus.jpg\" alt=\"Smart Business\" width=\"63\" height=\"39\" />",
	"<img class=\"thumb\" src=\"http://www.swinburne.edu.au/ncs/images/home_memoirs.jpg\" alt=\"Environmental Memoirs\" width=\"63\" height=\"39\" />",
	//"<img class=\"thumb\" src=\"http://www.swinburne.edu.au/ncs/images/free_rbank.gif\" alt=\"Resouce Bank\" width=\"63\" height=\"39\" />",
	"<img class=\"thumb\" src=\"http://www.swinburne.edu.au/ncs/images/free_eco.gif\" alt=\"Eco Footprint Calculator\" width=\"63\" height=\"39\" />",
	"<img class=\"thumb\" src=\"http://www.swinburne.edu.au/ncs/images/free_melbwater.gif\" alt=\"Home Water investigator\" width=\"63\" height=\"39\" />",
	"<img class=\"thumb\" src=\"http://www.swinburne.edu.au/ncs/images/free_whatis.gif\" alt=\"What is Sustainability\" width=\"63\" height=\"39\" />",
	"<img class=\"thumb\" src=\"http://www.swinburne.edu.au/ncs/images/free_toolkit.gif\" alt=\"P.D Kit for teachers\" width=\"63\" height=\"39\" />",
	"<img class=\"thumb\" src=\"http://www.swinburne.edu.au/ncs/images/free_resources.gif\" alt=\"Resources\" width=\"63\" height=\"39\" />",
	"<img class=\"thumb\" src=\"http://www.swinburne.edu.au/ncs/images/green_skills.gif\" alt=\"Green Skills\" width=\"63\" height=\"39\" />",
	"<img class=\"thumb\" src=\"http://www.swinburne.edu.au/ncs/images/library_icon.gif\" alt=\"Sustainability Subject Starter Guide\" width=\"63\" height=\"39\" />"
	
);

r_linkArray=new Array
(
	"<a href=\"http://www.swinburne.edu.au/ncs/researchprojects/selfassessment.htm\">SME tool.. Smart-Biz</a>",
	"<a href=\"http://www.swinburne.edu.au/ncs/environmentalmemoirs\">Environmental Memoirs</a>",
	//"<a href=\"http://www.swin.edu.au/ncs/resourcebank/welcome.htm\">Resource Bank</a>",
	"<a href=\"http://www.epa.vic.gov.au/ecologicalfootprint/calculators/default.asp\">Calculate your Eco-Footprint</a>",
	"<a href=\"http://education.melbournewater.com.au/content/home_water_investigator/home_water_investigator.asp\">Home Water Investigator</a>",
	"<a href=\"http://www.swinburne.edu.au/ncs/whatissustainability.htm\">What is sustainability?</a>",
	"<a href=\"http://www.ncsustainability.com.au/PDKit/teacherresource.htm\">P.D Kit for Teachers</a>",
	"<a href=\"http://www.swinburne.edu.au/ncs/educationtraining/resources.htm\">Resources</a>",
	"<a href=\"http://www.swinburne.edu.au/ncs/Innovation/GreenSkills.html\">Green Skills &amp; Green Jobs</a>",
	"<a href=\"http://www.swinburne.edu.au/lib/subjectguide/sustainability.htm\">Sustainability<br />Subject Starter Guide</a>"
);

r_captionArray=new Array
(
	"<a href=\"http://tool.ncsustainability.com.au/default.aspx\">Visit the site</a>",
	"",
	"",
	"",
	"<span>From Melbourne Water</span>",
	"",
	"",
	"",
	"Reports and Information",
	""
);
