// JavaScript Document
$(document).ready(function(){
	$("div.aboutme div.about:gt(0)").hide();
	$("div.aboutme h1:eq(0) img").animate({opacity: 0}, "fast");
/*
//	$("div.aboutme h1").click(function() {
//		$(this).next("div.about").slideToggle("normal", function(){
//			$.scrollTo(this, 500, {offset:-53});			
//		});		
//	});
*/

	$("div.aboutme> h1").click(function() {
		var $hclicked = $(this);
		var $nextDivA = $(this).next("div.about");
		var $visibleSiblingsA = $nextDivA.siblings('div.about:visible');
		var $visibleDivs = $('div.about:visible');

		if ($visibleSiblingsA.length ) {
		$visibleSiblingsA.slideUp('normal', function() {
		$nextDivA.slideToggle('normal', function() {
			$.scrollTo(this, 500, {offset:-53});
												 });
		$("div.aboutme h1 img").animate({opacity: 1}, "fast");
		$($hclicked).children('img').animate({opacity: 0}, "fast");
		});
		} else {
		$nextDivA.slideToggle('normal', function() {
			$.scrollTo(this, 500, {offset:-53});
												 });
			if ($visibleDivs.length ) {
			$($hclicked).children('img').animate({opacity: 1}, "fast");
			} else {
			$($hclicked).children('img').animate({opacity: 0}, "fast");
			}
		}
		
	});
	
/*
	$("div.aboutme h1").toggle(
	function() {
	$(this).children('img').animate({opacity: 0}, "fast");
	},
	function() {
	$(this).children('img').animate({opacity: 1}, "fast");
								 });
*/
	$(window).scroll(function() {
		$(this).stop();
	});
});