$(function(){
	$("h3").wrapInner('<span></span>');
	$("h4").wrapInner('<span></span>');
	
	// ---------------------------
	//	add border link image
	// ---------------------------
	$("img[src*='_thumb.gif']").addClass('cover');
	$("img[src*='_thumb.jpg']").addClass('cover');

	$("div.voice a img.cover").wrap('<div class="imgBox"></div>');
	$("div.voice a img.cover").after('<img class="loupe" src="http://www.y-genkido.com/wordpress/wp-content/themes/genkido/images/icon/loupe.gif" />');

	$("div#container").after('<br class="printFix" />');

	// ---------------------------
	//	stripe pattern
	// ---------------------------
	$('div#main .stripePattern > :nth-child(odd)').addClass("stripePattern-odd");
	$('div#main .stripePattern > :nth-child(even)').addClass("stripePattern-even");

	// ---------------------------
	//	height
	// ---------------------------
	$(window).load(function(){
		colHeight();
		TextResizeDetector.TARGET_ELEMENT_ID = 'container'; 
		TextResizeDetector.addEventListener(colHeight);
	});

	// ---------------------------
	//	jCarouselLite
	// ---------------------------
	$("div.carousel div.content").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev",
	    auto: 2800,
	    speed: 1000,
		visible : 4
	});

	$("body#publicity div.borderBox p img").addClass('cover');

});


// ------------------------------------------------------
//	colHeight
// ------------------------------------------------------
function colHeight() {
	setColHeight($("div.layout2col"), "div.box div.borderBox");
	setColHeight($("div.layout3col"), "div.box div.borderBox");
	setColHeight($("div.layout4col"), "div.box div.borderBox");

}

// ------------------------------------------------------
//	setColHeight
// ------------------------------------------------------
function setColHeight(parent, target) {
	$(parent).each(function(){
		var newHeight = 0;
		$(target, this).each(function(){
			$(this).attr("style", "height:auto;");	//リサイズ時用にリセット
			var targetHeight = $(this).height();
			if(newHeight < targetHeight){
				newHeight = targetHeight;
			}
		});
		$(target, this).each(function(){
			$(this).attr("style", "height:" + newHeight + "px;");
		});
	});
}


