/*
	Image Cross Fade Redux
	Version 1.0
	Last revision: 02.15.2006
	steve@slayeroffice.com

	Rewrite of old code found here: http://slayeroffice.com/code/imageCrossFade/index.html
*/

window.addEventListener?window.addEventListener('load',so_init,false):window.attachEvent('onload',so_init);

var d=document, imgs = new Array(), zInterval = null, current=0, pause=false;
var fadetime = 3000;
/*#top
{
	background-image: url(top.jpg);
	background-repeat: no-repeat;
	height: 236px;
	vertical-align:bottom;
	text-align:center;
	position: relative;
}
*/
function so_init()
{
	if(!d.getElementById || !d.createElement)return;

	imgs = d.getElementById('header_images').getElementsByTagName('img');
	for(i=1;i<imgs.length;i++) imgs[i].xOpacity = 0;
	imgs[0].style.display = 'block';
	imgs[0].xOpacity = .99;

	setTimeout(so_xfade,fadetime);
}

function so_xfade()
{
	cOpacity = imgs[current].xOpacity;
	nIndex = imgs[current+1]?current+1:0;
	nOpacity = imgs[nIndex].xOpacity;

	cOpacity-=.05;
	nOpacity+=.05;

	imgs[nIndex].style.display = 'block';
	imgs[current].xOpacity = cOpacity;
	imgs[nIndex].xOpacity = nOpacity;

	setOpacity(imgs[current]);
	setOpacity(imgs[nIndex]);

	if(cOpacity<=0)
	{
		imgs[current].style.display = 'none';
		current = nIndex;
		setTimeout(so_xfade,fadetime);
	}
	else
	{
		setTimeout(so_xfade,50);
	}

}

function setOpacity(obj)
{
	if(obj.xOpacity>.99)
	{
		obj.xOpacity = .99;
		return;
	}

	obj.style.opacity = obj.xOpacity;
	obj.style.MozOpacity = obj.xOpacity;
	obj.style.filter = 'alpha(opacity=' + (obj.xOpacity*100) + ')';
}

var itop=40;
function so_hh()
{
	var obj = document.getElementById(':1.container').style;
	itop-=1;
	obj.position = "absolute";
	obj.top=(-40+itop)+"px";
	obj._top=(-40+itop)+"px";
	if (itop<=1){obj.display="none";} else setTimeout(so_hh,10);
}

function hg_z_w(){/*dumpProps(document.getElementById(':1.container'),null);*/setTimeout(so_hh,50);}

function dumpProps(obj, parent) {

      // Go through all the properties of the passed-in object

      for (var i in obj) {

      // if a parent (2nd parameter) was passed in, then use that to

      // build the message. Message includes i (the object's property name)

      // then the object's property value on a new line

      if (parent) { var msg = parent + "." + i + "\n" + obj[i]; } else { var msg = i + "\n" + obj[i]; }

      // Display the message. If the user clicks "OK", then continue. If they

      // click "CANCEL" then quit this level of recursion

     if (obj[i]) if (!confirm(msg)) { return; }

      // If this property (i) is an object, then recursively process the object

      if (typeof obj[i] == "object") {

      if (parent) { dumpProps(obj[i], parent + "." + i); } else { dumpProps(obj[i], i); }

      }

      }

      }