function attachLinks() {
	$$('a').each(function(a){
		if (a.href.match('#')) {
			Event.observe(a, 'click', function(event) {
				var page = Event.element(event).getAttribute('href');
				page = page.replace('#', '');
				loadContent(page);
			});
		}
	});
}

function loadContent(page) {
	new Ajax.Updater('content', 'content.php', {
			parameters: { page: page }
		});
}

function contactSend() {
	new Ajax.Request('/send_contact.php', { 
		parameters: $('contactform').serialize(true),
		onSuccess: function() {
			$('contact').innerHTML = "<blockquote><h4 style=\"color:green\">Thank you! Your message has been sent.</h4></blockquote>";
		},
		onFailure: function() {
			alert('Please complete all required fields.');
		}
	});
}

function newsToggle() {
	$$('.newsitem div').each(function(n){
		if (n.style.overflow == 'visible') {
			n.style.overflow = 'hidden';
			n.style.height = '24pt';
			n.style.textOverflow = 'ellipsis';
		}
	});
	this.style.overflow = 'visible';
	this.style.height = 'auto';
	this.style.textOverflow = '';
}

window.onload = function(){
	$$('.newsitem div').each(function(n){
		n.onclick = newsToggle;
	});
}
