
attachEventHandlers = function () {
	var wrapper = document.getElementById("nav");
	
	$("#nav_default a").mouseover(function () {
		var className, menuId;
		className = this.className;
		menuId = "#nav_" + className;
		$("#nav .sub").hide();
		$(menuId).show();
	});
	
	$(wrapper).mouseleave(function (ev) {
		var timer = setTimeout(function() {
			$("#nav .sub").hide();
		}, 400);
		
		$(wrapper).mouseenter(function() {
			clearTimeout(timer);
		});
	});
};

handleSelect = function (wrapper) {
	$(wrapper).children("select").change(function() {
		var idx, url;
		idx = this.selectedIndex;
		url = this.options[idx].value;
		if (url !== "") {
			location.href = url;
		}
	});
};

$(document).ready(function(){
	
	attachEventHandlers();
	
	var slideshow = document.getElementById("slideshow");
	if (slideshow) {
		$('#slideshow').cycle({
			fx: 		'fade',
			speed: 		1000,
			timeout: 	5000,
			random:  	1,
			autostop:   0
		});
	};

});
