Advertisement
Guest User

Untitled

a guest
Jul 27th, 2011
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.     ASP.NET Comet JavaScript
  3. */
  4.  
  5. //
  6. //  A AspNetComet object that represents a client
  7. //  subscribed to a comet channel on the ASP.NET Server
  8. //
  9. //  handler:        The Path to the handler
  10. //  privateToken:   The Client's private token
  11. //  alias:          An alias for the channel
  12. //
  13. function AspNetComet(handler, privateToken, alias)
  14. {
  15.     this.handler = handler;
  16.     this.successHandlers = new Array();
  17.     this.failureHandlers = new Array();
  18.     this.timeoutHandlers = new Array();
  19.     this.lastMessageId = 0;
  20.     this.privateToken = privateToken;
  21.     this.alias = alias;
  22.     this.enabled = true;
  23. }
  24.  
  25. //
  26. //  get an instance of the XML HTTP Request object
  27. //  that is browser specific
  28. //
  29. AspNetComet.prototype.getXMLHttpRequest =
  30. function AspNetComet_getXMLHttpRequest()
  31. {
  32.     if (window.XMLHttpRequest)
  33.     {
  34.         return new XMLHttpRequest()
  35.     }
  36.     else
  37.     {
  38.         if (window.ActiveXObject)
  39.         {
  40.             // ...otherwise, use the ActiveX control for IE5.x and IE6
  41.             return new ActiveXObject("Microsoft.XMLHTTP");
  42.         }
  43.     }
  44. }
  45.  
  46. //
  47. //  Add a success handler, called when the comet call succeeds with a message
  48. //
  49. //  func:   The function that will be called
  50. //
  51. AspNetComet.prototype.addSuccessHandler =
  52. function AspNetComet_addSuccessHandler(func)
  53. {
  54.     this.successHandlers[this.successHandlers.length] = func;
  55. }
  56.  
  57. //
  58. //  Add a failure handler, called when the comet call fails
  59. //
  60. //  func:   The function that will be called
  61. //
  62. AspNetComet.prototype.addFailureHandler =
  63. function AspNetComet_addFailureHandler(func)
  64. {
  65.     this.failureHandlers[this.failureHandlers.length] = func;
  66. }
  67.  
  68. //
  69. //  Add a timeout handler, called when the comet connection returns with no messages
  70. //
  71. //  func:   The function that will be called
  72. //
  73. AspNetComet.prototype.addTimeoutHandler =
  74. function AspNetComet_addTimeoutHandler(func)
  75. {
  76.     this.timeoutHandlers[this.timeoutHandlers.length] = func;
  77. }
  78.  
  79. //
  80. //  Call all the sucess handlers
  81. //
  82. //  privateToken:   The private token of the client
  83. //  alias:          The alias of the channel
  84. //  message:        The message received from the channel
  85. //
  86. AspNetComet.prototype.callSuccessHandlers =
  87. function AspNetComet_callSuccessHandlers(privateToken, alias, message)
  88. {
  89.     for(var i = 0; i < this.successHandlers.length; i++)
  90.     {
  91.         this.successHandlers[i](privateToken, alias, message);
  92.     }
  93. }
  94.  
  95. //
  96. //  Call all the failure handlers
  97. //
  98. //  privateToken:   The private token of the client
  99. //  alias:          The alias of the channel
  100. //  error:          The error message received from the server
  101. //
  102. AspNetComet.prototype.callFailureHandlers =
  103. function AspNetComet_callFailureHandlers(privateToken, alias, error)
  104. {
  105.     for(var i = 0; i < this.failureHandlers.length; i++)
  106.     {
  107.         this.failureHandlers[i](privateToken, alias, error);
  108.     }
  109. }
  110.  
  111. //
  112. //  Call all the timeout handlers
  113. //
  114. //  privateToken:   The private token of the client
  115. //  alias:          The alias of the channel
  116. //
  117. AspNetComet.prototype.callTimeoutHandlers =
  118. function AspNetComet_callTimeoutHandlers(privateToken, alias)
  119. {
  120.     for(var i = 0; i < this.timeoutHandlers.length; i++)
  121.     {
  122.         this.timeoutHandlers[i](privateToken, alias);
  123.     }
  124. }
  125.  
  126. //
  127. //  unsubscribe from the channel (basically stop the request connecting to the channel after it returns)
  128. //
  129. AspNetComet.prototype.unsubscribe =
  130. function AspNetComet_unsubscribe()
  131. {
  132.     this.enabled = false;
  133. }
  134.  
  135. //
  136. //  subscribe to the channel, and start the comet mechanism
  137. //
  138. AspNetComet.prototype.subscribe =
  139. function AspNetComet_subscribe() {
  140.     var aspNetComet = this;
  141.  
  142.     //  get our object that is going to perform the request
  143.     var waitRequest = this.getXMLHttpRequest();
  144.  
  145.     //  indicate we are enabled
  146.     this.enabled = true;
  147.  
  148.     waitRequest.onreadystatechange = function () {
  149.         //
  150.         //  validate the ready state, we are looking for "4" ready
  151.         if (waitRequest.readyState == "4") {
  152.             //  and a status code of 200 "OK"
  153.             if (waitRequest.status == "200") {
  154.                 //  finished, success or not?
  155.                 var result;
  156.                 if (waitRequest.responseText == "")
  157.                     result = null;
  158.                 else
  159.                     result = JSON.parse(waitRequest.responseText);
  160.  
  161.                 if (result == null || result.length == 0) {
  162.                     //  failure
  163.                     aspNetComet.callFailureHandlers(aspNetComet.privateToken, aspNetComet.alias, null);
  164.                 }
  165.                 else {
  166.                     //  we have a message but we need to inspect
  167.                     //  to see if this is a failure
  168.                     var message = result[0];
  169.  
  170.  
  171.                     switch (message.n) {
  172.                         case "aspNetComet.error":
  173.                             //  yes we do this is a failure
  174.                             //  failure
  175.                             aspNetComet.callFailureHandlers(aspNetComet.privateToken, aspNetComet.alias, message.c);
  176.                             break;
  177.                         case "aspNetComet.timeout":
  178.                             //  its a timeout, so lets continue with this
  179.                             aspNetComet.callTimeoutHandlers(aspNetComet.privateToken, aspNetComet.alias);
  180.                             //  and attach back to the handler
  181.                             if (aspNetComet.enabled) {
  182.                                 //  continue if we are enabled
  183.                                 aspNetComet.subscribe();
  184.                             }
  185.                             break;
  186.                         default:
  187.                             //  else, lets go for it, iterate through the
  188.                             //  returned messages and call the success handlers
  189.                             for (var i = 0; i < result.length; i++) {
  190.                                 var message = result[i];
  191.                                 //  get the last messageId
  192.                                 aspNetComet.lastMessageId = message.mid;
  193.                                 //  and now lets call the success handler
  194.                                 aspNetComet.callSuccessHandlers(aspNetComet.privateToken, aspNetComet.alias, message);
  195.                             }
  196.  
  197.                             //  attach back up to the handler
  198.                             if (aspNetComet.enabled) {
  199.                                 //  continue!
  200.                                 aspNetComet.subscribe();
  201.                             }
  202.                             break;
  203.                     }
  204.                 }
  205.             }
  206.         }
  207.     }
  208.  
  209.     var $handler = this.handler;
  210.     var $privateToken = this.privateToken;
  211.     var $lastMessageId = this.lastMessageId;
  212.  
  213.     setTimeout(function () {
  214.         //
  215.         //  open the post request to the handler
  216.         waitRequest.open("POST", $handler, true);
  217.         //  and set the request header indicating we are posting form data
  218.         waitRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  219.         //  setup the private token and last message id, these are needed to identify what state we
  220.         //  are actually interested in
  221.         waitRequest.send("privateToken=" + $privateToken + "&lastMessageId=" + $lastMessageId);
  222.     }, 0);
  223. }
  224.  
  225. /* -------------------------------------------------------------------------------------------------------------------
  226.  
  227.     http://www.JSON.org/json2.js
  228.     2008-03-24
  229.  
  230.     Public Domain.
  231.  
  232.     NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
  233.  
  234.     See http://www.JSON.org/js.html
  235.  
  236.     This file creates a global JSON object containing three methods: stringify,
  237.     parse, and quote.
  238.  
  239.  
  240.         JSON.stringify(value, replacer, space)
  241.             value       any JavaScript value, usually an object or array.
  242.  
  243.             replacer    an optional parameter that determines how object
  244.                         values are stringified for objects without a toJSON
  245.                         method. It can be a function or an array.
  246.  
  247.             space       an optional parameter that specifies the indentation
  248.                         of nested structures. If it is omitted, the text will
  249.                         be packed without extra whitespace. If it is a number,
  250.                         it will specify the number of spaces to indent at each
  251.                         level. If it is a string (such as '\t'), it contains the
  252.                         characters used to indent at each level.
  253.  
  254.             This method produces a JSON text from a JavaScript value.
  255.  
  256.             When an object value is found, if the object contains a toJSON
  257.             method, its toJSON method will be called and the result will be
  258.             stringified. A toJSON method does not serialize: it returns the
  259.             value represented by the name/value pair that should be serialized,
  260.             or undefined if nothing should be serialized. The toJSON method will
  261.             be passed the key associated with the value, and this will be bound
  262.             to the object holding the key.
  263.  
  264.             This is the toJSON method added to Dates:
  265.  
  266.                 function toJSON(key) {
  267.                     return this.getUTCFullYear()   + '-' +
  268.                          f(this.getUTCMonth() + 1) + '-' +
  269.                          f(this.getUTCDate())      + 'T' +
  270.                          f(this.getUTCHours())     + ':' +
  271.                          f(this.getUTCMinutes())   + ':' +
  272.                          f(this.getUTCSeconds())   + 'Z';
  273.                 }
  274.  
  275.             You can provide an optional replacer method. It will be passed the
  276.             key and value of each member, with this bound to the containing
  277.             object. The value that is returned from your method will be
  278.             serialized. If your method returns undefined, then the member will
  279.             be excluded from the serialization.
  280.  
  281.             If no replacer parameter is provided, then a default replacer
  282.             will be used:
  283.  
  284.                 function replacer(key, value) {
  285.                     return Object.hasOwnProperty.call(this, key) ?
  286.                         value : undefined;
  287.                 }
  288.  
  289.             The default replacer is passed the key and value for each item in
  290.             the structure. It excludes inherited members.
  291.  
  292.             If the replacer parameter is an array, then it will be used to
  293.             select the members to be serialized. It filters the results such
  294.             that only members with keys listed in the replacer array are
  295.             stringified.
  296.  
  297.             Values that do not have JSON representaions, such as undefined or
  298.             functions, will not be serialized. Such values in objects will be
  299.             dropped; in arrays they will be replaced with null. You can use
  300.             a replacer function to replace those with JSON values.
  301.             JSON.stringify(undefined) returns undefined.
  302.  
  303.             The optional space parameter produces a stringification of the value
  304.             that is filled with line breaks and indentation to make it easier to
  305.             read.
  306.  
  307.             If the space parameter is a non-empty string, then that string will
  308.             be used for indentation. If the space parameter is a number, then
  309.             then indentation will be that many spaces.
  310.  
  311.             Example:
  312.  
  313.             text = JSON.stringify(['e', {pluribus: 'unum'}]);
  314.             // text is '["e",{"pluribus":"unum"}]'
  315.  
  316.  
  317.             text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
  318.             // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
  319.  
  320.  
  321.         JSON.parse(text, reviver)
  322.             This method parses a JSON text to produce an object or array.
  323.             It can throw a SyntaxError exception.
  324.  
  325.             The optional reviver parameter is a function that can filter and
  326.             transform the results. It receives each of the keys and values,
  327.             and its return value is used instead of the original value.
  328.             If it returns what it received, then the structure is not modified.
  329.             If it returns undefined then the member is deleted.
  330.  
  331.             Example:
  332.  
  333.             // Parse the text. Values that look like ISO date strings will
  334.             // be converted to Date objects.
  335.  
  336.             myData = JSON.parse(text, function (key, value) {
  337.                 var a;
  338.                 if (typeof value === 'string') {
  339.                     a =
  340. /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
  341.                     if (a) {
  342.                         return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
  343.                             +a[5], +a[6]));
  344.                     }
  345.                 }
  346.                 return value;
  347.             });
  348.  
  349.  
  350.         JSON.quote(text)
  351.             This method wraps a string in quotes, escaping some characters
  352.             as needed.
  353.  
  354.  
  355.     This is a reference implementation. You are free to copy, modify, or
  356.     redistribute.
  357.  
  358.     USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD THIRD PARTY
  359.     CODE INTO YOUR PAGES.
  360. */
  361.  
  362. /*jslint regexp: true, forin: true, evil: true */
  363.  
  364. /*global JSON */
  365.  
  366. /*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
  367.     call, charCodeAt, floor, getUTCDate, getUTCFullYear, getUTCHours,
  368.     getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, length,
  369.     parse, propertyIsEnumerable, prototype, push, quote, replace, stringify,
  370.     test, toJSON, toString
  371. */
  372.  
  373. if (!this.JSON) {
  374.  
  375. // Create a JSON object only if one does not already exist. We create the
  376. // object in a closure to avoid global variables.
  377.  
  378.     JSON = function () {
  379.  
  380.         function f(n) {    // Format integers to have at least two digits.
  381.             return n < 10 ? '0' + n : n;
  382.         }
  383.  
  384.         Date.prototype.toJSON = function () {
  385.  
  386. // Eventually, this method will be based on the date.toISOString method.
  387.  
  388.             return this.getUTCFullYear()   + '-' +
  389.                  f(this.getUTCMonth() + 1) + '-' +
  390.                  f(this.getUTCDate())      + 'T' +
  391.                  f(this.getUTCHours())     + ':' +
  392.                  f(this.getUTCMinutes())   + ':' +
  393.                  f(this.getUTCSeconds())   + 'Z';
  394.         };
  395.  
  396.  
  397.         var escapeable = /["\\\x00-\x1f\x7f-\x9f]/g,
  398.             gap,
  399.             indent,
  400.             meta = {    // table of character substitutions
  401.                 '\b': '\\b',
  402.                 '\t': '\\t',
  403.                 '\n': '\\n',
  404.                 '\f': '\\f',
  405.                 '\r': '\\r',
  406.                 '"' : '\\"',
  407.                 '\\': '\\\\'
  408.             },
  409.             rep;
  410.  
  411.  
  412.         function quote(string) {
  413.  
  414. // If the string contains no control characters, no quote characters, and no
  415. // backslash characters, then we can safely slap some quotes around it.
  416. // Otherwise we must also replace the offending characters with safe escape
  417. // sequences.
  418.  
  419.             return escapeable.test(string) ?
  420.                 '"' + string.replace(escapeable, function (a) {
  421.                     var c = meta[a];
  422.                     if (typeof c === 'string') {
  423.                         return c;
  424.                     }
  425.                     c = a.charCodeAt();
  426.                     return '\\u00' + Math.floor(c / 16).toString(16) +
  427.                                                (c % 16).toString(16);
  428.                 }) + '"' :
  429.                 '"' + string + '"';
  430.         }
  431.  
  432.  
  433.         function str(key, holder) {
  434.  
  435. // Produce a string from holder[key].
  436.  
  437.             var i,          // The loop counter.
  438.                 k,          // The member key.
  439.                 v,          // The member value.
  440.                 length,
  441.                 mind = gap,
  442.                 partial,
  443.                 value = holder[key];
  444.  
  445. // If the value has a toJSON method, call it to obtain a replacement value.
  446.  
  447.             if (value && typeof value === 'object' &&
  448.                     typeof value.toJSON === 'function') {
  449.                 value = value.toJSON(key);
  450.             }
  451.  
  452. // If we were called with a replacer function, then call the replacer to
  453. // obtain a replacement value.
  454.  
  455.             if (typeof rep === 'function') {
  456.                 value = rep.call(holder, key, value);
  457.             }
  458.  
  459. // What happens next depends on the value's type.
  460.  
  461.             switch (typeof value) {
  462.             case 'string':
  463.                 return quote(value);
  464.  
  465.             case 'number':
  466.  
  467. // JSON numbers must be finite. Encode non-finite numbers as null.
  468.  
  469.                 return isFinite(value) ? String(value) : 'null';
  470.  
  471.             case 'boolean':
  472.             case 'null':
  473.  
  474. // If the value is a boolean or null, convert it to a string. Note:
  475. // typeof null does not produce 'null'. The case is included here in
  476. // the remote chance that this gets fixed someday.
  477.  
  478.                 return String(value);
  479.  
  480. // If the type is 'object', we might be dealing with an object or an array or
  481. // null.
  482.  
  483.             case 'object':
  484.  
  485. // Due to a specification blunder in ECMAScript, typeof null is 'object',
  486. // so watch out for that case.
  487.  
  488.                 if (!value) {
  489.                     return 'null';
  490.                 }
  491.  
  492. // Make an array to hold the partial results of stringifying this object value.
  493.  
  494.                 gap += indent;
  495.                 partial = [];
  496.  
  497. // If the object has a dontEnum length property, we'll treat it as an array.
  498.  
  499.                 if (typeof value.length === 'number' &&
  500.                         !(value.propertyIsEnumerable('length'))) {
  501.  
  502. // The object is an array. Stringify every element. Use null as a placeholder
  503. // for non-JSON values.
  504.  
  505.                     length = value.length;
  506.                     for (i = 0; i < length; i += 1) {
  507.                         partial[i] = str(i, value) || 'null';
  508.                     }
  509.  
  510. // Join all of the elements together, separated with commas, and wrap them in
  511. // brackets.
  512.  
  513.                     v = partial.length === 0 ? '[]' :
  514.                         gap ? '[\n' + gap + partial.join(',\n' + gap) +
  515.                                   '\n' + mind + ']' :
  516.                               '[' + partial.join(',') + ']';
  517.                     gap = mind;
  518.                     return v;
  519.                 }
  520.  
  521. // If the replacer is an array, use it to select the members to be stringified.
  522.  
  523.                 if (typeof rep === 'object') {
  524.                     length = rep.length;
  525.                     for (i = 0; i < length; i += 1) {
  526.                         k = rep[i];
  527.                         if (typeof k === 'string') {
  528.                             v = str(k, value, rep);
  529.                             if (v) {
  530.                                 partial.push(quote(k) + (gap ? ': ' : ':') + v);
  531.                             }
  532.                         }
  533.                     }
  534.                 } else {
  535.  
  536. // Otherwise, iterate through all of the keys in the object.
  537.  
  538.                     for (k in value) {
  539.                         v = str(k, value, rep);
  540.                         if (v) {
  541.                             partial.push(quote(k) + (gap ? ': ' : ':') + v);
  542.                         }
  543.                     }
  544.                 }
  545.  
  546. // Join all of the member texts together, separated with commas,
  547. // and wrap them in braces.
  548.  
  549.                 v = partial.length === 0 ? '{}' :
  550.                     gap ? '{\n' + gap + partial.join(',\n' + gap) +
  551.                               '\n' + mind + '}' :
  552.                           '{' + partial.join(',') + '}';
  553.                 gap = mind;
  554.                 return v;
  555.             }
  556.         }
  557.  
  558.  
  559. // Return the JSON object containing the stringify, parse, and quote methods.
  560.  
  561.         return {
  562.             stringify: function (value, replacer, space) {
  563.  
  564. // The stringify method takes a value and an optional replacer, and an optional
  565. // space parameter, and returns a JSON text. The replacer can be a function
  566. // that can replace values, or an array of strings that will select the keys.
  567. // A default replacer method can be provided. Use of the space parameter can
  568. // produce text that is more easily readable.
  569.  
  570.                 var i;
  571.                 gap = '';
  572.                 indent = '';
  573.                 if (space) {
  574.  
  575. // If the space parameter is a number, make an indent string containing that
  576. // many spaces.
  577.  
  578.                     if (typeof space === 'number') {
  579.                         for (i = 0; i < space; i += 1) {
  580.                             indent += ' ';
  581.                         }
  582.  
  583. // If the space parameter is a string, it will be used as the indent string.
  584.  
  585.                     } else if (typeof space === 'string') {
  586.                         indent = space;
  587.                     }
  588.                 }
  589.  
  590. // If there is no replacer parameter, use the default replacer.
  591.  
  592.                 if (!replacer) {
  593.                     rep = function (key, value) {
  594.                         if (!Object.hasOwnProperty.call(this, key)) {
  595.                             return undefined;
  596.                         }
  597.                         return value;
  598.                     };
  599.  
  600. // The replacer can be a function or an array. Otherwise, throw an error.
  601.  
  602.                 } else if (typeof replacer === 'function' ||
  603.                         (typeof replacer === 'object' &&
  604.                          typeof replacer.length === 'number')) {
  605.                     rep = replacer;
  606.                 } else {
  607.                     throw new Error('JSON.stringify');
  608.                 }
  609.  
  610. // Make a fake root object containing our value under the key of ''.
  611. // Return the result of stringifying the value.
  612.  
  613.                 return str('', {'': value});
  614.             },
  615.  
  616.  
  617.             parse: function (text, reviver) {
  618.  
  619. // The parse method takes a text and an optional reviver function, and returns
  620. // a JavaScript value if the text is a valid JSON text.
  621.  
  622.                 var j;
  623.  
  624.                 function walk(holder, key) {
  625.  
  626. // The walk method is used to recursively walk the resulting structure so
  627. // that modifications can be made.
  628.  
  629.                     var k, v, value = holder[key];
  630.                     if (value && typeof value === 'object') {
  631.                         for (k in value) {
  632.                             if (Object.hasOwnProperty.call(value, k)) {
  633.                                 v = walk(value, k);
  634.                                 if (v !== undefined) {
  635.                                     value[k] = v;
  636.                                 } else {
  637.                                     delete value[k];
  638.                                 }
  639.                             }
  640.                         }
  641.                     }
  642.                     return reviver.call(holder, key, value);
  643.                 }
  644.  
  645.  
  646. // Parsing happens in three stages. In the first stage, we run the text against
  647. // regular expressions that look for non-JSON patterns. We are especially
  648. // concerned with '()' and 'new' because they can cause invocation, and '='
  649. // because it can cause mutation. But just to be safe, we want to reject all
  650. // unexpected forms.
  651.  
  652. // We split the first stage into 4 regexp operations in order to work around
  653. // crippling inefficiencies in IE's and Safari's regexp engines. First we
  654. // replace all backslash pairs with '@' (a non-JSON character). Second, we
  655. // replace all simple value tokens with ']' characters. Third, we delete all
  656. // open brackets that follow a colon or comma or that begin the text. Finally,
  657. // we look to see that the remaining characters are only whitespace or ']' or
  658. // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
  659.  
  660.                 if (/^[\],:{}\s]*$/.test(text.replace(/\\["\\\/bfnrtu]/g, '@').
  661. replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
  662. replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
  663.  
  664. // In the second stage we use the eval function to compile the text into a
  665. // JavaScript structure. The '{' operator is subject to a syntactic ambiguity
  666. // in JavaScript: it can begin a block or an object literal. We wrap the text
  667. // in parens to eliminate the ambiguity.
  668.  
  669.                     j = eval('(' + text + ')');
  670.  
  671. // In the optional third stage, we recursively walk the new structure, passing
  672. // each name/value pair to a reviver function for possible transformation.
  673.  
  674.                     return typeof reviver === 'function' ?
  675.                         walk({'': j}, '') : j;
  676.                 }
  677.  
  678. // If the text is not JSON parseable, then a SyntaxError is thrown.
  679.  
  680.                 throw new SyntaxError('JSON.parse');
  681.             },
  682.  
  683.             quote: quote
  684.         };
  685.     }();
  686. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement