/* Author: Robert Chandler */
$(document).ready(function() {
  $(function() {
		$( "#tabs" ).tabs({ fx: { opacity: 'toggle' } });
	});
	
	$('.page-id-13 #pageContent').columnize({ width: 220 });
	
	$('.page-id-37 #main #tabs .memberContain').click(function(){
		$('.page-id-37 #main #tabs .memberContain').removeClass('active');
		$(this).addClass('active')
		$('.memberContent').not('.memberContain.active .memberContent').fadeOut();
		$(this).children('.memberContent').fadeToggle();
	});
	
//	$('.tab').jScrollPane();
	
	$('.anchorWrap').click(function(){
	
			  window.location = $(this).children('anchorLink').attr('href');
		
	});
	
	/*$('.entry').live('click', function() {
	    var a = $('a', this);
	    if (a.length) {
	        console.log(a[0]);
	        window.location = a[0].href;
	    }
	}).addClass('js');*/
	
	var t = $("h2.splitText").text();
	var splitT = t.split(" ");
	var halfIndex = Math.round(splitT.length / 2);
	var newText = "";
	for(var i = 0; i < splitT.length; i++) {
	    if(i == halfIndex) {
	        newText += "<span>";
	    }
	    newText += splitT[i] + " ";
	}
	newText += "</span>";
	$("h2.splitText").html(newText);
	
	$('#content, #pageContent, #vets, #secondaryContent').delay(500).fadeTo('slow', 1);
	
	$('header nav ul li.sub').click(function(){
		$(this).children('ul').toggle('drop');
			
	});
	
	$('#map1').click(function(){
		$('#mapbox1').animate({
		    opacity: 1,
		    top: '20%'		    
		  }, 500, function() {
		    // Animation complete.
		  });
		 $('#overlay').fadeIn(500);		 
	});
	
	$('#map2').click(function(){
		$('#mapbox2').animate({
		    opacity: 1,
		    top: '20%'		    
		  }, 500, function() {
		    // Animation complete.
		  });
		 $('#overlay').fadeIn(500);		 
	});
	
	$('#map3').click(function(){
		$('#mapbox3').animate({
		    opacity: 1,
		    top: '20%'		    
		  }, 500, function() {
		    // Animation complete.
		  });
		 $('#overlay').fadeIn(500);		 
	});
	
	$('#overlay').click(function(){
		$('.mapbox').animate({
		    opacity: 0,
		    top: '-400px'		    
		  }, 500, function() {
		    // Animation complete.
		  });
		  $('#overlay').fadeOut(500);	
	});
	
});
























