//Tell the init script to set the behaviours
frontpage = true;

//set behaviour rules
var myrules = {
	'li.topLevelNav' : function(el){
		el.onmouseover = function() {
			changeDescription(el.id);
		};
		el.onmouseout = function() {
			resetDescription();
		}
	},
	'div.entry' : function(el){
		el.onmouseover = function() {
			el.style.backgroundColor = "#dedede";
		};
		el.onmouseout = function() {
			el.style.backgroundColor = "#ffffff";
		}
	},
	'input#txtSiteSearch' : function(el) {
		el.onfocus = function() {
			if(el.value == "Search our site...")
			{
				el.value = "";
			}
		};
		el.onblur = function() {
			if(el.value == "")
			{
				el.value = "Search our site...";
			}
		}
	},
	'form#siteSearch' : function(el) {
		el.onsubmit = function() {
			if($('txtSiteSearch').value == "Search our site...")
			{
				$('txtSiteSearch').focus();
				return false;
			}
			else
			{
				return true;
			}
		}
	}
};

Behaviour.register(myrules);

function changeDescription(theElement)
{
	var theReplacementText = "span" + theElement.substring(4);
	if (Element.visible('pIntroText'))
	{
		Element.hide('pIntroText');
	}
	$('pDescriptionText').innerHTML = "<p>" + $(theReplacementText).innerHTML + "</p>";
	
}

function resetDescription()
{
	Element.show('pIntroText');
	$('pDescriptionText').innerHTML = '';
}