//jQuery.noConflict();
//var $j = jQuery;

$j(document).ready(function() {

    $j('#totype').click(function() {
        offsetTop = $j('#type_lineup').offset().top;
        $j('html,body').animate({ scrollTop: (offsetTop - 10) + 'px' }, 'slow');
        return false;
    });

    $j('.totop').click(function() {
        offsetTop = $j('#container').offset().top;
        $j('html,body').animate({ scrollTop: (offsetTop - 10) + 'px' }, 'slow');
        return false;
    });

    $j('#toprice').click(function() {
        offsetTop = $j('#price').offset().top;
        $j('html,body').animate({ scrollTop: (offsetTop - 10) + 'px' }, 'slow');
        return false;
    });

    $j('#tomaterial').click(function() {
        offsetTop = $j('#material').offset().top;
        $j('html,body').animate({ scrollTop: (offsetTop - 10) + 'px' }, 'slow');
        return false;
    });

    $j('#topanel').click(function() {
        offsetTop = $j('#panel').offset().top;
        $j('html,body').animate({ scrollTop: (offsetTop - 10) + 'px' }, 'slow');
        return false;
    });

    $j('#tooption').click(function() {
        offsetTop = $j('#option').offset().top;
        $j('html,body').animate({ scrollTop: (offsetTop - 10) + 'px' }, 'slow');
        return false;
    });

	$j('.btn_hi').click(function() {
		$j('#hi_spec').show();
		$j('#zip_less').hide();
		$j('#back_zip').hide();
		$j('#low_price').hide();
	});
	$j('.btn_less').click(function() {
		$j('#hi_spec').hide();
		$j('#zip_less').show();
		$j('#back_zip').hide();
		$j('#low_price').hide();
	});
	$j('.btn_back').click(function() {
		$j('#hi_spec').hide();
		$j('#zip_less').hide();
		$j('#back_zip').show();
		$j('#low_price').hide();
	});
	$j('.btn_low').click(function() {
		$j('#hi_spec').hide();
		$j('#zip_less').hide();
		$j('#back_zip').hide();
		$j('#low_price').show();
	});

	changeTab($j('#tab_material li'), $j('.box_material'));
	changeTab($j('#tab_option li'), $j('.box_cap'));
});

function changeTab(tabObj, descObj){
	var replaceSrc = '';
	tabObj.each(function(idx){
		if (idx == 0) {
			replaceSrc = $j(this).find('img').attr('src').replace(/_off/, '_on');
			$j(this).find('img').attr('src', replaceSrc);
			descObj.eq(idx).show();
		}
		$j(this).mouseover(function(){
			tabObj.each(function(){
				replaceSrc = $j(this).find('img').attr('src').replace(/_on/, '_off');
				$j(this).find('img').attr('src', replaceSrc);
			});
			replaceSrc = $j(this).find('img').attr('src').replace(/_off/, '_on');
			$j(this).find('img').attr('src', replaceSrc);
			descObj.each(function(){
				$j(this).hide();
			});
			descObj.eq(idx).show();
		});
	});
}
