var ISCSeatMap = Class.create({
tlog: TMDebug.gen_tlog( 'seatmap' ),
events: {
'continue_click': true,
'seat_selection': true,
'polygon_selection': true,
'map_init': true,
'display_map_error': true,
'nav_button_clicked': true,
'display_map_complete': true,
'show_seats_complete': true,
'show_seats_error': true,
'highlight_sections_complete': true,
'highlight_sections_error': true,
'reset_map_complete': true,
'refresh_availability_complete': true,
'refresh_availability_error': true,
'nav_drag_completed': true,
'svl_script_error': true,
'add_svl_scripts_or_data_complete': true,
'shade_complete': true
},
methods: {
'displayMap': true,
'widgetSettings': true,
'showSeats': true,
'highlightSections': true,
'resetMap': true,
'refreshAvailability': true,
'addSVLScriptsOrData': true
},
response_handler: function(response) {
false;
if (this.events[response.event_name]) {
if (this.interaction_responses[response.event_name])
this.on_interaction();
if (this[response.event_name]) {
this[response.event_name](response);
}
else {
this.generic_handler(response);
}
}
else {
false;
}
},
map_init: function(response) {
this.map_can_init = true;
if (this.flash_blocked)
this.show_flash_load_popup();
if (this.avs_good)
this.map_init_fersure();
if (this.fb_interval)
window.clearInterval(this.fb_interval);
},
map_init_fersure: function() {
this.map_initted = true;
var def = this.conf.widget_defaults;
def.customCursorMode =
(navigator && navigator.platform && navigator.platform.indexOf("Mac") != -1) ? "OFF" : "ON";
this.call_iscapp('widgetSettings', {
retMethod:                 def.retMethod,
imgURL:                    def.imgURL,
staticLangURL:             def.staticLangURL,
allowScatteredSelections:  def.allowScatteredSelections,
flexLocalConnection:       def.flexLocalConnection,
availColorMode:            def.availColorMode,
circleSeatMode:            def.circleSeatMode,
secnamPriceMap:            def.secnamPriceMap,
rotationMode:              def.rotationMode,
cssURL:                    def.cssURL,
legendMode:                def.legendMode,
toolTipHideDelay:          def.toolTipHideDelay,
highlightMode:             def.highlightMode,
customCursorMode:          def.customCursorMode,
errorAlertMode:            def.errorAlertMode,
hidePolygonsOnZoom:
this.isc.data.auto_reveal_on_zoom ? 'ON' : 'OFF'
});
false;
this.isc.search_constraints.setup();
false;
this.call_iscapp('displayMap', {
eventID:         def.eventID,
langID:          def.langID,
availabilityURL: def.availabilityURL,
mapsellURL:      def.mapsellURL,
overrideJSON:    def.overrideJSON,
channelID:       def.channelID,
svlScriptJSON:   tJSON.stringify(this.isc.search_constraints.shader_script) || def.svlScriptJSON,
svlDataJSON:     tJSON.stringify(this.isc.search_constraints.shader_data) || def.svlDataJSON
});
$(this.conf.isc_div).fire(this.conf.namespace + ':map_init', null);
},
check_timeout: function(timeout_label) {
clearTimeout(this.last_call[timeout_label]);
if (this.widget_timed_out) {
this.hide_widget_timeout();
}
},
display_map_complete: function(response) {
if ( this.fatal_error_occurred )
return;
this.time['dmc'] = (new Date()).getTime();
this.check_timeout('displayMap');
if (this.first_isc_load) {
this.first_isc_load = false;
setTimeout(
this.flash_load_popup.hide.bind(this.flash_load_popup), 0);
}
this.map_ready = true;
this.avs_start();
$(this.conf.isc_div).fire(this.conf.namespace + ':' + response.event_name, response);
},
refresh_availability_complete: function(response) {
this.check_timeout('refreshAvailability');
this.hide_refresh_polling();
this.avs_start();
$(this.conf.isc_div).fire(this.conf.namespace + ':' + response.event_name, response);
},
add_svl_scripts_or_data_complete: function(response) {
this.check_timeout('addSVLScriptsOrData');
$(this.conf.isc_div).fire(this.conf.namespace + ':' + response.event_name, response);
},
refresh_availability_error: function(response) {
this.hide_refresh_polling();
this.prevent_auto_refresh();
click_track.log_datapoint({ err_widget_timeout: 'refresh_availability_error' });
this.show_widget_timeout();
$(this.conf.isc_div).fire(this.conf.namespace + ':' + response.event_name, response);
},
add_svl_scripts_or_data_error: function(response) {
this.hide_loading_polling();
$(this.conf.isc_div).fire(this.conf.namespace + ':' + response.event_name, response);
},
display_map_error: function(response) {
this.prevent_auto_refresh();
click_track.log_datapoint({ err_widget_timeout: 'display_map_error' });
this.show_widget_timeout();
},
svl_script_error: function(response) {
this.prevent_auto_refresh();
click_track.log_datapoint({ err_widget_timeout: 'svl_script_error' });
this.show_widget_timeout();
},
show_widget_timeout: function() {
if (this.isc.edp.active_mode == 'isc') {
if (!this.time['dmc']) {
$('isc_widget_timeout_close').hide();
}
else {
$('isc_widget_timeout_close').show();
}
this.isc_widget_timeout_popup.show({
anchor_id: document.body,
popup_align: { x: 'center', y: 'center' }
});
}
},
show_widget_disabled: function() {
if (this.isc.edp.active_mode == 'isc') {
var reason = this.isc_disabled_reason || "";
if (reason.match(EDP.isc_disabled_reason_regexp)) {
click_track.log_datapoint({err_mode_selector_warning:reason});
$('isc_widget_disabled_textset_1').show();
$('isc_widget_disabled_textset_2').hide();
} else {
click_track.log_datapoint({err_isc_disabled:reason});
$('isc_widget_disabled_textset_1').hide();
$('isc_widget_disabled_textset_2').show();
}
this.prevent_auto_refresh();
this.isc_widget_disabled_popup.show({
anchor_id: document.body,
popup_align: { x: 'center', y: 'center' }
});
}
},
hide_widget_timeout: function() {
if (this.time['dmc'] && this.widget_object())
this.call_iscapp('resetMap');
this.isc_widget_timeout_popup.hide();
this.widget_timed_out = false;
},
populate_did_list: function(popup_id) {
if ($(popup_id + '_ul_id').descendants().length)
return;
var descriptions = {};
$A(edp.event.get_enabled_ticket_types()).each(function (item) {
if (item.discrete.codes) {
var desc = item.description;
if (!descriptions[desc]) {
var li = document.createElement('li');
li.innerHTML = desc;
$(popup_id + '_ul_id').appendChild(li);
descriptions[desc] = 1;
}
}
});
},
did_present: function() {
return (Discrete.id) ? true : false;
},
all_did_tts_require_password: function() {
var did_tts = [];
this.isc.edp.event.get_enabled_ticket_types().each( function(tt){
if (tt.discrete.codes.length > 0)
did_tts.push(tt);
}.bind(did_tts));
return did_tts.all( function (s) {
return (s.password == null || (s.password && s.is_locked == false)) ? false : true;
});
},
all_tts_require_password: function() {
var ticket_types = this.isc.edp.event.get_enabled_ticket_types();
for ( var i = 0 ; i < ticket_types.length ; i ++ ) {
var tt = ticket_types[i];
if ( !tt.is_locked && tt.variable_qualifier_value == 0 )
return false;
}
return true;
},
display_welcome_message: function() {
false;
if (this.interaction_detected || this.isc.edp.active_mode != 'isc' || !this.page_counters) {
return;
}
var inv = {
'matches_search':         this.page_counters[1],
'also_available':         this.page_counters[2],
'no_icon_also_available': this.page_counters[3],
'padlocked':              this.page_counters[4],
'available':              this.page_counters[1] + this.page_counters[3]
};
if (this.did_present()) {
if (this.all_did_tts_require_password()) {
false;
this.isc_joint_discrete_password_popup.show();
this.populate_did_list(this.isc_joint_discrete_password_popup.layer.id);
click_track.log_datapoint({ initial_isc_message:'discrete_pw_req', __log_only_once__: 'discrete_pw_req_message' });
}
else {
if ((inv['available']) > 0 && this.isc.data.enable_welcome_msg) {
false;
this.isc_joint_discrete_welcome_popup.show();
this.populate_did_list(this.isc_joint_discrete_welcome_popup.layer.id);
click_track.log_datapoint({ initial_isc_message:'discrete_welcome', __log_only_once__: 'discrete_welcome_message' });
}
else {
false;
this.isc_discrete_popup.show();
this.populate_did_list(this.isc_discrete_popup.layer.id);
click_track.log_datapoint({ initial_isc_message:'discrete', __log_only_once__: 'discrete_message' });
}
}
}
else {
if (this.all_tts_require_password()) {
if (inv['available'] == 0 && inv['padlocked'] > 0) {
false;
this.isc_password_popup.show();
click_track.log_datapoint({ initial_isc_message:'pw_req', __log_only_once__: 'pw_req_message' });
}
else {
false;
this.show_no_inventory_popup();
}
}
else {
if (inv['available'] > 0) {
if (this.isc.data.enable_welcome_msg) {
false;
this.isc_welcome_popup.show();
click_track.log_datapoint({ initial_isc_message:'welcome', __log_only_once__: 'welcome_message' });
}
}
else {
false;
this.show_no_inventory_popup();
}
}
}
},
show_no_inventory_popup: function() {
if ( this.conf.team_exchange.enabled ) {
this.no_inventory_team_exchange_popup.show();
click_track.log_datapoint({ initial_isc_message:'exchange', __log_only_once__: 'exchange_message' });
}
else {
this.no_inventory_popup.show();
click_track.log_datapoint({ initial_isc_message:'no_tix', __log_only_once__: 'no_tix_message' });
}
},
welcome_on_shade: function(e) {
this.display_welcome_message();
e.element().stopObserving(e.eventName, this.welcome_on_shade);
},
check_ism_issues: function() {
if ( this.isc.data.on_stage )
return false;
var pct = (this.isc.data.open_seat_percentage * 1.0) / 100;
if ( this.page_counters[0] < pct * this.avs_data.open_seats ) {
this.fatal_error_occurred = true;
clearTimeout(this.last_call['displayMap']);
this.prevent_auto_refresh();
click_track.log_datapoint(
'err_seatsdrawn_mismatch:opens=' + this.avs_data.open_seats +
':drawn=' + this.page_counters[0]);
this.isc_map_mishap_popup.show({
anchor_id: document.body,
popup_align: { x: 'center', y: 'center' }
});
return true;
}
if ( this.page_counters[0] < this.avs_data.open_seats ) {
click_track.log_datapoint(
'tracking_seatsdrawn_mismatch:opens=' +
this.avs_data.open_seats +
':drawn=' + this.page_counters[0]);
}
return false;
},
shade_complete: function(response) {
this.page_counters = response.page_counters;
if ( this.fatal_error_occurred || this.check_ism_issues() )
return;
if (this.interaction_detected == false) {
if (!this.isc.edp.event.get_enabled_ticket_types().select(function(s) {return s.is_locked;}).length ||
this.isc.search_constraints.password_rollup.getSavedPasswords().length == 0) {
this.display_welcome_message();
}
else {
false;
document.observe('isc:checked_saved_passwords', function (e) {
if (this.isc.search_constraints.password_rollup.setup_validation.valid &&
this.isc.search_constraints.password_rollup.setup_validation.valid.length) {
$(this.conf.isc_div).observe(this.conf.namespace + ':shade_complete', this.welcome_on_shade.bindAsEventListener(this));
}
else {
this.display_welcome_message();
}
}.bindAsEventListener(this));
}
}
this.check_no_match();
$(this.conf.isc_div).fire(this.conf.namespace + ':' + response.event_name, response);
},
seat_selection: function(response) {
this.hide_loading_polling();
if (response.intermediate_seat_selection != null) {
Popup.hide_group('isc-seatmap');
}
this.check_no_match();
$(this.conf.isc_div).fire(this.conf.namespace + ':' + response.event_name, response);
},
polygon_selection: function(response) {
Popup.hide_group('isc-seatmap');
$(this.conf.isc_div).fire(this.conf.namespace + ':' + response.event_name, response);
click_track.log_datapoint({ zoom_method:'polygon' });
},
nav_button_clicked: function(response) {
this.time['nbc'] = (new Date()).getTime();
if (this.time.checked == false && response.button_name &&
response.button_name == 'zoom_slider' && (this.time['nbc'] - this.time['dmc'] < 1000)) {
this.time.checked = true;
this.call_iscapp('resetMap');
}
else {
Popup.hide_group('isc-seatmap');
}
$(this.conf.isc_div).fire(this.conf.namespace + ':' + response.event_name, response);
if (response.button_name == 'zoom_in' || response.button_name == 'zoom_slider') {
click_track.log_datapoint({ zoom_method:'slider' });
}
},
generic_handler: function(response) {
false;
$(this.conf.isc_div).fire(this.conf.namespace + ':' + response.event_name, response);
},
initialize: function(conf) {
false;
this.conf = conf;
this.isc = this.conf.isc;
this.isc.seat_map = this;
this.first_isc_load = true;
this.fatal_error_occurred = false;
this.widget_timed_out = false;
this.time = { 'checked': false };
this.auto_refresh_sec = new Array();
this.auto_refresh = true;
this.get_max_popup_size();
this.check_flash();
if (this.flash_present == false) {
$('get_flash_button').observe('click', function(event) {
click_track.log_datapoint( { no_flash_get_flash:''} );
window.open('http://www.adobe.com/go/getflashplayer','_blank');
});
}
this.flash_blocked = false;
this.setup_interaction_monitor();
this.setup_idle_behavior();
this.avs_init();
this.setup_mode_monitor();
this.initialize_popups();
this.shown = this.really_shown = false;
this.map_initted = false;
this.map_can_init = false;
this.map_ready = false;
this.last_call = {};
},
get_max_popup_size: function() {
this.max_popup_size = '';
try {
this.max_popup_size = 'width=' + window.screen.availWidth + ',height=' + window.screen.availHeight;
}
catch (e) {
this.max_popup_size = 'width=800,height=600';
}
},
initialize_popups: function () {
this.no_inventory_popup = new Popup( 'no_inventory_popup', {
close_id:    [ 'no_inventory_close', 'no_inventory_close_sec' ],
drag_id:     'no_inventory_drag',
zIndex: 51,
links: [{
group:       'isc-seatmap',
anchor_id:   'map-area',
link_id:     'no_inventory_link',
popup_align: { x: -1, y: 1 },
offset:      { x: 202, y: -175 }
}]
});
if ( this.conf.team_exchange.enabled ) {
this.no_inventory_team_exchange_popup = new Popup( 'no_inventory_team_exchange_popup', {
close_id:    [ 'no_inventory_team_exchange_close', 'no_inventory_team_exchange_close_sec' ],
drag_id:     'no_inventory_team_exchange_drag',
zIndex: 51,
links: [{
group:       'isc-seatmap',
anchor_id:   'map-area',
link_id:     'no_inventory_team_exchange_link',
popup_align: { x: -1, y: 1 },
offset:      { x: 140, y: -175 }
}]
});
$('team_exchange_link_button').observe('click', function(e) {
click_track.log_datapoint( { exchange_check:'' }, false );
window.location = this.conf.team_exchange.link;
}.bindAsEventListener(this));
}
this.isc_welcome_popup = new Popup( 'isc_welcome_popup', {
close_id:    [ 'isc_welcome_close', 'isc_welcome_close_sec' ],
drag_id:     'isc_welcome_drag',
zIndex: 51,
links: [{
group:       'isc-seatmap',
anchor_id:   'map-area',
link_id:     'isc_welcome_link',
popup_align: { x: -1, y: 1 },
offset:      { x: 140, y: -175 }
}]
});
$(this.conf.take_a_tour.button_id).observe('click', function(e) {
click_track.log_datapoint( { welcome_to_tour:''} );
this.take_a_tour_popup();
}.bindAsEventListener(this));
this.isc_joint_discrete_password_popup = new Popup( 'isc_joint_discrete_password_popup', {
close_id:    [ 'isc_joint_discrete_password_close', 'isc_joint_discrete_password_close_sec' ],
drag_id:     'isc_joint_discrete_password_drag',
zIndex: 51,
links: [{
group:       'isc-seatmap',
anchor_id:   'map-area',
link_id:     'isc_joint_discrete_password_link',
popup_align: { x: -1, y: 1 },
offset:      { x: 140, y: -175 }
}]
});
this.isc_joint_discrete_welcome_popup = new Popup( 'isc_joint_discrete_welcome_popup', {
close_id:    [ 'isc_joint_discrete_welcome_close', 'isc_joint_discrete_welcome_close_sec' ],
drag_id:     'isc_joint_discrete_welcome_drag',
zIndex: 51,
links: [{
group:       'isc-seatmap',
anchor_id:   'map-area',
link_id:     'isc_joint_discrete_welcome_link',
popup_align: { x: -1, y: 1 },
offset:      { x: 140, y: -175 }
}]
});
$('isc_joint_discrete_welcome_take_tour_button').observe('click', function(e) {
click_track.log_datapoint( { discrete_welcome_to_tour:''} );
this.take_a_tour_popup();
}.bindAsEventListener(this));
this.isc_discrete_popup = new Popup( 'isc_discrete_popup', {
close_id:    [ 'isc_discrete_close', 'isc_discrete_close_sec' ],
drag_id:     'isc_discrete_drag',
zIndex: 51,
links: [{
group:       'isc-seatmap',
anchor_id:   'map-area',
link_id:     'isc_discrete_link',
popup_align: { x: -1, y: 1 },
offset:      { x: 140, y: -175 }
}]
});
this.isc_password_popup = new Popup( 'isc_password_popup', {
close_id:    [ 'isc_password_close', 'isc_password_close_sec' ],
drag_id:     'isc_password_drag',
zIndex: 51,
links: [{
group:       'isc-seatmap',
anchor_id:   'map-area',
link_id:     'isc_password_link',
popup_align: { x: -1, y: 1 },
offset:      { x: 140, y: -175 }
}]
});
this.refresh_popup = new Popup( 'refresh_popup', {
zIndex: 50
});
this.loading_popup = new Popup( 'loading_popup', {
zIndex: 50
});
this.no_match_popup = new Popup( 'no_match_popup', {
zIndex: 50
});
this.flash_load_popup = new Popup( 'flash-load-popup', {
close_id:    'flash-load-close' ,
links: [{
group:     'loadingisc',
anchor_id: 'map-area',
link_id:   'flash-load-link'
}]
});
this.flash_load_popup.update_position = function() { this.moveTo(1,1); };
this.isc_widget_timeout_popup = new Popup( 'isc_widget_timeout_popup', {
close_id:    [ 'isc_widget_timeout_close' ],
zIndex: 120,
lightbox: { opacity: 0.6, zIndex: 120 }
});
this.isc_widget_disabled_popup = new Popup( 'isc_widget_disabled_popup', {
close_id: ['isc_widget_disabled_ok_button'],
zIndex: 120,
lightbox: { opacity: 0.6, zIndex: 120 }
});
$('isc_widget_disabled_ok_button').observe('click', function(e) {
this.allow_auto_refresh();
this.isc.edp.toggle_mode();
this.isc.edp.show_isc_disabled({reason:this.isc_disabled_reason});
click_track.log_datapoint( { classic_mode_reason: this.isc_disabled_reason } );
}.bindAsEventListener(this));
this.isc_map_mishap_popup = new Popup(
'isc_map_mishap_popup', {
close_id: ['isc_map_mishap_ok_button'],
zIndex: 120,
lightbox: { opacity: 0.6, zIndex: 120 }
});
$('isc_map_mishap_ok_button').observe('click', function(e) {
this.allow_auto_refresh();
this.isc.edp.toggle_mode();
this.isc.edp.show_isc_disabled({ reason: 'map-mishap' });
}.bindAsEventListener(this));
$('isc_widget_timeout_close').observe('click', function(e) {
click_track.log_datapoint( { err_widget_timeout_close_warnings:'' } );
this.allow_auto_refresh();
this.hide_widget_timeout();
}.bindAsEventListener(this));
$('isc_widget_timeout_best_available_button').observe('click', function(e) {
click_track.log_datapoint( { err_widget_timeout_to_classic:'', switch_to:"classic" } );
this.allow_auto_refresh();
this.hide_widget_timeout();
this.isc.edp.toggle_mode();
}.bindAsEventListener(this));
$('isc_widget_timeout_refresh_button').observe('click', function(e) {
click_track.log_datapoint( { err_widget_timeout_to_refresh:'' }, false );
this.allow_auto_refresh();
window.location = window.location;
}.bindAsEventListener(this));
},
take_a_tour_popup: function() {
window.open(
this.conf.take_a_tour.url, '_blank'
);
},
setup_idle_behavior: function() {
var idle_time = (this.isc.data.browser_idle_time) ? this.isc.data.browser_idle_time : 300;
this.onidle = new OnIdle({
label:   'state:idle',
timeout: idle_time
});
document.observe('state:idle', function(e) {
this.auto_refresh = false;
this.avs_stop();
}.bindAsEventListener(this));
document.observe('state:active', function(e) {
if (this.auto_refresh == false) {
this.auto_refresh = true;
this.avs_start(0);
}
}.bindAsEventListener(this));
},
setup_mode_monitor: function() {
document.observe('edp:mode', function (e) {
if (e.memo.mode == 'isc') {
this.allow_auto_refresh();
this.display_welcome_message();
if (this.really_shown == false) {
this.check_flash();
this.really_show();
if (this.first_isc_load) {
this.avs_start(0);
}
}
}
else {
this.prevent_auto_refresh();
}
}.bindAsEventListener(this));
},
on_interaction: function(e) {
this.interaction_detected = true;
},
check_no_match: function() {
if (this.page_counters && this.page_counters[1] == 0 && this.page_counters[3] > 0) {
this.no_match_popup.show({
group:       'pollingbox',
anchor_id:   'map-area',
popup_align: { x: -1, y: -1 },
anchor_align: { x: -1, y: -1 },
offset:      { x: 5, y: 5 }
});
}
else if (this.no_match_popup.layer.style.display == '') {
this.no_match_popup.hide();
}
},
setup_interaction_monitor: function() {
this.interaction_responses = {
'polygon_selection': true,
'nav_button_clicked': true
};
this.interaction_detected = false;
this.isc.search_constraints.price_levels.register_on_price_change_handler(this.on_interaction.bind(this));
this.isc.search_constraints.price_slider.register_on_price_change_handler(this.on_interaction.bind(this));
var welcome_close_ids = [
'no_inventory_close', 'no_inventory_close_sec',
'no_inventory_team_exchange_close', 'no_inventory_team_exchange_close_sec',
'isc_welcome_close', 'isc_welcome_close_sec',
'isc_joint_discrete_password_close', 'isc_joint_discrete_password_close_sec',
'isc_joint_discrete_welcome_close', 'isc_joint_discrete_welcome_close_sec',
'isc_discrete_close', 'isc_discrete_close_sec',
'isc_password_close', 'isc_password_close_sec'
];
for (var i = 0; i < welcome_close_ids.length; i++) {
$(welcome_close_ids[i]).observe('click', this.on_interaction.bind(this));
}
},
widget_object: function() {
var obj = $(this.conf.isc_div + '-anchor').childElements();
if (Prototype.Browser['IE']) {
return (window[obj[0].id].mapFunction) ? obj[0].id : null;
}
else {
return (document[obj[0].id].mapFunction) ? obj[0].id : null;
}
},
refresh_availability: function() {
this.call_iscapp('refreshAvailability');
this.show_refresh_polling();
},
call_iscapp: function(method_name, params) {
var result = -1;
if (this.methods[method_name]) {
var obj_id = this.widget_object();
if (obj_id) {
false;
try {
if (method_name == 'refreshAvailability' || method_name == 'addSVLScriptsOrData' || method_name == 'displayMap') {
this.last_call[method_name] = setTimeout(function () {
this.widget_timed_out = true;
this.prevent_auto_refresh();
click_track.timeout_method_name = 'timeout:' + method_name;
click_track.log_datapoint({ err_widget_timeout: click_track.timeout_method_name });
this.show_widget_timeout();
}.bind(this), this.isc.data.widget_timeout * 1000);
}
false;
var json_params = tJSON.stringify(params);
if (Prototype.Browser['IE']) {
result = window[obj_id].mapFunction(method_name, json_params);
}
else{
result = document[obj_id].mapFunction(method_name, json_params);
}
false;
}
catch (e) {
false;
}
}
else {
false;
}
}
else {
false;
}
return result;
},
show: function() {
if (this.flash_present) {
this.shown = true;
offset = this._calculate_offset('tabContent', this.conf.isc_div, this.conf.isc_div + '-locator');
$(this.conf.isc_div + '-anchor').style.left = offset[0] + 'px';
$(this.conf.isc_div + '-anchor').style.top = offset[1] + 'px';
}
else if (this.flash_present == false) {
this._show_flash_required();
}
if (!this.first_isc_load) {
this.allow_auto_refresh();
}
},
really_show: function() {
if (this.flash_present) {
this.really_shown = true;
$(this.conf.isc_div + '-anchor').style.display = '';
offset = this._calculate_offset('tabContent', this.conf.isc_div, this.conf.isc_div + '-locator');
$(this.conf.isc_div + '-anchor').style.left = offset[0] + 'px';
$(this.conf.isc_div + '-anchor').style.top = offset[1] + 'px';
$(this.conf.isc_div + '-locator').style.visibility = 'visible';
this.show_flash_load_popup();
}
else if (this.flash_present == false) {
this._show_flash_required();
click_track.log_datapoint({ initial_isc_message:'no_flash' });
}
},
show_flash_load_popup: function() {
if (this.flash_present && this.first_isc_load) {
this.flash_load_popup.show();
$('flash-load-popup').style.borderColor = '#FFFFFF';
$('flash-load-content').style.display = (Prototype.Browser['IE']) ? 'block' : 'table-cell';
$('flash-load-content').style.position = 'absolute';
$('flash-load-content').style.top = (220 - Math.floor(75 + $$('h2')[0].getHeight() / 2)) + 'px';
$('flash-load-content').style.left = '0px';
if (Prototype.Browser['Gecko']) {
this.fb_interval = window.setInterval(function() {
var obj = $(this.conf.isc_div + '-anchor').childElements();
if (obj[0].readAttribute('bgInactive')) {
this.flash_blocked = true;
this.flash_load_popup.hide();
window.clearInterval(this.fb_interval);
this.fb_interval = null;
}
}.bind(this), 250);
}
else {
this.fb_interval = null;
}
}
},
hide: function() {
if (this.flash_present) {
this.shown = this.really_shown = false;
$(this.conf.isc_div + '-anchor').style.left = "-1200px";
$(this.conf.isc_div + '-anchor').style.top = "-1200px";
}
else if (this.flash_present == false) {
this._hide_flash_required();
}
Popup.hide_group('isc-seatmap');
Popup.hide_group('pollingbox');
Popup.hide_group('loadingisc');
},
check_flash: function() {
if (!DetectFlashVer(9,0,0)) {
this.flash_present = false;
this.prevent_auto_refresh();
}
else {
this.flash_present = true;
}
},
show_refresh_polling: function() {
this.refresh_popup.show({
group:       'pollingbox',
anchor_id:   'map-area',
popup_align: { x: -1, y: -1 },
anchor_align: { x: -1, y: -1 },
offset:      { x: 5, y: 5 }
});
},
hide_refresh_polling: function() {
this.refresh_popup.hide();
},
show_loading_polling: function() {
Popup.hide_group('isc-seatmap');
this.loading_popup.show( {
group:       'pollingbox',
anchor_id:   'map-area',
popup_align: { x: -1, y: -1 },
anchor_align: { x: -1, y: -1 },
offset:      { x: 5, y: 5 }
} );
},
hide_loading_polling: function() {
this.loading_popup.hide();
},
prevent_auto_refresh: function() {
this.auto_refresh_sec.push(1);
},
allow_auto_refresh: function() {
this.auto_refresh_sec.pop();
},
is_isc_disabled: function(etag) {
if ( etag.match(/^"disabled/) ) {
this.isc_disabled_reason = etag.replace(/"|disabled-/g,'');
return true;
} else {
return false;
}
},
avs_state: { last: null, loaded: null },
avs_good: false,
avs_init: function () {
this.avs_start(0);
},
avs_request: function() {
if (this.avs_can_refresh()) {
new Ajax.Request(this.conf.widget_defaults.availabilityURL, {
method: 'get',
evalJS: false,
evalJSON: false,
onComplete: this.avs_response.bind(this)
});
}
else {
this.avs_start();
}
},
avs_response: function(transport) {
var etag = transport.getHeader('ETag');
var new_etag = etag != this.avs_state.last;
this.avs_state.last = etag;
if (transport.status >= 400 || (new_etag && etag == '"error"')) {
this.prevent_auto_refresh();
click_track.log_datapoint({ err_widget_timeout: 'avs_error' });
this.show_widget_timeout();
}
else if (etag == null) {
if (this.avs_can_refresh())
this.avs_load_new_data(null, transport.responseXML.documentElement);
}
else if (this.is_isc_disabled(etag)) {
this.show_widget_disabled();
return;
}
else if (new_etag && etag != '"busy"' &&
this.avs_can_refresh() && etag != this.avs_state.loaded) {
this.avs_load_new_data(etag, transport.responseXML.documentElement);
return;
}
this.avs_start(etag == '"busy"' ? this.isc.data.busy_refresh_freq : null);
},
avs_pending: null,
avs_start: function (delay) {
this.avs_stop();
if (delay == null)
delay = this.isc.data.auto_refresh_freq;
this.avs_pending = setTimeout(this.avs_request.bind(this), delay * 1000);
},
avs_stop: function () {
if (this.avs_pending) {
clearTimeout(this.avs_pending);
this.avs_pending = null;
}
},
avs_can_refresh: function () {
return (this.auto_refresh && this.auto_refresh_sec.size() < 1);
},
avs_load_new_data: function (etag, xml) {
var opens = xml.getElementsByTagName('open_seats');
this.avs_data = {
open_seats: opens.length ? opens[0].firstChild.textContent : 0
};
this.avs_good = true;
this.avs_state.loaded = etag;
if (!this.map_can_init) {
}
else if (!this.map_initted) {
this.map_init_fersure();
}
else if (!this.map_ready) {
this.avs_state.last = null;
}
else {
this.refresh_availability();
}
},
_show_flash_required: function() {
this._show_resize($('opacity'), $('search_and_isc'));
this._show_resize($('wrap-block'), $('search_and_isc'));
},
_hide_flash_required: function() {
$('opacity').style.display = "none";
$('wrap-block').style.display = "none";
},
_show_resize: function(target, source) {
target.style.display = "";
var dimensions    = source.getDimensions();
target.style.height = dimensions.height + 'px';
target.style.width  = dimensions.width + 'px';
target.style.top    = '0px';
target.style.left   = '0px';
},
_calculate_offset: function(pivot, source, target) {
p_position = $(source).cumulativeOffset();
s_position = $(source).cumulativeOffset();
t_position = $(target).cumulativeOffset();
return [
(s_position[0] - p_position[0]) - (t_position[0] - p_position[0]),
(s_position[1] - p_position[1]) - (t_position[1] - p_position[1])
];
}
});

