//animations
var navSpeed = 500;
var navEasing = 'jswing';
var scrollSpeed = 600;
var scrollEasing = 'jswing';

//jQuery
$(document).ready(function(){
	//categories
	$('.categoryTitle').click(function(){
		if($(this).hasClass('selected')){	
			$(this).next().slideUp(navSpeed, navEasing);
			$(this).removeClass('selected');
		}else{
			$(this).addClass('selected');		   
			$(this).next().slideDown(navSpeed, navEasing);
		}	
		return false;
	});
	$('.infoTitle').click(function(){
		if($(this).hasClass('selected')){	
			$(this).next().fadeOut(100);
			$(this).removeClass('selected');
		}else{
			$(this).addClass('selected');		   
			$(this).next().fadeIn(100);
		}	
		return false;
	});

	$.extend($.ui.accordion.animations, {
		slowslide: function(options) {
			$.ui.accordion.animations.slide(options, { duration: scrollSpeed }); 
		}
	});


	$('.category').accordion({ 
		header: 'h4.thumbLink', 
		active: false, 
		alwaysOpen: false, 
		autoHeight: false ,
		collapsible: true,
		animated: 'slowslide'
	});

	
	//gallery scroll				   
	//on load
	$.scrollTo(0);
	var hashVal = window.location.hash;
	hashVal = hashVal.replace('#','#a')
	if(hashVal != ''){
		setTimeout(function(){
			$.scrollTo($(hashVal).offset().top - 110, scrollSpeed, {easing:scrollEasing});
		},300);
	}
	
	//onclick
	$('.scroll').click(function(){
		$.scrollTo($(this).next().offset().top - 110,scrollSpeed, {easing:scrollEasing});
	});
	$('.top').click(function(){
		$.scrollTo(0, scrollSpeed, {easing:scrollEasing});
	});
});

//cufon
Cufon.replace('h1, h5', { fontFamily: 'DIN-Bold' });
Cufon.replace('h2, .dinReg', { fontFamily: 'DIN-Regular' });
