$(document).ready(function(){
	$('.tabs li a').each(function(){
		if ( ! $(this).attr('href').match(/#.+/)){
			$(this).attr('href', '#' + $(this).parent().text().replace(/[^A-Za-z]/g, '').toLowerCase());
		}
	});
	
	$('.tab_content').prepend($('<div class="display">'));
	$('.tab_content div').not('.display').hide();
    $('.show_details a').click(function(){
        $('.overview_details').show();
        $('.show_details').hide();
        return false;
    });
    $('.tabs li').click(function(){
        $('.tabs li').removeClass('active');
        var currenttab = $(this).attr('class').replace(/(tab_\d+).*/, '$1');
        $(this).addClass('active');
		$('.tab_content div.display').empty();
		$('.tab_content div.' + currenttab).children().clone(true).appendTo($('.tab_content div.display'));
        // return false;
    });

	if (this.location.hash){
		$('.tabs li a[href=' + this.location.hash + ']').parent().click();
	}else{
		$('.tabs li:first').click();
	}
});

