$('#top_'+type).parent()[0].addClass('active');
document.getElementById('top_'+type).parentNode.setAttribute('class', 'active');