function markWatchListClass(id, cname) { var totalCauses = 0; if ($('#star' + id).hasClass('clicked')) { dataString = "CFID=27894598&CFTOKEN=79c9036a23d41dcd-4DBFDB51-FABB-066F-CB27DCF16056FE27&jsessionid=DDE19848881B550F6C01D3762E62179C.cfusion&action=remove&id=" + id; $.ajax({ type: "POST", url: "ajax/ajax-watch-list.cfm?" + dataString, beforeSend: function() {$("#loadingoverlay" + id).show()}, data: dataString, success: function(data){ var parsedResponse = JSON.parse(data); if (parsedResponse.Error != "true") { $("#watch-list-button" ).effect('transfer', {from: "#watch-list-button", to: "#cid" + id, className: "ui-effects-transfer"}, 1000, function(){ $('#favoriteoverlay' + id).fadeTo('slow', 0.0, function() { $('#watch-action' + id).removeClass("ui-icon-pin-s"); $('#watch-action' + id).addClass("ui-icon-star"); }); }); $('#star' + id).prop("title", "Watch List: click this button to add " + cname + " to your watch list.") $('#star' + id).toggleClass('clicked'); } else { $('#error-notification-modal').dialog('option', 'title', 'Unable To Remove ' + cname + ' From Your Watch List'); $('#error-notification-modal').dialog('option', 'width', '450px'); $('#error-notification-modal').html("

We apologize for the inconvenience, however, we were unable to remove " + cname + " to your watch list at this time.

Please try adding " + cname + " at a later time.

Thank you for your understanding."); $('#error-notification-modal').dialog('open'); } }, error: function(data) { $('#error-notification-modal').dialog('option', 'title', 'Unable To Access Your Watch List'); $('#error-notification-modal').dialog('option', 'width', '300px'); $('#error-notification-modal').html("

We apologize for the inconvenience, however, we were unable to remove " + cname + " to your watch list.

This is a technical issue and technical support has been notified.

Please try adding your choice again soon."); $('#error-notification-modal').dialog('open'); }, complete: function() { $("#loadingoverlay" + id).hide() } }); } else { dataString = "CFID=27894598&CFTOKEN=79c9036a23d41dcd-4DBFDB51-FABB-066F-CB27DCF16056FE27&jsessionid=DDE19848881B550F6C01D3762E62179C.cfusion&action=add&id=" + id; $.ajax({ type: "POST", url: "ajax/ajax-watch-list.cfm?" + dataString, beforeSend: function() {$("#loadingoverlay" + id).show()}, data: dataString, success: function(data){ var parsedResponse = JSON.parse(data); if (parsedResponse.Error != "true") { $("#cid" + id).effect('transfer', { from: "#cid" + id, to: "#watch-list-button", className: "ui-effects-transfer" }, 1000); $('#favoriteoverlay' + id).fadeTo('slow', 1.0); $('#watch-action' + id).addClass("ui-icon-pin-s"); $('#watch-action' + id).removeClass("ui-icon-star"); $('#star' + id).prop("title", cname + " is currently on your watch list. Click this button to remove " + cname + ".") $('#star' + id).toggleClass('clicked'); } else { $('#error-notification-modal').dialog('option', 'title', 'Unable To Add ' + cname + ' To Your Watch List'); $('#error-notification-modal').dialog('option', 'width', '450px'); $('#error-notification-modal').html("

We apologize for the inconvenience, however, we were unable to add " + cname + " to your watch list at this time.

Please try adding " + cname + " at a later time.

Thank you for your understanding."); $('#error-notification-modal').dialog('open'); $("#loadingoverlay" + id).hide() } }, error: function(data) { $('#error-notification-modal').dialog('option', 'width', '300px'); $('#error-notification-modal').html("

We apologize for the inconvenience, however, we were unable to add " + cname + " to your watch list.

This is a technical issue and technical support has been notified.

Please try adding your choice again soon."); $('#error-notification-modal').dialog('open'); $("#loadingoverlay" + id).hide() }, complete: function() { $("#loadingoverlay" + id).hide() } }); } }