$(document).ready(on_ready);
function on_ready() {

	//show/hide text
		$('#biography:eq(0)> p:gt(0)').hide();
		$('#biography:eq(0)> h4').hide();
		$('<a class="tog">Read more +</a>').insertAfter("#biography p:last-child");
		$("a.tog").click(function(){
			$('#biography:eq(0)> h4').show();
			$('#biography:eq(0)> p:gt(0)').slideToggle('fast');
			$(this).text($(this).text() == 'Read more +' ? 'Read less -' : 'Read more +');
		});


	//TipTip tooltip config
		$(function(){
			$(".description-time").tipTip({defaultPosition: "right"});
		});
  

	// addthis
	var addthis_config = {
		data_track_clickback:true,
		data_ga_tracker:null };
		_gaq.push(function() {
			addthis_config.data_ga_tracker = _gaq._getAsyncTracker('');
		});


	//Mailchimp configuring
	// delete this script tag and use a "div.mce_inline_error{ XXX !important}" selector
	// or fill this in and it will be inlined when errors are generated
	var mc_custom_error_style = '';


	//jQuery.Popeye settings
    var options = {
        navigation: 'hover',
        caption: false,
        direction: 'right',
		duration: '230',
		opacity:0.9,
		easing: 'linear',
		zindex:33333
    }
    $('#imggal').popeye(options);


// http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links
// major changes by Paul Armstrong and Zachary Johnson
// function enable_smooth_scroll() {
    function filterPath(string) {
        return string
                .replace(/^\//,'')
                .replace(/(index|default).[a-zA-Z]{3,4}$/,'')
                .replace(/\/$/,'');
    }

    var locationPath = filterPath(location.pathname);

    var scrollElement = 'html, body';
    $('html, body').each(function () {
        var initScrollTop = $(this).attr('scrollTop');
        $(this).attr('scrollTop', initScrollTop + 1);
        if ($(this).attr('scrollTop') == initScrollTop + 1) {
            scrollElement = this.nodeName.toLowerCase();
            $(this).attr('scrollTop', initScrollTop);
            return false;
        }    
    });
    
    $('a[href*=#]').each(function() {
        var thisPath = filterPath(this.pathname) || locationPath;
        if  (   locationPath == thisPath
                && (location.hostname == this.hostname || !this.hostname)
                && this.hash.replace(/#/, '')
            ) {
                if ($(this.hash).length) {
                    $(this).click(function(event) {
                        var targetOffset = $(this.hash).offset().top;
                        var target = this.hash;
                        event.preventDefault();
                        $(scrollElement).animate({scrollTop: targetOffset}, 500, function() {
                            location.hash = target;
                        });
                    });
                }
        }
    });
}(jQuery);
