//SET NOCONFLICT TO WORK WITH OTHER LIBRARIES
jQuery.noConflict();

//CUSTOM JQUERY FUNCTIONS
jQuery(document).ready(function(){
	
	jQuery('form#search input').clearInput();
	
	//Check if commentForm exists
	if ( jQuery('dl#boardofdirectors').length > 0 ) {

		//ChildNav show & hide nav functions
		var boardofdirectorsConfig = {    
		     sensitivity: 3, //sensitivity threshold (must be 1 or higher)    
		     interval: 200, //milliseconds for onMouseOver polling interval    
		     over: bioShowMore,  
		     timeout: 800, //milliseconds delay before onMouseOut    
		     out: bioHideMore 
		};
		
		//Enable expand/collapse of full bio
		jQuery('dl#boardofdirectors dd').hoverIntent(boardofdirectorsConfig);

	}

});

function bioShowMore(){
					
	jQuery('dl#boardofdirectors dd div.bio div.more').hide();
	jQuery(this).children('div.bio').children('div.more').show();

}

function bioHideMore(){
	
	jQuery(this).children('div.bio').children('div.more').hide();

}

jQuery.fn.clearInput = function(){
	return this.focus(function(){
		if(this.value == this.defaultValue){
			this.value = "";
		}
	}).blur(function(){
		if(!this.value.length){
			this.value = this.defaultValue;
		}
	});
};

//Load url from selectbox
function loadUrl(url){

	//Check if its an internal or external link
	var isInternal = function(u) {
		return ((u.indexOf("://") == -1 && u.indexOf("www.") == -1) || u.indexOf(window.location.host) > -1);
	}

	if (url == "#"){
	
		//Do nothing
	
	}
	else {	
	
		if (isInternal(url)){
			
			window.location = url;
			
		}
		else if (window.confirm("Are you sure you want to leave our site?")){
			
			window.location = url;
			
		}

	}

}