 
jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

 
jQuery(function( $ ){
  if( $('li.pageBrowserPageLink > a').size() < 1 ) {
    $('.naanPageBrowserContainer').css('height', '0px');
    $('.naanPageBrowserContainer').css('overflow', 'hidden');
    $('.naanPageBrowserContainer').css('border', 'none');
    $('.naanPageBrowserContainer').css('border-top', '1px solid #DFDFDF');
    $('.naanPageBrowserContainer:last').css('border', 'none');
    $('.naanPageBrowserContainer > *').css('display', 'none');
  }

	adjustContentPadding();
	
	adjustSidebarContentHeight();

	$('a#btnToTop').click(function(){
		$.scrollTo( 0, 300 );
	});
	
	$('a[rel^="lightbox"]').fancybox({
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	true
	});
	
});

adjustContentPadding = function() {
	var contentChildren = jQuery('div#content').children();
	var firstChildClass = jQuery(contentChildren[1]).attr('class');
	//var firstChildID = jQuery(contentChildren[1]).attr('id');
	
	var checkClassId = [
		'naanPageBrowserContainer',
		'newsListContainer',
		'newsSingleContainer',
		'imgBig',
		'containerTeam',
		'newsSearchBox',
		'googleMap',
		'tx-qlsimplegallery-pi1'
	];
	
	for( i=0; i<checkClassId.length; i++ ) {		
		if( firstChildClass==checkClassId[i] ) {
			jQuery('div#content').css('padding-top', '0px');
			return true;
		}
	}
	return false;
};



adjustSidebarContentHeight = function(){
	var sidebarHeightNoPadding = jQuery('#sidebarContent').height();
	var sidebarHeight = sidebarHeightNoPadding+parseInt(jQuery('#sidebarContent').css('padding-bottom'));
	var contentHeight = jQuery('#content').height();
	var sidebarCheckHeight = sidebarHeight-42-31-parseInt(jQuery('#content').css('padding-top'));
	
	if( contentHeight < sidebarCheckHeight ) {
		//console.log('sidebar');
		jQuery('#content').height(sidebarCheckHeight+'px');
	//} else if( sidebarHeight < contentHeight ) {
	} else {
		//console.log('content');
		jQuery('#sidebarContent').height(contentHeight+42+31+parseInt(jQuery('#content').css('padding-top'))-parseInt(jQuery('#sidebarContent').css('padding-bottom'))+'px');
	}
	
};


























