////////////////////////////////////////////////
//
// util.js[ver1.3 100202]
//
////////////////////////////////////////////////

var pageScrollTimer;
var util = {
	preloader: {
		loadedImages: [],
		load: function (url){
			var img = this.loadedImages;
			var l = img.length;
			img[l] = new Image();
			img[l].src = url;
		}
	}
};

$(function(){	   
$('.pageTop').click(function(){pageScroll(0,7);return false;});
$('.anchor').click(function(){
	var aim = $(this).attr('href');
	pageScroll(Math.floor($(aim).offset().top),7);
	return false;
});
});

function pageScroll(toY,frms,cuY){
	if (pageScrollTimer) clearTimeout(pageScrollTimer);
	if (!toY || toY < 0) toY = 0;
	if (!cuY) cuY = 0 + $(window).scrollTop();
	if (!frms) frms = 6;
	if ((toY > cuY) && (toY > getContentsHeight() - $(window).height())){ toY = getContentsHeight() - $(window).height() +1 };
	cuY += (toY - $(window).scrollTop()) / frms;
	if (cuY < 0) cuY = 0;
	var posY = Math.floor(cuY);

	window.scrollTo(0, posY);
	if (posY != toY) {pageScrollTimer = setTimeout("pageScroll("+toY+","+frms+","+cuY+")",16);}
}

function getContentsHeight(){return ($.support.boxModel) ? $('body').height() : document.body.scrollHeight ;}
