$(function() {
	$('head').append('<script type="text/javascript" src="http://www.google-analytics.com/ga.js"></script>');

	$('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 = 30;
				var scldurat = 1200;
				var targetOffset = target.offset().top - sclpos;
				$('html,body')
					.animate({scrollTop: targetOffset}, {duration: scldurat, easing: "easeOutExpo"});
				return false;
			}
		}
	});

	$("#nav ul").hover(function() {
		$(this).find('ul').slideToggle("fast");
	}, function() {
		$(this).find('ul').slideToggle("fast");
	});
	
	$("#category_list").clone().appendTo("#sitemap");
	$("#open").click(function() { $(this).next().slideToggle("normal"); });

	var viewWidth=0;
	var showcase = new Array();
	$('#view img').each(function(i) {
		showcase[i]= viewWidth;
		viewWidth += $(this).width();
	});
	$('#view').width(viewWidth);
	$('#thumbnail a').click(function(e) {
		$('#thumbnail li').removeClass('act').addClass('inact');
		$(this).parent().addClass('act');
		var pos = $(this).parent().prevAll('#thumbnail li').length;
		$('#view').stop().animate({marginLeft:-showcase[pos]+'px'},600);
		e.preventDefault();
	});

	$('#showcase div a').lightBox();

	$(window).load(function() {
		try {
			var pageTracker = _gat._getTracker("UA-613357-9");
			pageTracker._setDomainName("baby.rhyfe.jp");
			pageTracker._trackPageview();
		} catch(err) {}
	});
});

// popup window

function popupWindow(strUrl, strWindowName, intWindowWidth, intWindowHeight, blnShowMenuBar) {

	switch (strWindowName) {
		case "PageWindow":
			intWindowWidth = 640;
			intWindowHeight = 640;
			blnShowMenuBar = 0;
			break;
	}
	var intLeftPos = (screen.width) ? (screen.width - intWindowWidth) / 2 : 0;
	var intTopPos = (screen.height) ? ((screen.height - intWindowHeight) / 2) - 30 : 0;
	var strProperty = "width=" + intWindowWidth + ",height=" + intWindowHeight + ",left=" + intLeftPos + ",top=" + intTopPos + ",menubar=" + blnShowMenuBar + ",toolbar=0,location=0,directories=0,status=1,scrollbars=1,resizable=1";
	strWindowName = window.open(strUrl, strWindowName, strProperty);
	self.onBlur = strWindowName.focus();
}