// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

document.observe("dom:loaded", function(){

	if($('trainer_contact') && !$('errorExplanation')) {
		$('trainer_contact').hide().insert({before: '<p class="down"><a href="#">Contact us about this trainer</a></p>'}).down().insert({bottom: '<p class="cancel"><a href="#">Close</a></p>'});
		$$('h1+.down>a, #trainer_contact .cancel a').each(function(t){
			t.observe('click', slideTrainerContact);
		});
	}
	
	if($('body_trainer') || $('body_course')) {
		$$('#content_main p.back')[0].insert({before:'<p class="print"><a href="#" onclick="window.print()">Print this page</a></p>'});
	}
	
	if ($('search_name') != null) {
		$('search_name').observe('focus', function(t){
			if (this.value == "Enter a name") { this.value = ""; }
		});
		$('search_name').observe('blur', function(t){
			if (this.value == "") { this.value = "Enter a name"; }
		});
	}
	
	

});

function slideTrainerContact(e) {
	Effect.toggle('trainer_contact', 'slide', { duration: 0.6 });
	Event.stop(e);
}