$(function(){

// stripe code
 $('.htmlcode').each(function() {
  var lis = $(this).children();
  $(lis).find('li:odd').addClass('odd');
 });
 $('.csscode').each(function() {
  var lis = $(this).children();
  $(lis).find('li:odd').addClass('odd');
 });
 $('.jscode').each(function() {
  var lis = $(this).children();
  $(lis).find('li:odd').addClass('odd');
 });
 
 $('.archiveList').each(function() {
  var arclis = $(this).children();
  $(arclis).find('li:odd').addClass('odd');
 });


 $('.pagesNav > li:empty').each(function() {
  $(this).remove();
 });


	// auto smoose scllorer
	var url = "http://" + location.hostname + location.pathname;
	$('a[@href*="#"]').click(function() {
		var id = this.href.substring(this.href.indexOf('#'),this.href.length);
		var hrefUrl = this.href.split(id);
		if(hrefUrl[0] == url) {
			if(id == '#container') {
				$('body').addClass('body');
				$('.body').ScrollTo('slow');
				$('body').removeClass();
				return false;
			}else{
				$(id).ScrollTo('slow');
				return false;
			}
		}
	});

	


// index list

	$('#index .contents h2:first').each(function() {
		$(this).css('font-size','200%');
	});
	$('#index .contents h2:gt(0)').each(function() {
		$(this).css('font-size','150%');
	});
	$('#index .contents h2:gt(3)').each(function() {
		$(this).css('font-size','120%');
	});


//comments
	var commentOpen = '<input type="button" value="コメントする" id="commentOpen" class="submit" />';
	$('#commentsInput').css('display','none');
	$('#yourcomment').after(commentOpen);
	$('#commentOpen').one('click',function() {
		$('#commentOpen').remove();
		$('#commentsInput').show('slow');
	});





//archive list toggle
	$('dl.archiveList dd').css('display','none');
	$('.archiveList dt').toggle(function(){
    $(this).css('background',' #ebebe5 url(/common/images/ico_hide.gif) 5px center no-repeat');
    $(this).next().show('fast');
	}, function(){
    $(this).css('background',' #ebebe5 url(/common/images/ico_add.gif) 5px center no-repeat');
    $(this).next().hide('fast');
	});




//zoom img
	$('img[@class="zoom"]').hover(function(){
		$(this).css('cursor','pointer');
	},function(){
		$(this).css('cursor','inherit');
	});
	$('img[@class="zoom"]').click(function(){
		var i = this;
		var iWid = i.width;
		var iHei = i.height;
		var ext = this.src.substring(this.src.length-4,this.src.length);
		var zSrc = this.src.substring(0,this.src.length-6)+ext;
		var zoomi = new Image();
		$(i).before(zoomi);
		zoomi.src = zSrc;	zoomi.width = iWid; zoomi.height = iHei; zoomi.name = 'myzoomi'; zoomi.className = 'zoomi';
		var lWid = iWid * 2;
		var lHei = iHei * 2;
		$('.zoomi').animate({ width: lWid,height: lHei}, 500 );
		$('img[@class="zoomi"]').click(function(){
			var i = this;
			$(i).animate({ width: iWid,height: iHei}, 500 );
			var zoomOff = function(){ $(i).remove();};
			setTimeout(zoomOff,500);
		});
	});

});


// EOF
