var active_tab = false;
var myrules = {
'.dates_tabs' : function(el)
{
if(active_tab == false)
{
var active_tab_url = document.URL.split("#");
if(typeof(active_tab_url[1]) != "undefined")
{
active_tab = active_tab_url[1];
if(active_tab.indexOf("dates_") == -1)
{
active_tab = "dates_"+active_tab;
}
}
}
},
'.dates_tabs a' : function(el)
{
var item_id = el.href.split("#");
item_id = item_id[1];
if(active_tab == false || active_tab == item_id)
{
$(el).addClassName("active");
active_tab = item_id;
}
else
{
$(item_id).hide();
}
el.onclick = function()
{
$(active_tab).hide();
$$('.dates_tabs a').each(function(myel)
{
$(myel).removeClassName("active");
});
$(el).addClassName("active");
$(item_id).show();
active_tab = item_id;
document.location = "#"+item_id.replace(/dates_/, "");
return false;
}
},
'table.dates tr' : function(el)
{
el.onclick = function()
{
var event_id = el.id.replace(/ticket_/, "");
document.location = "./details/"+event_id+"/";
}
},
'#online_tickets select' : function(el)
{
el.onchange = function()
{
var count = 0;
$$('#online_tickets select').each(function(el)
{
count = count + parseInt(el.value);
});
if(free_tickets-count < 0)
{
$('ticket_notice').show();
$('ticket_notice_count').innerHTML = count;
$('ticket_notice_free').innerHTML = free_tickets;
$('submit_button').disable();
}
else
{
$('submit_button').enable();
$('ticket_notice').hide();
}
}
},
'.no_javascript' : function(el)
{
$(el).hide();
},
'.only_javascript' : function(el)
{
$(el).show();
},
'.country_dates h3' : function(el)
{
$(el).hide();
}
}
if( typeof Behaviour != "undefined")
Behaviour.register(myrules);