
	Event.observe(document, 'dom:loaded', function() {
		$$('#nav li').each(function(x) {
			x.onmouseover = function() { $(this).addClassName('selected'); }
			x.onmouseout = function() { $(this).removeClassName('selected'); }
		});
				
		if ($('sound')) {
			$('sound').onclick = function() {
			
				var status = (playing) ? 0 : 1;
				set_cookie('sound', status, 4);
				//new Ajax.Request('/ajax/sound.php?status=' + status);
			
				if (playing) {
					Sound.play('', { replace: true });
					Sound.disable();
					playing = false;
				} else {
					Sound.enable();
					Sound.play('/files/background.mp3', { replace: true });
					playing = true;
				}
				return false;
			}
		}
	});
	
	function set_cookie(name, value, expiration) {
		var exp_date = new Date();
		exp_date.setDate(exp_date.getDate() + expiration);
		document.cookie = name + "=" + escape(value) + ((expiration == null) ? "" : ";expires=" + exp_date.toUTCString());
	}
	
	function get_cookie(name) {
		if (document.cookie.length > 0) {
			start = document.cookie.indexOf(name + "=");
			if (start != -1) {
				start += name.length + 1;
				end = document.cookie.indexOf(";", start);
				if (end == -1) end = document.cookie.length;
				return unescape(document.cookie.substring(start, end));
			}
		}
		return "";
	}
