	$(document).ready(function() {

		// Navigation rollovers
		$("#nav a, #topnav a").mouseover(function(){
			imgsrc = $(this).children("img").attr("src");
			if (imgsrc) {
			matches = imgsrc.match(/_over.gif/);
			// don't do the rollover if state is already ON
			if (!matches) {
			imgsrcON = imgsrc.replace(/.gif$/ig,"_over.gif"); // strip off .jpg
			$(this).children("img").attr("src", imgsrcON);
			}
		}
		});
		$("#nav a, #topnav a").mouseout(function(){
			if (!matches) {
			$(this).children("img").attr("src", imgsrc);
			}
		});

		// Determine the active section button
		if (location.pathname.substring(1)) {
			// get the path
			thePath = location.pathname.substring(1);
			thePath = thePath.match(/^\/?([a-z0-9_\.-]+)/); // only get the first part of the path

			thePath = '/' + thePath[0];
			navLink = $('#nav a[@href$="' + thePath + '"], #topnav a[@href$="' + thePath + '"]');
			imgsrc = $(navLink).children("img").attr("src");
			if (imgsrc) {
			imgsrcON = imgsrc.replace(/.gif$/ig,"_over.gif"); // strip off .gif
			$(navLink).children("img").attr("src", imgsrcON);
			//$(navLink).css({color:"#000000",textDecoration:"none"});
			}
		}

		// Determine the active subnav
		/*if (location.pathname.substring(1)) {
			// get the path
			snPath = '/' + location.pathname.substring(1);
			snPath = snPath.match(/\/?([a-z0-9_-]+).html$/); // only get the filename excluding .html
			if (snPath) {
			snPath = snPath[0];
			snPage = snPath[1];
			snLink = $('#nav a[@href$="' + snPath + '"]');
			snsrc = $(snLink).children("img").attr("src");
			if (snsrc) {
			snsrcON = snsrc.replace(/.jpg$/ig,"_over.jpg"); // strip off .jpg
			$(snLink).children("img").attr("src", snsrcON);
			}
		}
		}*/

		// Table padding for brief displays
		//$('table.propbrief').filter(':even').css('margin-right', '7px');




		// Functions for rotating events within masthead
	$("#ticker").jticker({
		delay: 4000,
		newwindow: false,
		url: "/lib/modules/m_events_ajax.php",
		transition: "slide",
		speed: "slow"
	});

	// count words in event submission form
	$("#desc").keyup(function(){
		desc = this.value;
		result = desc.split(/ /);
		if (result.length > 35) {
		max = desc.length;
		newdesc = desc.substring(0, max - 1);
		this.value = newdesc;
		$("#warning").show();
		} else {
			$("#warning").hide();
			$("#length").html(result.length+' words used.');
		}

	});

	});