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

function changeFeaturedImage(small_url, large_url, show_link) {
	$('featured_image').src = small_url;
	if (show_link) {
		Element.update('featured_link', "<a href=\"" + large_url + "\" target=\"_blank\">View Large</a>");
	} else {
		Element.update('featured_link','');
	}
}

/*
function showSubNav(section, e) {
	// If event gets passed, check to make sure that the mouse is outside of the masthead area
	if (!e || (e && !matchParent(e.target, 'masthead'))) {
		Element.update('nav2',subNav[section]);
	}
}
*/

function matchParent(element, match) {
	if (element.id == match)
		return true;
	else if (element.id == null)
		return false;
	else
		return matchParent(element.parentNode, match);
}

String.prototype.pad = function(l, s, t){
    return s || (s = " "), (l -= this.length) > 0 ? (s = new Array(Math.ceil(l / s.length)
        + 1).join(s)).substr(0, t = !t ? l : t == 1 ? 0 : Math.ceil(l / 2))
        + this + s.substr(0, l - t) : this;
};