$(function() {

// scrollfollow

	var iPad = /iPad/.test(navigator.userAgent);
	
	if(iPad){
		$('#navigation').scrollFollow( {
			speed: 1000,
			offset: 0,
			delay: 1000,
			container: 'main'
		});
	} else {
		$('#navigation').scrollFollow( {
			speed: 1000,
			offset: 0,
			delay: 500,
			container: 'main'
		});
	}

// page scroll

	$('a[href*=#]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			var target = $(this.hash);
			target = target.length && target;
			if (target.length) {
				var sclpos = 0;
				var scldurat = 1500;
				var targetOffset = target.offset().top - sclpos;
				
				if(iPad){
					$('html,body').stop().animate({ scrollTop: targetOffset });
				} else {
					$('html,body').stop().animate({ scrollTop: targetOffset }, { duration: scldurat, easing: "easeOutExpo"});
				}
				return false;
			}
		}
	});

// image link for news/blog

	var $newsImageLink = $('body#news .entryBody a img');
	var $blogImageLink = $('body#blog .entryBody a img');
	$newsImageLink.each(function(){
		$(this).parent().addClass('ImageLink');
	});
	$blogImageLink.each(function(){
		$(this).parent().addClass('ImageLink');
	});


// faq opener
	$('.faq a[href=#open]').click(function() {
		$(this).parents('dl').toggleClass('open');
		return false;
	});


});



