// Slideshow
$(function() {
  $('#slideshow').cycle({ 
    fx:     'fade', 
    speed:  'slow', 
    timeout: 3000,
	autostop: 0
  });
});

// CSS Support
$(function(){
  $('#footer ul').each(function(){
    $(this).find('a:not(:last)').after(' |');
  });
  $('.list-faq dd').css({'display':'none'});
  $(".list-faq dt").hover(function(){
    $(this).css('cursor','pointer'); 
	},function(){
    $(this).css('cursor','default'); 
  });
  $('.list-faq dt').click(function(){
    $(this).next().toggle();

    //return false;
  });
});


//External Link
$(function(){
  //$('a[href^="http"]').not('[href^="http://www.aoki-kodomo.com/"]').attr({ target: "_blank" }).addClass('external');
  $('a[href^="http"]').not('[href^="http://www.aoki-kodomo.com/"]').attr({ target: "_blank" }).not('a[class="non-ext-icon"]').addClass('external');
});

// active page hightlight
$(function(){
  $('#snavi li a').each(function(){
    var current = $(this).attr('href');
    if(current == location.pathname){
      $(this).addClass('active');
	}
  });
});

// img rollover
$(function(){
  $("img[src*='gnavi']").not("[src*='-on.']").each(function(){
    var imgsrc = this.src;
    var dot = this.src.lastIndexOf('.');
    var imgsrc_on = this.src.substr(0, dot) + '-on' + this.src.substr(dot, 4);
    $(this).hover(
      function(){this.src = imgsrc_on;},
      function(){this.src = imgsrc;}
    );
  });
});

// anchor scroll

$(function(){
  $('a[href^=#]').not("[href='#']").click(function() { 
  var href= this.hash; 
  var $target = $(href == '#top' ? 'body' : href);
    if($target.size()) {
      var top = $target.offset().top;
      $($.browser.safari ? 'body' : 'html').animate({scrollTop:top}, 600, 'swing');
    }
  return false;
  });
});



