// Sidebar UL jQuery tabs
$(function () {
	var tabContainers = $('.singleTab');
	tabContainers.hide().filter(':first').show();
		$('div.SidebarTabs ul.SidebarTabNavigation a').click(function () {
		tabContainers.hide();
        tabContainers.filter(this.hash).show();
        $('div.SidebarTabs ul.SidebarTabNavigation a').removeClass('selected');
        $(this).addClass('selected');
        return false;
        }).filter(':first').click();
});

// Ajax contact form
// prepare the form when the DOM is ready 
$(document).ready(function() { 
    // bind form using ajaxForm 
    $('#myContactForm').ajaxForm( { beforeSubmit: validateMyForm } ); 
});
	
// Ajax Blog Post Comment form
// prepare the form when the DOM is ready 
$(document).ready(function() { 
    // bind 'myForm' and provide a simple callback function 
    $('#myCommentForm').ajaxForm( { beforeSubmit: validateMyComment } );
});		
		
// Animated collapsible divs
animatedcollapse.addDiv('sent', 'fade=1,speed=400,height=auto,group=communicate')
animatedcollapse.addDiv('comment-posted', 'fade=1,speed=400,height=auto,group=communicate')
animatedcollapse.addDiv('contact-error', 'fade=1,speed=400,height=auto,group=communicate')
animatedcollapse.addDiv('comment-error', 'fade=1,speed=400,height=auto,group=communicate')

animatedcollapse.ontoggle=function($, divobj, state){ //fires each time a DIV is expanded/contracted
	//$: Access to jQuery
	//divobj: DOM reference to DIV being expanded/ collapsed. Use "divobj.id" to get its ID
	//state: "block" or "none", depending on state
}
animatedcollapse.init()