// jQuery Easing v1.3
jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
    return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

$(document).ready(function() {
	
	//fontResize
	if ($.cookie('fs') == null) {
		$.cookie('fs', 100);
	} else {
		fontResize($.cookie('fs'));
	}
	$("#font-resize a").attr('href', 'javascript:void(0);');
	$("#font-resize a").click(function() {
		fontResize($(this).attr('rel'));
		return false;
	});
	
	// easingScroll
	$('a[href^="#"]').click(function() {
		$('html:animated, body:animated').queue('fx', []).stop();
		var targetOffset = 0;
		
		var targetId = $(this).attr("href");
		if (targetId != "#") {
			if (targetId.search(/^#tabs/i) == -1) {
				targetOffset = $(targetId).offset().top;
			} else {
				return false;
			}
		}
        $('html,body').animate({ scrollTop: targetOffset }, 500, 'easeOutQuart');
		return false;
	});
	
	
	// rollOver
	
	$('.rollOver img:not([src$=_on.jpg])').rollover('_over');
	$('.rollOver input:image').rollover('_over');
	
	// mouseWheel
	if (window.addEventListener) window.addEventListener('DOMMouseScroll', wheel, false);
	window.onmousewheel = document.onmousewheel = wheel;
	// fontResize
	

});

function fontResize(percent)
{
	$("#font-resize a").removeClass('over');
		
	if (percent == 100) $("#fs-midium a").addClass('over');
	else if(percent == 140) $("#fs-large a").addClass('over');
	else if(percent == 80) $("#fs-small a").addClass('over');
	
	var fs = parseInt(percent);
	$.cookie('fs', fs);
	$("#contents").css("font-size", fs + "%");
}

function wheel()
{
	$('html:animated, body:animated').queue('fx', []).stop();
}
