/*-------------------------------------------------------------
	 Javascript functions for goodedesign.com.au
	 Created by: tudor@goodedesign.com.au	
	 Created on: 22-09-2004
	 Modified by: tudor@goodedesign.com.au	
	 Modified on: 21-10-2004
	
	 (c) Copyright Goode Design Pty Limited 2004
 -------------------------------------------------------------*/



//----------------------------------------------
//	header rollover functions	
				
	if (document.images) {
	  var companyoff = new Image();
	  companyoff.src = "/images/header/companyoff.gif";
	  var companyon = new Image();
	  companyon.src = "/images/header/companyon.gif";
	  /*var contactsoff = new Image();
	  contactsoff.src = "/images/header/contactsoff.gif";
	  var contactson = new Image();
	  contactson.src = "/images/header/contactson.gif";*/
	  var goodiesoff = new Image();
	  goodiesoff.src = "/images/header/goodiesoff.gif";
	  var goodieson = new Image();
	  goodieson.src = "/images/header/goodieson.gif";
	  var portfoliooff = new Image();
	  portfoliooff.src = "/images/header/portfoliooff.gif";
	  var portfolioon = new Image();
	  portfolioon.src = "/images/header/portfolioon.gif";
	  /*var productsoff = new Image();
	  productsoff.src = "/images/header/productsoff.gif";
	  var productson = new Image();
	  productson.src = "/images/header/products.gif";*/
	  var servicesoff = new Image();
	  servicesoff.src = "/images/header/servicesoff.gif";
	  var serviceson = new Image();
	  serviceson.src = "/images/header/serviceson.gif";
	}
	
	function act(imgName) {
	  if (document.images) 
	    document.images[imgName].src = eval(imgName + "on.src");
	}
	
	function inact(imgName) {
	  if (document.images)
	    document.images[imgName].src = eval(imgName + "off.src");
	}
//-------------------------------------------------

//----------------------------------------------
//	cross browser object picker 
// (original source web professionals hand book, glasshuas)

function getObj(name)
{
	if (document.getElementById)
	{
		var x = document.getElementById(name);
		return x;
	}
	else if (document.all)
	{
		var x = document.all[name];
		return x;
	}
	else if (document.layers)
	{
		var x = document.layers[name];
		return x;
	}
}
//----------------------------------------------

//----------------------------------------------
//	cross browser element collection picker
function getElements(name)
{
	if (document.getElementsByTagName)
	{
		var x = document.getElementsByTagName(name);
		return x;
	}
	else if (document.all)
	{
		var x  = document.all.tags(name);
		return x;
	}
}
//----------------------------------------------

//----------------------------------------------
//	gets meta tag info from the element collection meta
function getMeta(name)
{
	var x = getElements('meta');
	var y = x[name];
	return y;
}
//----------------------------------------------

//----------------------------------------------
//	creates links for bread crub trail
function createBreadCrumb()
	{
		var arrSection = getMeta('GD.Section').content.split(';');
		var arrPath = getMeta('DC.Identifier').content.split('/');
		var strFileName = getMeta('GD.FileName').content;
		var intSectionKey;
		var strPath = "/"
		var strTemp = "<span class='white'>&gt;</span></span><a href='/default.asp' class='bcfixed' title='Goode Design Home'>Home</a>&nbsp;";
		var strPage=/\w\.asp/;
		for( intSectionKey in arrSection)
		{
			
			if (arrSection[intSectionKey] == "Home")
			{
				if(parseInt(intSectionKey) == 0 )
	  			{
					strTemp = "<span>&gt;Home</span>&nbsp;";
		
				}
			}
			else
			{
	  			if(!strPage.test(arrPath[parseInt(intSectionKey) + 3]) && arrSection[intSectionKey] != "")
	  			{
					if((intSectionKey ==  arrSection.length - 2) && (strFileName == "index.asp" || strFileName == "default.asp"))
					{
						strTemp = strTemp + "<span title='" + arrSection[intSectionKey] + "'>&gt;" + arrSection[intSectionKey] + "</span>&nbsp;";
					}
					
					else
					{
						strPath = strPath + arrPath[parseInt(intSectionKey) + 3] + "/"
						strTemp = strTemp + "<span class='white'>&gt;</span><a href='" + strPath + "' class='bcfixed' title='" + arrSection[intSectionKey] + "'>" + arrSection[intSectionKey] + "</a>&nbsp;";
					}
				}
				
			}
		}

		if (!(strFileName == "default.asp" || strFileName == "index.asp"))
		{
			strTemp = strTemp + "<span title='" + document.title + "'>&gt;" + document.title + "</span>";
		}
		
		document.write(strTemp);
	}
//----------------------------------------------

//----------------------------------------------
//	email address encryption function
// from http://www.clari.net.au/Customers/EncHTML/index.html
function decode(k,s) 
{ 
	var o = ""; 
	for (var i = 0; i < s.length ; i++) 
	{ 
		var c = s.charCodeAt(i); 
		c = c - k.charCodeAt(i % k.length); 
		o = o + String.fromCharCode(c); 
	} 
	document.write(o); 
}
//----------------------------------------------