function initTextFields()
{
	var inputs = document.getElementsByTagName("input");
	for (var i=0; i<inputs.length; i++)
	{
		if ((inputs[i].type == "text" || inputs[i].type == "password") && document.getElementById("email"))
		{
			inputs[i].onfocus = function ()
			{
				this.className += " input-active";
			}
			inputs[i].onblur = function ()
			{
				this.className = this.className.replace("input-active", "");
			}
		}
	}
}

var slides;
var duration = 5000;
var all_slides = [];
var all_thumbs = [];
var autoplay = true;
var current;
function initGallery()
{
	if(document.getElementById('slide-show'))
	{
		
		current = 0;
		all_slides = $$('#slide-show li');
		slides = all_slides.length;
		if(slides>1)
		{
			all_slides.setStyles({"opacity": 0})
			all_slides[0].setStyle("opacity", 1);

			all_thumbs = $$('#thumbs li');
			all_thumbs.each(function(el, i) {
			    el.onclick = function() {
			        if (current != i) {
			            autoplay = false;
			            all_thumbs.removeClass("active");
			            all_slides[current].fade(0);
			            all_slides[i].fade(1);
			            all_thumbs[i].addClass("active");
			        }
			        current = i;
			        return false;
			    }
			});
			setTimeout('rotate(' + 0 +')', duration);
		}
	}
}
function rotate(_index)
{
	if(autoplay)
	{
		all_thumbs.removeClass("active");
		all_slides[_index].fade(0);
		if(_index==slides-1)
			_index=-1;
		all_slides[++_index].fade(1);
		all_thumbs[_index].addClass("active");
		current = _index;
		setTimeout('rotate(' + _index + ')', duration);
	}
}
function initHover()
{
	var nodes = document.getElementById("navigation");
	if (nodes)
	{
		nodes = nodes.getElementsByTagName("li");
		for (var i=0; i<nodes.length; i++)
		{
			nodes[i].onmouseover = function()
			{
				this.className += " hover";
			}
			nodes[i].onmouseout = function()
			{
				this.className = this.className.replace("hover", "");
			}
		}
	}
}
if (window.addEventListener)
{
	window.addEventListener("load", initGallery, false);
	window.addEventListener("load", initTextFields, false);
	//window.addEventListener("load", initHover, false);
}
else if (window.attachEvent)
{
	window.attachEvent("onload", initGallery);
	window.attachEvent("onload", initTextFields);
	window.attachEvent("onload", initHover);
}