var gLastTab = 'titletab';

(function($){
  
  $(document).ready(function(){
    var options = {
      success:      processResult,
      dataType:     'html',
      type:         'post',
      url:          'index.php'
    };
    
    $.datepicker.setDefaults({yearRange:'2004:2008',showOn:'button', dateFormat:'yy-mm-dd',onSelect:changeDate, buttonImageOnly: true,  buttonImage: '/images/calendar2.gif', buttonText: 'View previous racecards'});
    $('#timeCal').datepicker(); 
  });
})(jQuery);

function changeDate(d) {
  window.location = '?index.php&day='+d;
}

function processResult( html ) {
  $('#t_'+gLastTab).empty().html(html);
}

function loadOtdWidget() {
  $.ajax({
     type: "GET",
     url: "index.php",
     data: "action=otd",
     dataType: 'html',
     success: function(html){
      $('#betWidget').empty().html(html);
			JT_init();
     }
   });
}


function __get_data( url ) {
  var data = "";
  var parts = url.split("?");
  
  if(parts.length == 2) // IE
  {
    data=parts[1];
  }

  return  data;
}
