//filter
function showFilter(option){
	var node = $('#'+option.ibox),
		fullbg = $('#'+option.fullbg),
		ct1 = $('#'+option.content1),
		ct2 = $('#'+option.content2),
		ctp1 = ct1.find('.innercontent'),
		ctp2 = ct2.find('.innercontent'),
		currentClass = 'current';
	var tabs = node.find('.tab .item'),
		conts = node.find('.inner');
	//fullbg.css({'height':$(document).height()+'px'});
	
	var timelist = node.find('.inner > ul > li').filter(function(index) {
			return $('ul', this).length > 0;
		}),
		childUL = null;
	timelist.each(function(){
		var that = $(this);
		that.addClass('hasUL');
		that.children('a').addClass('hasUlLink');
	});
	ct1.on("click",".hasUlLink",function(e){
		e.preventDefault();
		var that = $(this).parent();
		if(!window['myScroll_inner']){
			window['myScroll_inner'] = new IScroll('#'+option.content2, {
				click: true,
				scrollX: false,
				scrollY: true,
				scrollbars: true,
				interactiveScrollbars: true,
				shrinkScrollbars: 'scale',
				fadeScrollbars: true
			});
		}
		setTimeout(function(){
			ctp1.find('.hasUL_current').removeClass('hasUL_current');
			that.addClass('hasUL_current');
			ctp2.html('<ul>'+that.find('ul').html()+'</ul>').show();
			ct1.css({'width':'50%'});
			ct2.show();
			window['myScroll_inner'].refresh();
		},100);
	});
	tabs.each(function(i){
		$(this).bind("click",function(e){
			e.preventDefault();
			if($(this).attr('data-isopen')==='1'){
				hide_nav();
				return false;
			}
			tabs.attr('data-isopen','0');
			$(this).attr('data-isopen','1');
			if(!window['myScroll_parent']){
				window['myScroll_parent'] = new IScroll('#'+option.content1, {
					click: true,
					scrollX: false,
					scrollY: true,
					scrollbars: true,
					interactiveScrollbars: true,
					shrinkScrollbars: 'scale',
					fadeScrollbars: true
				});
			}
			node.addClass('filter-fixed');
			ctp1[0].innerHTML = conts.eq(i).html();
			fullbg.fadeIn('fast');
			tabs.removeClass(currentClass);
			tabs.eq(i).addClass(currentClass);
			if($(this).attr('data-hasbigid') !== undefined){
				var triggerEle = ct1.find('.hasUL[categoryid="'+$(this).attr('data-hasbigid')+'"]');
				ct1.css({'width':'50%'}).show();
				ct2.show();
				triggerEle.find('.hasUlLink').trigger('click');
			}else{
				ct2.hide();
				ct1.css('width','100%').show();
			}
			setTimeout(function(){
				window['myScroll_parent'].refresh();
			},100);
			if($(this).attr('data-more') === '1'){
				node.addClass('filter-fixed-btn');
			}else{
				node.removeClass('filter-fixed-btn');
			}
		});
	});
	fullbg.bind('click',function(e){
		e.preventDefault();
		hide_nav();
	});
	function hide_nav(){
		node.removeClass('filter-fixed').removeClass('filter-fixed-btn');
		fullbg.fadeOut('fast');
		timelist.removeClass('hasUL_current');
		tabs.removeClass(currentClass).attr('data-isopen','0');
		ct1.css('width','100%').hide();
		ct2.hide();
	}
	
	option.callback && option.callback.call(this);
}