PopupLightboxDialog = Class.create( Popup, {
initialize: function( $super, id, options ) {
this.id = id;
this.el = $(id);
options = Object.extend( {
zIndex: 110,
lightbox: { opacity: 0.6 }
}, options || {} );
var close_box = this.get_element(".close_box");
if( close_box != null ) {
Event.observe( close_box, 'click', this.close.bind( this ) );
}
$super( id, options );
},
close: function() {
if ( this.dialog_chain ) {
this.dialog_chain.cancel();
}
else {
this.hide();
}
},
get_element: function( selectors ) {
return this.get_elements( selectors )[0];
},
get_elements: function( selectors ) {
return $$( "#" + this.id + " " + selectors );
},
build_omnidata: function( tag ) {
var te = this.context.is_exchange ? " TE: " : " ";
var omnidata = {
channel: omn_domain_owner + te + 'Checkout',
prop1: omn_domain_owner + te + 'Checkout',
pageName: omn_domain_owner + te + 'Checkout: ' + tag,
prop16: omn_domain_owner + te + 'Checkout: ' + tag,
prop2: omn_domain_owner + ' Checkout',
prop3: omn_domain_owner + ' Checkout'
};
if ( !this.context.is_exchange ) {
omnidata.prop1 = omnidata.prop16;
}
return omnidata;
},
omnitrack_page: function( omnidata ) {
var omnitrackpage = new omniCustomClick( omnidata,
clickLink = '',
newPage = true
);
omnitrackpage.handleClick();
},
omniview: function( tag ) {
this.omnitrack_page( this.build_omnidata( tag ) );
},
show: function( $super, event ) {
if ( event ) {
Event.stop( event );
}
$super( {
anchor_id: document.body,
popup_align: { x: 'center', y: 'center' }
} );
if( this.get_element(".right") != null ) {
this.get_element(".left").style.width =
this.get_element(".lightbox-lid").getWidth() -
this.get_element(".right").getWidth() - 10 + "px";
}
}
} );
ChoiceStreamActivity = Class.create( {
initialize: function( options ) {
var choicestream_sid_cookie = GetCookie("SID") || '';
this.cookie_id = hex_md5(choicestream_sid_cookie);
this.member_id = GetCookie("MID_MD5");
this.api_key = options.api_key;
this.context_label = options.context_label;
},
send_activity: function ( activity ) {
if ( csAny ) {
var r = new csAny.Request();
r.addActivity( activity );
var c = new csAny.Context( this.context_label );
c.setApiKey( this.api_key );
if( this.member_id ){
c.setUserId( this.member_id );
}
c.setCookieId( this.cookie_id );
r.setContext( c );
r.send();
}
},
cart_item_adds: function( item ) {
if ( csAny ) {
var add = new csAny.Activity("cart_item_adds");
add.setAttribute("item_id", item );
add.setAttribute("appcontext", "an add" );
this.send_activity( add );
}
},
cart_item_drops: function( item ) {
if ( csAny ) {
var drop = new csAny.Activity("cart_item_drops");
drop.setAttribute("item_id", item );
drop.setAttribute("appcontext", "a drop" );
this.send_activity( drop );
}
}
} );
function add_delivery_and_upsell_choices ( data ) {
if ( document.forms.DeliveryOpts ) {
var options = document.forms.DeliveryOpts.vv_delivery_choice;
if ( typeof( options ) != 'undefined' ) {
if ( Object.isElement( options ) ) {
options = [ options ];
}
for ( var i = 0 ; i < options.length ; i ++ ) {
var option = options[i];
if ( option.checked ) {
data.vv_delivery_choice = option.value;
break;
}
}
}
}
jQuery.find("span.upsell_quantity").each( function( dropdown ) {
var $dropdown = jQuery( dropdown );
var value = $dropdown.tmDropdown( 'get_value' );
if ( value > 0 ) {
data[$dropdown.tmDropdown( 'get_input_name' )] = value;
}
} );
}
SaveToCart = Class.create( {
initialize: function( options ) {
this.cs_item_id = options.cs_item_id;
},
check: function( context ) {
if ( context.save_to_cart ) {
this.context = context;
this.save();
return true;
}
return false;
},
save: function() {
var data = {
command: "save_my_cart",
type: this.context.save_type
};
add_delivery_and_upsell_choices( data );
new Ajax.Request( this.context.reserve_uri, {
method: 'post',
evalJS: false,
evalJSON: false,
postBody: MooHash.toQueryString( data ),
onSuccess: this.on_save_success.bind( this ),
onFailure: this.on_save_failure.bind( this ),
onException: this.on_save_exception.bind( this )
} );
if ( typeof(cs_activity) != 'undefined' ) {
cs_activity.cart_item_adds( this.cs_item_id );
}
},
on_save_success: function( transport ) {
if ( !transport.responseText ) {
this.go_to_edp();
}
else {
var data = transport.responseText.evalJSON();
if ( data.error ) {
if ( data.error.timeout ) {
this.context.error = data.error;
this.dialog_chain.next();
}
else {
this.go_to_edp();
}
}
else {
var tm_omn=window.tm_omn;
tm_omn.linkTrackVars='events';
tm_omn.linkTrackEvents='event42,event43';
tm_omn.events='event42,event43';
tm_omn.tl(true,'o','Save to Cart');
this.go_to_cart( data );
}
}
},
go_to_edp: function() {
TMCookie.set( 'CART_SAVE_FAIL', this.context.event_id );
window.location = this.context.edp_url;
},
on_save_failure: function( transport ) {
var data = transport.responseText.evalJSON();
this.dialog_chain.next();
},
on_save_exception: function( transport ) {
var data = transport.responseText.evalJSON();
this.go_to_cart();
},
go_to_cart: function( data ) {
var form = new Element( 'form', { method: "POST", action: this.context.cart_url } );
if ( data.carrot ) {
var carrot = new Element( 'input', { input: "hidden", name: "carrot", value: data.carrot } );
form.appendChild( carrot );
}
var div = new Element( 'div', { style:"position:absolute;left:-10000px" } );
div.appendChild( form );
document.body.appendChild( div );
form.submit();
}
} );
SaveToCartDialog = Class.create( PopupLightboxDialog, {
initialize: function( $super, options ) {
$super( 'save_to_cart_dialog' );
this._showCallBack = options ? options.showCallBack : null;
Event.observe( this.get_element('.save'), 'click', this.save.bind( this ) );
Event.observe( this.get_element('.complete_order'), 'click', this.complete_order.bind( this ) );
},
showCallBack: function( instance ){
if( this._showCallBack && typeof this._showCallBack == 'function' ){
this._showCallBack( instance, this );
}
},
check: function( context ) { this.context = context; return true; },
close: function( $super ) {
omniTracking.navigation_link( this.context.omnitrack_prefix + "SavetocartClose" );
$super();
},
save: function() {
omniTracking.module_link( this.context.omnitrack_prefix + "SavetocartConf", false, {
prop19: this.context.event_id
} );
this.context.save_to_cart = true;
this.dialog_chain.next();
},
disable_buttons: function() {
this.get_element('.save').disabled = 'disabled';
this.get_element('.complete_order').disabled = 'disabled';
},
enable_buttons: function() {
this.get_element('.save').disabled = '';
this.get_element('.complete_order').disabled = '';
},
complete_order: function() {
omniTracking.navigation_link( this.context.omnitrack_prefix + "SavetocartComplete" );
this.disable_buttons();
var form = $$('.complete-order-form')[0];
if ( !Object.isUndefined(window.validate_delivery_form) ) {
if ( !validate_delivery_form.bind( form )() ) {
this.enable_buttons();
this.dialog_chain.cancel();
return;
}
}
form.submit();
}
} );
CheckoutTimeoutDialog = Class.create( PopupLightboxDialog, {
initialize: function( $super, options ) {
$super( 'checkout_timeout_dialog' );
this.save_element = this.get_element('.save');
if ( this.save_element ) {
Event.observe( this.save_element, 'click', this.save.bind( this ) );
}
this._showCallBack = options ? options.showCallBack : null;
this.repeat_search_element = this.get_element('.repeat_search');
if ( this.repeat_search_element ) {
Event.observe( this.repeat_search_element, 'click', this.repeat_search.bind( this ) );
}
},
check: function( context ) {
this.context = context;
return true;
},
show: function( $super ) {
$super();
var omnidata = this.build_omnidata( 'Time Limit Exceeded' );
if ( this.save_element ) {
omnidata.prop16 = omnidata.prop16 + ' with Save to Cart';
}
else {
omnidata.prop16 = omnidata.prop16 + ' without Save to Cart';
}
this.omnitrack_page( omnidata );
},
showCallBack: function( instance ){
if( this._showCallBack && typeof this._showCallBack == 'function' ){
this._showCallBack( instance, this );
}
},
save: function() {
omniTracking.navigation_link2( "carttimeout_click_Savetocart", {
tracking_vars: {
prop19: this.context.event_id
}
} );
this.context.save_to_cart = true;
this.dialog_chain.next();
},
repeat_search: function() {
omniTracking.navigation_link( "carttimeout_click_CartTryAgain" );
this.dialog_chain.next();
}
} );
AbandonCheckoutDialog = Class.create( PopupLightboxDialog, {
initialize: function( $super ) {
$super( 'abandon_checkout_dialog' );
var save = this.get_element('.save');
if ( save ) {
Event.observe( save, 'click', this.save.bind( this ) );
}
Event.observe( this.get_element('.decline'), 'click', this.decline.bind( this ) );
},
check: function( context ) { this.context = context; return true; },
save: function() {
omniTracking.navigation_link2( "cartabandon_click_Savetocart", {
tracking_vars: {
prop19: this.context.event_id
}
} );
this.context.save_to_cart = true;
this.dialog_chain.next();
},
decline: function() {
omniTracking.navigation_link( "cartabandon_click_SaveNothanks" );
if ( this.on_back_button ) {
window.history.go(-1);
}
else {
window.location = this.return_uri;
}
},
show: function( $super, event ) {
if ( this.context.event.eventName == DetectBackButton.EVENT_NAME ) {
this.on_back_button = true;
}
else {
this.on_back_button = false;
this.return_uri = this.context.event.target.href;
}
$super( event );
this.omniview( 'Save to Cart Abandon' );
return false;
}
} );
SessionExpiredDialog = Class.create( PopupLightboxDialog, {
initialize: function( $super ) {
$super( 'session_expired_dialog' );
Event.observe( this.get_element('.start-again'), 'click', this.start_again.bind( this ) );
},
check: function( context ) {
if ( context.error ) {
this.context = context;
return true;
}
else {
return false;
}
},
start_again: function() {
omniTracking.navigation_link( "sessiontimeout_click_StartAgain" );
window.location = this.context.edp_url;
},
show: function( $super, event ) {
$super( event );
this.omniview( 'Session Timeout' );
return false;
}
} );
RecaptchaDialog = Class.create( Popup, {
tlog: TMDebug.gen_tlog( 'isc-recaptcha' ),
initialize: function( $super ) {
$super( 'cart_recaptcha_dialog', {
zIndex: 110,
lightbox: { opacity: 0.6 }
} );
Event.observe( $('recaptcha_try_another'), 'click', this.on_try_another.bind( this ) );
Event.observe( $('recaptcha_audio_mode'), 'click', this.on_audio_mode.bind( this ) );
Event.observe( $('recaptcha_image_mode'), 'click', this.on_image_mode.bind( this ) );
Event.observe( $('recaptcha_help'), 'click', this.on_help.bind( this ) );
Event.observe( $('recaptcha_continue'), 'click', this.verify_input.bind( this ) );
Event.observe( $('recaptcha_form'), 'submit', this.verify_input.bind( this ) );
Event.observe( $('recaptcha_cancel'), 'click', this.cancel.bind( this ) );
Event.observe( $("recaptcha_response_field") , 'keydown' , this.textfieldKeyDown.bind( this ) );
},
on_try_another: function( event ) {
this.reset_errors();
this.reload();
},
on_audio_mode: function( event ) {
this.reset_errors();
this.current_recaptcha_type = 'audio';
window.setTimeout( Recaptcha.switch_type.bind( Recaptcha, this.current_recaptcha_type ), 0 );
this.update_input_type_display();
},
on_image_mode: function( event ) {
this.reset_errors();
this.current_recaptcha_type = 'image';
window.setTimeout( Recaptcha.switch_type.bind( Recaptcha, this.current_recaptcha_type ), 0 );
this.update_input_type_display();
this.tabRound = 0;
},
update_input_type_display: function() {
if( this.current_recaptcha_type == 'image' ) {
$('recaptcha_image_prompt').show();
$('recaptcha_audio_prompt').hide();
$('recaptcha_audio_mode').show();
$('recaptcha_image_mode').hide();
}
else {
$('recaptcha_image_prompt').hide();
$('recaptcha_audio_prompt').show();
$('recaptcha_audio_mode').hide();
$('recaptcha_image_mode').show();
}
},
on_help: function( event ) {
var new_win = window.open(
$('recaptcha_help').href,
$('recaptcha_help').target,
'scrollbars=yes,status=no,resizable=no,width=500,height=300'
);
if (window.focus)
new_win.focus();
Event.stop( event );
return false;
},
cancel: function() {
this.dialog_chain.cancel();
window.setTimeout( Recaptcha.destroy.bind( Recaptcha ), 0 );
},
tabRound:0,
textfieldKeyDown: function(event){
var linkArray = $("recaptcha_image").select("a");
if ( ( event.keyCode == 9 || event.keyCode == 0 ) && this.tabRound == 0 && linkArray.length > 0 ){
event.stop();
linkArray[0].focus();
this.tabRound++;
}
},
check: function( context ) {
false;
this.context = context;
this.cart = context.cart;
this.prepare_recaptcha();
return true;
},
reset_errors: function() {
$('recaptcha_error_message').hide();
var nodes = $('recaptcha_error_messages').childElements();
for ( var i = 0 ; i < nodes.length ; i ++ )
nodes[i].hide();
},
show_error: function( error ) {
$('recaptcha_error_message').show();
var id = 'recaptcha_' + error;
$(id).show();
},
verify_input: function( event ) {
window.setTimeout( Recaptcha.ajax_verify.bind( Recaptcha, this.on_input_verified.bind( this ) ), 0 );
},
on_input_verified: function( data ) {
if ( data.is_correct ) {
this.context.verify_psig = data.verify_psig;
this.dialog_chain.next();
window.setTimeout( Recaptcha.destroy.bind( Recaptcha ), 0 );
}
else {
this.reset_errors();
this.show_error( 'match_error' );
this.reload();
}
},
reload: function() {
window.setTimeout( Recaptcha.reload.bind( Recaptcha ), 0 );
},
prepare_recaptcha: function() {
var data = {
command: 'create_captcha',
domain: this.context.recaptcha_domain
};
new SJAX( this.context.reserve_uri, {
on_success: this.on_prepare_recaptcha_success.bind( this ),
on_failure: this.on_prepare_recaptcha_failure.bind( this ),
data: data,
timeout: 30 * 1000
} );
},
on_prepare_recaptcha_success: function( data ) {
if (data.type == "reCAPTCHA") {
this.show_recaptcha();
this.create_recaptcha( data );
}
else {
this.dialog_chain.next();
}
},
on_prepare_recaptcha_failure: function() {
this.context.errors = {
failure: { recaptcha: 1 }
};
this.dialog_chain.next();
},
create_recaptcha: function( data ) {
this.expires = (new Date() - 0) + data.timeout * 1000;
window.setTimeout(
Recaptcha.create.bind( Recaptcha,
data.public_key,
"",
{
theme: "custom",
tabindex: 0,
callback: Recaptcha.focus_response_field,
extra_challenge_params: data.params,
lang: data.lang
}
), 0 );
},
show_recaptcha: function() {
this.reset_errors();
if ( this.context.errors ) {
if ( this.context.errors.timeout && this.context.errors.timeout.recaptcha )
this.show_error( 'expired' );
delete this.context.errors;
}
this.current_recaptcha_type = 'image';
this.update_input_type_display();
this.show( {
anchor_id: document.body,
popup_align: { x: 'center', y: 'center' }
} );
}
} );
ISMRecaptchaDialog = Class.create( RecaptchaDialog, {
show_recaptcha: function( $super ) {
$super();
var custLinkrecapISM = new omniCustomClick({
events: 'event8,event15',
products: ';' + tm_omni_temp.get('omnEID') + ';;;event8=' + this.cart.items.length ,
channel: omn_domain_owner + ' Checkout: Recaptcha',
prop1: omn_domain_owner + ' Checkout: Recaptcha: ISM EDP',
prop4: tm_omn.pageName,
pageName: omn_domain_owner + ' Checkout: Recaptcha: ISM EDP',
prop16: tm_omn.prop16.gsub(/EDP: ISM:/,'Checkout: Recaptcha: ISM EDP:'),
prop2: omn_domain_owner + ' Checkout',
prop3: omn_domain_owner + ' Checkout',
eVar23: "",
eVar24: "",
eVar29: "",
eVar34: 'Interactive Seat Map'
},
clickLink = '',
newPage = true
);
custLinkrecapISM.handleClick();
}
} );
CheckoutRecaptchaDialog = Class.create( RecaptchaDialog, {
omnitrack_page: function( location ) {
var te = this.context.is_exchange ? " TE: " : " ";
var omnidata = {
channel: omn_domain_owner + te + 'Checkout',
prop1: omn_domain_owner + te + 'Checkout',
pageName: omn_domain_owner + te + 'Checkout: Recaptcha: ' + location,
prop16: omn_domain_owner + te + 'Checkout: Recaptcha: ' + location,
prop2: omn_domain_owner + ' Checkout',
prop3: omn_domain_owner + ' Checkout'
};
if ( !this.context.is_exchange ) {
omnidata.channel = omnidata.channel + ': Recaptcha';
omnidata.prop1 = omnidata.pageName;
omnidata.prop16 = omnidata.prop16 + ': ' +
this.context.artist_id + ': ' +
this.context.artist_name;
}
var omnitrackpage = new omniCustomClick( omnidata,
clickLink = '',
newPage = true
);
omnitrackpage.handleClick();
}
} );
MyCartRecaptchaDialog = Class.create( CheckoutRecaptchaDialog, {
show_recaptcha: function( $super ) {
$super();
this.omnitrack_page( 'MyCart' );
}
} );
RepeatSearchRecaptchaDialog = Class.create( CheckoutRecaptchaDialog, {
show_recaptcha: function( $super ) {
$super();
this.omnitrack_page( 'Checkout' );
}
} );
ReservePollingDialog = Class.create( Popup, {
tlog: TMDebug.gen_tlog( 'isc-reserve' ),
initialize: function( $super ) {
$super( 'reserve_polling_dialog', {
zIndex: 110,
lightbox: { opacity: 0.6 }
} );
this.init_time_messages = Polling.prototype.init_time_messages;
this.clear_all_time_messages = Polling.prototype.clear_all_time_messages;
this.show_message = Polling.prototype.show_message;
this.update_time_remaining = Polling.prototype.update_time_remaining;
this.init_time_messages();
},
check: function( context, options ) {
false;
options = options || {};
if ( context.errors ) {
return false;
}
else {
this.context = context;
this.seats_reordered = false;
this.reserve_token = false;
if ( !options.do_not_start_polling ) {
this.start_polling();
}
this.prepare_reserve();
return true;
}
},
start_polling: function() {
this.show_polling( {
init: true,
poll: { queue_wait: 0 }
} );
},
start_reserve: function( data ) {
if ( this.context.polling_ad ) {
if ( this.context.suppress_polling_ad ) {
this.context.polling_ad.hide();
}
this.context.trigger_ad = true;
}
else {
$('polling_ad').hide();
}
new SJAX( this.context.reserve_uri, {
on_success: this.on_reserve_polling_response.bind( this ),
on_failure: this.on_reserve_polling_failure.bind( this ),
data: data,
timeout: 30 * 1000
} );
},
stop_polling: function() {
if ( this.poll_timeout ) {
window.clearTimeout( this.poll_timeout );
delete this.poll_timeout;
}
},
on_reserve_polling_failure: function() {
this.stop_polling();
this.context.errors = {
failure: { polling: 1 }
};
this.dialog_chain.next();
},
poll: function( data ) {
false;
this.show_polling( data );
new SJAX( data.uri, {
on_success: this.on_reserve_polling_response.bind( this ),
on_failure: this.on_reserve_polling_failure.bind( this ),
timeout: 30 * 1000
} );
},
show_polling: function( data ) {
false;
this.clear_all_time_messages();
if ( !Object.isUndefined(data.poll.queue_wait) ) {
this.update_time_remaining( data.poll.queue_wait );
}
this.show( {
anchor_id: document.body,
popup_align: { x: 'center', y: 'center' }
} );
if ( !data.init ) {
if ( !this.context.suppress_polling_ad && this.context.trigger_ad && data.poll.ad ) {
delete this.context.trigger_ad;
var masktoken = data.poll.ad.masktoken ? data.poll.ad.masktoken : '';
this.context.polling_ad.load( { masktoken: masktoken } );
}
this.poll_timeout = setTimeout( this.poll.bind( this, data ), data.poll.delay*1000 );
}
}
} );
RepeatSearchPollingDialog = Class.create( ReservePollingDialog, {
initialize: function( $super, options ) {
$super();
this.recaptcha = new RepeatSearchRecaptchaDialog();
this.recaptcha.dialog_chain = {
next: this.on_recaptcha_finished.bind( this ),
cancel: this.cancel.bind( this )
};
},
check: function ( $super, context ) {
this.context = context;
this.layer.select(".processing")[0].show();
$('reserve_polling_wait_messages').hide();
$('pollingcontent').addClassName( 'working' );
return $super( context, { do_not_start_polling: true } );
},
cancel: function() {
this.recaptcha.hide();
this.stop_polling();
if ( this.context.checkout_timeout_dialog ) {
this.dialog_chain.go_to( this.context.checkout_timeout_dialog );
}
else {
this.dialog_chain.cancel();
}
},
prepare_reserve: function() {
this.reserve_data = {
command: "start_last_reserve"
};
add_delivery_and_upsell_choices( this.reserve_data );
this.start_reserve();
},
on_recaptcha_finished: function() {
if ( this.context.verify_psig ) {
this.reserve_data.verify_psig = this.context.verify_psig;
this.recaptcha.hide();
this.context.suppress_polling_ad = false;
$("reserve_polling_wait_messages").show();
$('pollingcontent').removeClassName( 'working' );
this.start_reserve();
}
else {
}
},
start_reserve: function( $super ) {
this.start_polling();
$super( this.reserve_data );
},
on_reserve_polling_response: function( data ) {
this.stop_polling();
false;
if ( data.reserve ) {
window.location = data.uri;
return;
}
if ( data.exchange && data.reserve_form_data ) {
var form = new Element( 'form', { method: "POST", action: data.uri } );
var list = data.reserve_form_data;
for ( var i = 0; i < list.length; i++ )
form.appendChild( new Element( 'input', list[i] ) );
document.body.appendChild( form );
form.submit();
return;
}
if ( data.error ) {
if ( data.error.invalid ) {
if ( data.error.invalid.captcha || data.error.invalid.psig ) {
delete this.context.verify_psig;
this.recaptcha.check( this.context );
this.hide();
this.recaptcha.show();
return;
}
}
TMCookie.set( 'NTF', this.context.event_id );
window.location = this.context.edp_url;
return;
}
if ( data.poll ) {
this.show_polling( data );
}
}
} );

