ui tab index losses focus outside function

ui tab index losses focus outside function

Does any body know how to use the index value of a tab and pass it to other functions across the app.. 
this works as long as it is in focus of the function

$(function() {
  $("#info").tabs();
  $("#info").bind("tabsselect", function(e, tab) {
  var _itabnum = tab.index;
  
 alert("from link" + _itabnum);
 });});

----------------------------------------------------------------
//this is what I need it to do but the var loses focus





$(function() {
  $("#info").tabs();
  $("#info").bind("tabsselect", function(e, tab) {
  var _itabnum = tab.index;
 });});
alert("from link" + _itabnum);




I need to be able to call different functions base on what each tab index value is.
I hope some one can help I have been working on this for a while and I have tried all kinds of things. If you like you can visit the project in progress
http://mikecapps.com/ProjectManager/index.php