if (window.location.toString().indexOf('empirestaging') < 0) {
  try {
  var pageTracker = _gat._getTracker("UA-0000000-0");
  pageTracker._trackPageview();
  } catch(err) {}
}


$(document).ready(function() {
  
  /* Clear Search text on Focus */
  $('#search').focus(function(){
    $(this).val('');
  })
	
	/* get the max height on sub-boxes on the homepage and re-size all boxes to this height */
	maxHeight = 0;
	$('#home #main .subcolumns .static_content').each(function(){
		maxHeight = Math.max($(this).height(),maxHeight);
	})
	
	var boardOfDirectors = $($('#home #main #col1 .c50l .subcl')[0]);
	var boardOfDirectorsHeight = boardOfDirectors.height();
	
	maxHeight = Math.max(boardOfDirectorsHeight-70,maxHeight);
	
	$('#home #main .subcolumns .static_content').each(function(){
		$(this).height(maxHeight);
	})
	boardOfDirectors.height(maxHeight+70);
	
	
	$('#searchForm').submit(function(event){
    //this grabs the search string and redirects to google in new window and appends site: 
    $('#searchForm input[name="q"]').val($('#searchForm input[name="search"]').val() + ' site:avnu.org');
  })



	
  // Mail address replace
  $('a.mail_link').nospam({
	  replaceText: false,
	  filterLevel:'low'
  });
  $('a.mail_link_text').nospam({
	  filterLevel:'low'
  });
  
});

$(function(){
    $('#loopedSlider').loopedSlider({
			autoStart: 2500
		});
  });

jQuery.fn.nospam = function(settings) {
	settings = jQuery.extend({
		replaceText: false, 	// optional, accepts true or false
		filterLevel: 'normal' 	// optional, accepts 'low' or 'normal'
	}, settings);
	
	return this.each(function(){
		e = null;
		if(settings.filterLevel == 'low') { // Can be a switch() if more levels added
			if($(this).is('a[rel]')) {
				e = $(this).attr('rel').replace('//', '@').replace(/\//g, '.');
			} else {
				e = $(this).text().replace('//', '@').replace(/\//g, '.');
			}
		} else { // 'normal'
			if($(this).is('a[rel]')) {
				e = $(this).attr('rel').split('').reverse().join('').replace('//', '@').replace(/\//g, '.');
			} else {
				e = $(this).text().split('').reverse().join('').replace('//', '@').replace(/\//g, '.');
			}
		}
		if(e) {
			if($(this).is('a[rel]')) {
				$(this).attr('href', 'mailto:' + e);
				if(settings.replaceText) {
					$(this).text(e);
				}
			} else {
				$(this).text(e);
			}
		}
	});
};