/***************************************************
	jQuery plug-in
***************************************************/
//reccomend test close btn
$(function () {
	$('.tip_close').click(function(){
	$('#tip_madori_window').css('display','none');
	});
});


//tab
//20110906 add start
$(function() {
	var tabmenu = $("ul.tab_menu");
	var tabelm = $("ul.tab_menu").find("a");
	tabelm.click(function() {
		$(tabmenu.find("a.tab-selected").attr("href")).hide();
		
		tabmenu.find("a.tab-selected").removeClass("tab-selected");
		$(this).addClass("tab-selected");
		
		tabmenu.find("li.selected").removeClass("selected");
		$(this).parent("li").addClass("selected");
	
		$($(this).attr("href")).fadeIn("fast");
		return false;
	});
  
	tabelm.focus(function() {
		this.blur();
	});
});
/*
$(document).ready(function() {
//	var class = $(".tab_menu a")
  $(".tab_menu a").click(function() {
    $($(".tab_menu a.tab-selected").attr("href")).hide();
	
    $(".tab_menu a.tab-selected").removeClass("tab-selected");
    $(this).addClass("tab-selected");
	
    $(".tab_menu li.selected").removeClass("selected");
    $(this).parent("li").addClass("selected");

    $($(this).attr("href")).fadeIn("fast");
    return false;
  });
  
  $(".tab_menu a").focus(function() {
	this.blur();
  });
});
*/
//20110906 add end

//table stripe
$(function(){
    $(".same_article tr:even").addClass("even");
});

//smooth scroll

jQuery.fn.extend({
  scrollTo : function(speed, easing) {
    return this.each(function() {
      var targetOffset = $($(this)[0].hash).offset().top;
      $('html,body').animate({scrollTop: targetOffset}, speed, easing);
    });
  }
});

$(document).ready(function(){
  $('.smooth').click(function() {
    $(this).scrollTo(500);
    return false;
  });
});



//detail page a.photo_detail_big
$(function () {
	$("a.photo_detail_big:first").addClass("photo_detail_big_f");
});

//accordion aim
$(document).ready(function() {
	$(".aim_open").hover(function(){
		$(this).css("text-decoration","none","color","118ccc");
	},function(){
		$(this).css("text-decoration","underline");
		});
	$(".aim_wrap").css("display","none");
	$(".aim_open").click(function(){
		$(".aim_wrap").slideToggle("fast");
		});
	$("#aim_close").click(function(){
		$(".aim_wrap").slideToggle("fast");
		});
});
//accordion inqily
//20110513 delete start
//$(document).ready(function() {
//	$("#inq_note_open").hover(function(){
//		$(this).css("text-decoration","none","color","118ccc");
//	},function(){
//		$(this).css("text-decoration","underline");
//		});
//	$(".inq_note_wrap").css("display","none");
//	$("#inq_note_open").click(function(){
//		$(".inq_note_wrap").slideToggle("fast");
//		});
//	$("#inq_note_close").click(function(){
//		$(".inq_note_wrap").slideToggle("fast");
//		});
//});
//20110513 delete end
$(document).ready(function() {
	$("#mobile_notice_open").hover(function(){
		$(this).css("text-decoration","none","color","118ccc");
	},function(){
		$(this).css("text-decoration","underline");
		});
	$(".mobile_notice").css("display","none");
	$("#mobile_notice_open").click(function(){
		$(".mobile_notice").slideToggle("fast");
		});
});


// jQuery_Auto 0.9
// Automatic functions for webpages (using the wonderful jQuery library)

// Copyright: (c) 2006, Michal Tatarynowicz (tatarynowicz@gmail.com)
// Licenced as Public Domain (http://creativecommons.org/licenses/publicdomain/)
// $Id: jquery_auto.js 426 2006-05-06 19:54:39Z Micha? $
// Initialization

$.auto = {
	init: function() {
		for (module in $.auto) {
			if ($.auto[module].init)
				$.auto[module].init();
		}
	}
};

$(document).ready($.auto.init);


// Auto-hidden elements

$.auto.hide = {
	init: function() {
		$('.Hide').hide();
	}
};

// Mouse hover

$.auto.Hover = {

	init: function() {
		$('.Hover')
			.bind('mouseover', this.enter)
			.bind('mouseout', this.exit)
			.each(this.preload);
	},

	preload: function() {
		this.preloaded = new Image;
		this.preloaded.src = this.src.replace(/^(.+)(\.[a-z]+)$/, "$1_on$2");
	},

	enter: function() {
		this.src = this.src.replace(/^(.+)(\.[a-z]+)$/, "$1_on$2");
	},

	exit: function() {
		this.src = this.src.replace(/^(.+)_on(\.[a-z]+)$/, "$1$2");
	}
};
