var tabCurrent = 0;

function onTabSwitch(idx, active)
{
    var i = 0;
	
	$(".hots .cd").hide();
	
    switch (active)
	{
		case 0:
            $(".hots .cd").each(function(){
		            if (i == idx) {
		                $(this).show();
			        }
			        i++;
		        });
		    break;
        case 1:
		    if (tabCurrent > 0)
			    idx = tabCurrent - 1;
			else
			    idx = 2;
            $(".hots .cd").each(function(){
		            if (i == idx) {
		                $(this).show();
			        }
			        i++;
		        });
		    break;
        case 2:
		    if (tabCurrent < 2)
			    idx = tabCurrent + 1;
			else
			    idx = 0;
            $(".hots .cd").each(function(){
		            if (i == idx) {
		                $(this).show();
			        }
			        i++;
		        });
		    break;
	}
	
	tabCurrent = idx;
}
