/////////////////////////////////////////////
// Javascript for various one of pages on the site - book of condolences etc...
////////////////////////////////////////////

function condol_init() {
	// init book of condolences	
	condol_loadMessages();
	
	// search
	$('searchbut').observe('click', function(e) {
		e.stop();
		condol_loadMessages();
	});
	
	// add
	$('submitmessage').observe('click', function(e) {
		e.stop();												 
		new Ajax.Request('/action/conAddMessages/', {
		  parameters: $('frmCondol').serialize(true),
		  onSuccess: function() {
			  $('frmCondol').reset();
			  $('messageToFade').appear();
		  }	 
		});	
	});	
}

function condol_loadMessages() {
	// loads the messages from the db
	new Ajax.Updater($("messages"), '/action/conGetMessages/?s=' + $F('searchterm'), {onSuccess: function() {$('searchterm').value=""; }});	
}


function documentView_init() {
	$('or').observe('change', function() {
		location.href="?mode=" + $F('or');
	});

}
