// custom easing called "custom" 
$.easing.custom = function (x, t, b, c, d) { 
	var s = 0.80158;  
	if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
	return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; 
}

$(document).ready(function() {
	if (typeof pngfix == 'function') {
		$('.imgtofix, .bgtofix').pngfix();
		$('.normal .fun_box td').pngfix({imageFixSrc: '/images/blank.gif', sizingMethod: 'scale'});	
	}

	if (typeof onDocumentLoaded == 'function') onDocumentLoaded();
	if (typeof replaceAnchors == 'function') replaceAnchors();
});


function replaceAnchors() {
  $('a[href*="#"]').each(function(){
		var anchor = $(this);
    if (anchor.hasClass('scroll_to')) {
      anchor.click(function() {				
        var div   = anchor.attr('href');
				var after = anchor.attr('onafter');
				var y     = parseInt($(div).offset().top + $(div).scrollTop());
				//anchor.removeAttr('href');
        $(window).scrollTo({top: y, left: 0}, 500, {onAfter: function() { document.location.href = div; eval(after); }});
      });
    }
  });
}