
$(document).ready(function() {


  $('.neo_events_swappp').click(function() {
    
    // the value of the custom attribute 'neo_events_block' is what block to swap to.
    neo_events_swap_to($(this).attr('neo_events_block'));

    return false;
  });


  $('.neo_events_block_back_to_listing').click(function() {

    neo_events_hide_blocks();
    neo_events_show_listing();

    return false;
  });


});


function neo_events_show_listing() {
  $('#neo_events_listing').show();
}

function neo_events_hide_listing() {
  $('#neo_events_listing').hide();
}

function neo_events_hide_blocks() {
  $('.neo_events_block').hide();
}

function neo_events_hide_all() {
  neo_events_hide_listing();
  neo_events_hide_blocks();
}

function neo_events_swap_to(x) {

  neo_events_hide_all();

  var block = '#neo_events_block' + x;
  
  var eventID = document.getElementById('HI_eventID'+x).value
  
  if(document.getElementById('TicketsInner'+x).innerHTML.toLowerCase() == '<img src="/images/ajax-loader.gif">loading...')
  {
    PlanetEye.WebSite.WebService.AjaxService.GetEventTicketInfo(eventID,x,GetEventTicketInfo_Success,GetEventTicketInfo_Fail,x);
  }

  $(block).show();


  return;
}

function GetEventTicketInfo_Success(result, userContext, methodName)
{
    if(result != null && result.length > 0)
    {
        document.getElementById('TicketsInner'+userContext).innerHTML = result;
    }
}

function GetEventTicketInfo_Fail(error)
{
}

function ticketLink(brokerid,sitenumber,tgid,evtID,price,SessionId,selectID,URLHead)
{
    var linkURL = "brokerid="+brokerid+"&sitenumber="+sitenumber+"&tgid="+tgid+"&evtID="+evtID+"&price="+price+"&SessionId="+SessionId;
    
    var dropdownIndex = document.getElementById(selectID).selectedIndex;
    var treq = document.getElementById(selectID)[dropdownIndex].value;
    
    linkURL = URLHead+ linkURL+ "&treq="+treq;
    
    window.open(linkURL);
    
}


//ticketLink('{0}','{1}','{2}','{3}','{4}','{5}','{6}')
