document.write(''
+ '<style  type="text/css" media="screen,print">'
+ '.toggle-box{ display:none;}'
+ '#main #product-area .product-item {display: none;}'
//+ '#main #product-area .product-item.on {display: block;}'
+ '#main #other-area .carousel-box .carousel-nav li {display: block;}'
+ '</style>');


(function($){
	/*
	 * ItemColorSelector
	 * @function
	 */
	$.fn.ItemColorSelector = function(config){

		var c = $.extend({
			'opened': 'on',
			'closed': 'off',
			'itemClass'	:	'.product-item'
		},config)

		var arr_btn   = $(this);
		var arr_panel = $(c.itemClass);
		var hash = location.hash;
		

		if(hash){
/*			setTimeout(function(){
				scrollTo(0, 0);
			},50);*/
		}
		
		
		// fnc
		arr_btn.each(function() {
			var target = $(this);
			var panel = $(target.attr("href"));
			
			target.addClass("no-scroll");
			
			
			// add class
			if( hash && target.attr('href') == hash ){
				arr_btn.removeClass(c.opened)
							 .addClass(c.closed);
				arr_panel.css({"display":"none"});
				target.addClass(c.opened);
				panel.css({"display":"block"});
			}
			if (!target.hasClass(c.opened)) {
				target.addClass(c.closed);
				panel.css({"display":"none"});
			}else {
				panel.css({"display":"block"});
			}

			target.click(function(e) {
					e.preventDefault();

					if (target.hasClass(c.closed)) {
						arr_btn.addClass(c.closed)
									 .removeClass(c.opened);
						arr_panel.css({"display":"none"});
						target.addClass(c.opened)
									.removeClass(c.closed);		
						panel.css({"display":"block"});

//							console.log('http://'+location.host+location.pathname+$(this).attr('href'));
//						location.href = 'http://'+location.host+location.pathname+$(this).attr('href');

					}
					return false;
			});

		});

	}
})(jQuery)





$(function(){

	
	/* ItemColorSelector */
	$("ul.item-color-selector a").ItemColorSelector();

	/* togglebox */
	$('.toggle-container').toggleBox();
		
	/* lightbox */
	
	var prop = {
			overlayOpacity: 0.5,
			imageLoading: '/common/images/common_bg03.gif',
			imageBtnClose: '/common/images/common_bt08.gif',
			imageBtnPrev: '/common/images/common_bt07.gif',
			imageBtnNext: '/common/images/common_bt06.gif'		
	}
	
	$('.lightbox').lightBox( prop );
	$('#set-lens a').lightBox( prop );
	
	
	$('.product-item').each(function(){
		var color = $(this).find('.strong').text();
		$(this).find('.lightbox').each(function(){
			$(this).attr('title',color);
		}).lightBox( prop );
		
	});
	
	$('.item-color-selector li:eq(4)').css('clear','both');
	$('.size .outline dt:eq(2)').css({'clear'	:	'both'});
	
	
	/* 扉ページの表示崩れ対応（高さ調整） */
	$('.products-index-01 > ul').each(function(){
		var ul = $(this);
		var li = ul.children('li');
		var tmp = [];
		var roop = (li.length%4 == 0)? li.length/4 : parseInt(li.length/4+1);

		li.each(function(i){
			var type = (i+1)%4;

			if(type == 1) {
				tmp.push('<ul><li>'+$(this).html()+'</li>');
				
			}else if(type == 2 || type == 3) {
				tmp.push('<li>'+$(this).html()+'</li>');
				
			}else if(type == 0 ){
				tmp.push('<li>'+$(this).html()+'</li></ul>');
			}
		});
		
		tmp = (li.length%4 == 0)? tmp.join('') : tmp.join('')+'</ul>';
		ul.replaceWith(tmp);

	});


})
