/**
* common.js
**/

/* Scroll inside page */
$(document).ready(function(){
	var targetTag = navigator.userAgent.match('Safari') ? 'body' : 'html';
	$('a[href*=#]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
		&& location.hostname == this.hostname) {
			var $target = $(this.hash);
			$target = $target.length && $target
			|| $('[name=' + this.hash.slice(1) +']');
			if ($target.length) {
				var targetOffset = $target.offset().top;
				$(targetTag).animate({scrollTop: targetOffset}, 300);
				return false;
			}
		}
	});
});


/* Rollover */
$(function(){
	$('img.rollover').mouseover(function(){
		$(this).attr('src',$(this).attr('src').replace(/^(.+)(\.[a-z]+)$/, '$1-ovr$2'))
	}).mouseout(function(){
		$(this).attr('src',$(this).attr('src').replace(/^(.+)-ovr(\.[a-z]+)$/, '$1$2'));
	}).each(function(){
		$('<img>').attr('src',$(this).attr('src').replace(/^(.+)(\.[a-z]+)$/, '$1-ovr$2'))
	})
})

