
/***********************************
Static Properties
***********************************/

var PAGE_ICON_LOCATION = "images/"; // Location of all page icons.

/*
Page icons in order of page appearance.
*/
var PAGE_ICONS = [
	PAGE_ICON_LOCATION + "page_icon_home.jpg",
	PAGE_ICON_LOCATION + "page_icon_hazardous_waste.jpg",
	PAGE_ICON_LOCATION + "page_icon_ind_services.jpg",
	PAGE_ICON_LOCATION + "page_icon_recycle.jpg",
	PAGE_ICON_LOCATION + "page_icon_other_services.jpg",
	PAGE_ICON_LOCATION + "page_icon_legal.jpg",
	PAGE_ICON_LOCATION + "page_icon_contact.jpg"];
	
var FLASH_NAV_DATA_LOCATION = "data/flashNavConfig.xml"; // Data source for Flash navigation in relation to the web page.

/***********************************
Properties
***********************************/

var aPages; // Page data.

/***********************************
Functions
***********************************/

/*
Initiation function.
*/

function init()
	{
		configurePages();
		defineImages();
	}

/*
Initiates the loading of the image blender content movie into the base.
Called once the entire web page has loaded.
*/

function loadImageBlenderContent()
	{
		getFlashMovieObject("imageBlender").SetVariable("webPageLoaded", "true");
	}
		
/*
Returns the query part of the location string.
window.loaction.search is the url query including the '?'.
*/

function getQuery()
	{
		return window.location.search.substring(1);
	}
	
/*
Returns an object containing name value pairs from the url query (e.g. myObject.myName = myValue).
window.loaction.search is the url query including the '?'.
*/

function getQueryData()
	{
		var aCurrPair; // Current name value pair being assessed.
		var aQueries = getQuery().split("&");
		var oData = {}; // Holds the return data
		
		for (var i = 0; i < aQueries.length; i++)
		{
			aCurrPair = aQueries[i].split("=");
			oData[aCurrPair[0]] = aCurrPair[1];
		}
		
		return oData;
	}

/*

*/

function configurePages()
	{
		aPages = [
			{pageLocation:"index.html"},
			{pageLocation:"hazardous_waste.html"},
			{pageLocation:"industrial_services.html"},
			{pageLocation:"recycle_and_recovery.html"},
			{pageLocation:"other_services.html"},
			{pageLocation:"links_and_testimonials.html"},
			{pageLocation:"contact_us.html"}
		];
	}

/*
Called by Flash navigation on selection of a button.
	@navItem:Number			Navigation index (page number).
*/

function onFlashNavSelect(navItem)
	{
		location = findPageLocation(navItem);
	}

/*
Returns the page location corresponding to the specified index.
	@index:Number				Page index.
	@return:String			Page location.
*/

function findPageLocation(index)
	{
		return aPages[index].pageLocation;
	}

/*
Declares all images for use with rollovers.
*/

function defineImages()
	{
		oContactButtonImage = {out:{}, over:{}};
		oContactButtonImage.out.src = "images/contact_up.jpg";
		oContactButtonImage.over.src = "images/contact_over.jpg";
	}

/*
Displays the page icon for the page number specified.
	@pageNum:Number				Page number in order of appearance.
*/

function displayPageIcon(pageNum)
	{
		document.getElementById("pageTitleIcon").style.backgroundImage = "url('" + PAGE_ICONS[pageNum] + "')";
	}

init();