﻿


// nav
BP.sfHover = function() {
	var $sfEls = $("#primary_navigation li");
	$sfEls.each(function() {
		this.onmouseover = function() {
			this.className += " sfhover";
			$('#content_container select').css('visibility', 'hidden');
		}
		this.onmouseout = function() {
			this.className = this.className.replace(new RegExp(" sfhover\\b"), "");
			$('#content_container select').css('visibility', 'visible');
		}
	});
}
if (window.attachEvent) { window.attachEvent("onload", BP.sfHover); }

/**
* Opens a popup window
*/
BP.popWin = function(url, n, w, h, o) {
	var _pw_l, _pw_t, _pw_z;
	if (w > screen.availWidth - 12) w = screen.availWidth - 12;
	if (h > screen.availHeight - 48) h = screen.availHeight - 48;
	_pw_l = (screen.availWidth - w - 12) / 2;
	_pw_t = (screen.availHeight - h - 48) / 2;
	_pw_z = window.open(url, n, 'width=' + w + ',height=' + h + ',left=' + _pw_l + ',top=' + _pw_t + ',' + o);
	return false;
}


$(document).ready(function() {
	// handler for subpage dropdowns...
	$("select.loadSubpage").change(function() { location.href = $(this).val(); });

	// gallery link onclick handler
	$(".galleryLink").each(function() {
		$(this).click(function() { BP.popWin($(this).attr("href"), 'photogallery', 738, 575, 'scrollbars=0'); return false; });
	});
});
