function pageScroll(target){
	$.scrollTo(target,{
		duration:1400,
		easing:'easeOutExpo',
		offset:-24,
		onAfter:function(){
			var hash=/^\[name=(.+)\]$/.exec(target)
			if(hash)
				document.location.hash=hash[1]
			else
				if(target=='0')
					location.hash=''
		}
	})
}

$(window).bind('load hashchange',function(){
	if(location.hash.length>1)
		pageScroll('section[name='+location.hash+']')
})

$(function(){
	$('.read-more-box')._fw({
		shadowBox:{
			links:'a[rel=popup]'
		}
	})
	
	$('nav a')
		.click(function(){
			var href=$(this).attr('href')
			pageScroll('[name='+href+']')
			return false
		})
	
	var dbody=$(window)._scrollable(),
		scrollTop=$('.scrollTop').hide(),
		st_vis=false
	$(window).bind('scroll',function(e){
		if(!st_vis&&dbody.attr('scrollTop')>300)
			scrollTop.fadeIn(),
			st_vis=true
		if(st_vis&&dbody.attr('scrollTop')<=300)
			scrollTop.fadeOut(),
			st_vis=false
	})
	
	dbody.bind('mousewheel',function(){
		dbody.stop()
	})
	
	scrollTop.click(function(){
		pageScroll('0')
		return false
	})
	
	$('#search')
		._fw({
			forms:{				
			}
		})
	$('#form1')
		._fw({
			forms:{
				backBu:'<a href="#" class="btn cb">back</a>',
				afterFu:function(){
					Cufon.refresh()
				}
			}
		})
	
	$('.btn')
		.live('mouseenter',function(){
			$(this)
				.stop()
				.animate({
					paddingLeft:40,
					paddingRight:40,
					left:-14
				},{
					easing:'easeOutBounce'
				})
		})
		.live('mouseleave',function(){
			$(this)
				.stop()
				.animate({
					paddingLeft:26,
					paddingRight:26,
					left:0
				},{
					easing:'easeOutBounce'
				})
		})
		
	$('.list a')
		.bind('mouseenter',function(){
			$(this)
				.stop()
				.animate({backgroundPosition:'10px 50%'},150)
				.animate({backgroundPosition:'0 50%'},150)
		})
		.bind('mouseleave',function(){
			$(this)
				.stop()
				.animate({backgroundPosition:'0 50%'},150)
		})
})
