﻿/*
    This document contains functionality that is common across the entire site.
*/
/* NAVIGATION */
$(document).ready(function(){
// Removed animations for navigation.
//    var navigation = jQuery('#navigation');
//		navigation.accordion({
//			active: false,
//			header: 'a.head',
//			selectedClass: 'current',
//			navigation: true,
//			collapsible: true,
//			event: 'mouseover',
//			fillSpace: false,
//			autoheight: false,
//			alwaysOpen: false,
//            animated: 'easeslide' 
//		});
//		
//		jQuery('#primaryNavigation').bind("mouseleave",function(){
//            navigation.accordion( "activate" , "selected" );
//        });
                
  });
  
/* EASY PULL QUOTES */
$(document).ready(function()
   {
 		$('.pullquote').each(function() {
 			var text = $(this).text().replace( /\((.*)\)/gi, " " );
			var floated = "";
			
            if ($(this).is(".right")) 
			{
			    floated = " right";
			}
				
			$(this).parent().before('<blockquote class="pullquote' + floated + '"><span>'+ text +'</span></blockquote>');
				
		});
   }
);

/* Fix Column Height Issues */  
    /*  
    // usage: $('div.unevenheights').setAllToMaxHeight()
    */
$.fn.setAllToMaxHeight = function(){
        return this.height( Math.max.apply(this, $.map( this , function(e){ return $(e).height() }) ) );
}

/* Group Seperate Radio Collections */
    /*
    // Requires jQuery v1.3.2
    // usage: $('fieldset#selections').groupRadioButtons();
    */
function radioGroupHandler(event) {
     var id = $(event.target).attr("id");
     $(event.data.container).find("input:checked:not('#" + id + "')").attr("checked", "");         
}


$.fn.groupRadioButtons = function(){
    this.find("input:radio").bind("click", {container : this.selector}, radioGroupHandler);    
}


        
