/* ***********************************************************
 * jQuery Activation Scripts 
 * 
 * Since:          2010-06-29 > Takanori Murakami
 * Last Modified:  2010-06-29 > Takanori Murakami
 * Guideline:      Ver.1.00
 * ***********************************************************
 */


/* 1) smooth scroll ---
 any <a> links to inside-page anchors */

$(document).ready(function(){
	$('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;
				$('html,body')
				.animate({scrollTop: targetOffset}, 500, "swing" );
			 return false;
			}
		}
	});
});


/* 2) jQuery lightbox activation ---
 for <a> inside any elements with classname "lightbox" */

$(function() {  
	$('.lightbox a').lightBox();  
});


/* 3) automatic nav elements activation ---
 add class="active" for <a> linking to 
 current page URL inside "body" 
 (you can specify focus of this effect 
 by changing "body" to "#nav" or ".link", for example)
 */

 $(function(){
   var path = location.pathname.substring(1);
   if ( path )
     path = path.replace( /(.+?)\/(.+?)\/.+$/ , '$1/$2/' );
     $('body a[href$="' + path + '"]').attr('class', 'active');
 });