// JavaScript Document for Winterstone.com.au
// Author: James Nicol, Glossopteris Web Design & Development, June 2006

/*----- Behaviour Registers to assign actions to page elements on load -----*/
var winterstone_rules = {
	
	'.main_nav' : function(el) {
		el.onmouseover = function() { 
			new Effect.Highlight(el, {startcolor:'#FFFFFF', endcolor:'#8FB7CD', restorecolor:'#8FB7CD'});
			el.style.color = '#FFFFFF';
		}
		el.onmouseout = function() {
			new Effect.Highlight(el, {startcolor:'#8FB7CD', endcolor:'#FFFFFF', restorecolor:'#FFFFFF'}); 
			el.style.color = '#615F4E';
		}
	}
	
}

Behaviour.register(winterstone_rules);

/*----- Rotating masthead images -----*/
var rotation_index=0;
function change_masthead_image()
{
	Element.setOpacity('masthead_img', 0.0);
	$('masthead_img').src = rotation_images[rotation_index];
	Effect.Appear('masthead_img', { duration: 2.0 });
	rotation_index++;
	if(rotation_index>=rotation_images.length){ rotation_index=0; }
	setTimeout("change_masthead_image()",10000);
}

Behaviour.addLoadEvent(change_masthead_image);

/*----- Sons Of Suckerfish Dropdown (applying sfhover class to IE) -----*/
sfHover = function() {
	var sfEls = document.getElementById("banner_nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

