$(document).ready(function() {
  $('.tabs > a').click(function(e) {
    var current_content_div = $(this).attr('href');
	var tmpid = current_content_div.replace(/^.*#/, '');
    $(this).siblings().removeClass('active');
    $(this).addClass('active');
    $(current_content_div).siblings().hide(); 
    $(current_content_div).show();
	$(current_content_div).attr('id', tmpid + 'tmp');
	window.location.hash = current_content_div;
	$('#' + tmpid + 'tmp').attr('id', tmpid);
    return false;
  });

  var anchor = window.location.hash;
  if (anchor != '') {
	  $('.tabs > a[href=' + anchor + ']').addClass('active');
	  $('.tabs > a[href=' + anchor + ']').trigger('click');
  } else {
	  $('.tabs > a[href=#profile_immunization]').addClass('active');
	  $('.tabs > a[href=#profile_immunization]').trigger('click');
  }

});
