$(function(){
	$('li.subcateRow').each(function(){
		if($('li.current_top').length > 0)
		{
			if($('li.current_top').next().attr('id') == $(this).attr('id'))
				$(this).css('display', 'block');
			else
				$(this).css('display', 'none');
		}
		else
			$(this).css('display', 'none');
	});
	$('li.category_top').click(function(){
		var parent_obj = $(this);
		$('li.subcateRow').each(function(){
			if($(this).attr('id') == parent_obj.next().attr('id'))
				$(this).slideToggle(500);
			else
			{
				if($(this).css('display') != 'none')
					$(this).slideUp(500);
			}
		});
	});
});
$(function(e){
	var width = 960;
	var padding = (window.screen.width - width) / 2;
	$('li.category_level0').mouseover(function(){
		$(this).children('div.subcate_list').slideDown(500);
		var exceed = document.documentElement.offsetWidth - $(this).children('div.subcate_list')[0].offsetLeft - $(this).children('div.subcate_list')[0].offsetWidth < padding;
		//var excel = 
		//alert($(this).children('div.subcate_list')[0].offsetLeft - fixedLeft);
		if(exceed)
			$(this).children('div.subcate_list')[0].style.right = padding - 10 + 'px';
	});
	$('li.category_level0').mouseout(function(){
		$(this).children('div.subcate_list').hide();
	});
	$('div.subcate_list').mouseover(function(event){
		$(this).show();
		$(this).parent().addClass('act');
		event.stopPropagation();
	});
	$('div.subcate_list').mouseout(function(event){
		$(this).hide();
		$(this).parent().removeClass('act');
		event.stopPropagation();
	});
});
$(function(){
	$('#currency_select').mouseover(function(){
		$('.currency_list').show();
		$(this).addClass('hover');
	});
	$('#currency_select').mouseout(function(){
		$('.currency_list').hide();	
		$(this).removeClass('hover');		
	});
	$('.currency_list').mouseover(function(){
		$(this).show();
		$('#currency_select').addClass('hover');
	});
	$('.currency_list').mouseout(function(){
		$(this).hide();
		$('#currency_select').removeClass('hover');
	});
});

$(function(){
	$('a#expandLink').click(function(){
		$(this).prev('dl.expandBox').slideToggle(500);
	});
});
