$(document).ready(function() {
	jQuery.preloadImages = function()
	{
	  for(var i = 0; i<arguments.length; i++)
	  {
		jQuery("<img>").attr("src", arguments[i]);
	  }
	}

	$.preloadImages("template_graphics/top_menu_active_bg.gif");
	$.preloadImages("template_graphics/top_menu_active_rightend.gif");
	$("#top_menu li").hover(function() {
		$(this).addClass('hover');
	}, function() {
		$(this).removeClass('hover');
	});

	$("a.resource, a[href^='http://'], a[href^='https://'], a[href$='.pdf'], a[href$='.doc']")
		.attr('target', '_blank');
	$("#search input")
		.addClass('prompt')
		.val('search »')
		.focus(function(){
			$("#search input.prompt")
				.val('')
				.removeClass('prompt')
		});

	$("#right h2:gt(0)").css('margin-top', 25);

	$(".lined").each(function(){
		$(this).children().slice(1).addClass('line_on_top');
	});

	$(".gallery a").click(function() {
		var imageviewer = window.open('imageviewer', 'image', 'width=520,height=600,resizable=yes,location=no,toolbar=no');
		imageviewer.document.open();
		imageviewer.document.write('<html><head><title>Photo</title></head><body style="font-family:arial">');

		var desc = $(this).children('img').attr('alt');
		imageviewer.document.write('<img src="'+($(this).attr('href'))+'" alt="'+(desc.replace('"','\"'))+'" />');
		imageviewer.document.write('<p>'+desc+'</p>');
		imageviewer.document.write('</body></html>');
		imageviewer.document.close();
		imageviewer.focus();
		return false;
	});

	$(".bio a").click(function() {
		$(this).parent().children('div').toggle();
		return false;
	});

	$.preloadImages("template_graphics/donate_now_hover.gif");
	$("#donate_now").hover(function() {
		$(this).attr('src', "template_graphics/donate_now_hover.gif");
	}, function() {
		$(this).attr('src', "template_graphics/donate_now.gif");
	});
});
function displayBoardLogin() {
	$("#board_login").slideDown(130, function() {
		$("#board_login_user_id").focus();
	});

	$("#board_login_cancel").click(function(){
		$("#board_login").hide();
	});
}
