$(document).ready(function(){
	// Whenever the page loads, check to see which radio button is set and assign tab accordingly.
	// This ensures that if the user clicks back in the browser, the tab is still set to the previous search selection.
	var checkedValue = $('input:radio["which"]:checked').val();
	if ( checkedValue == 'company' ) {
		check('c');
	}
	else if ( checkedValue == 'people' ) {
		check('p');
	}
	else {
		check('i'); 
	}
});

// Assign Classes to each tab and set selected radio button to users search selection.
function check(tab){
  $('#c').attr("class", "tab");
  $('#p').attr("class", "tab");
  $('#i').attr("class", "tab");
	$('#'+tab+'radio').attr("checked", "checked");
  $('#'+tab).attr("class", "current");
}
