/* * liveHarmony scout data collector interface * $Id: util 2475 2008-09-12 20:40:54Z alambert $ */ var lh_scout_data = new Array(); /* User-facing function to insert an HTML-escaped value at the current point */ function lh_scout_insert_here(channel, op) { document.write(lh_scout_int_tohtml(lh_scout_int_get(channel, op))); } /* * This is based on Peter-Paul Koch's script for writing into layers * The original URL is: http://www.quirksmode.org/js/layerwrite.html * * We have intentionally left out Netscape 4 support because it forces * webmasters to position the target using "position: absolute". */ /* User-facing function to insert an HTML-escaped value in a container */ function lh_scout_insert_container(channel, op, id) { var data = lh_scout_int_tohtml(lh_scout_int_get(channel, op)); if (document.getElementById) { var x = document.getElementById(id); x.innerHTML = ''; x.innerHTML = data; } else if (document.all) { var x = document.all[id]; x.innerHTML = data; } else if (document.layers) { /* Don't bother with Netscape 4 silliness */ } } /* User-facing function to get a raw property */ function lh_scout_get_raw(key1, key2) { return lh_scout_int_get(key1, key2); } /* User-facing function to get an HTML-escaped property */ function lh_scout_get_html(key1, key2) { return lh_scout_int_tohtml(lh_scout_int_get(key1, key2)); } /* User-facing function to HTML-escape a string */ function lh_scout_tohtml(str) { return lh_scout_int_tohtml(str); } /* Internal function to set a property */ function lh_scout_int_set(key1, key2, value) { key1 = key1.toLowerCase(); key2 = key2.toLowerCase(); if (!(lh_scout_data[key1])) lh_scout_data[key1] = new Array(); lh_scout_data[key1][key2] = value; } /* Internal function to get a property */ function lh_scout_int_get(key1, key2) { key1 = key1.toLowerCase(); key2 = key2.toLowerCase(); if (!(lh_scout_data[key1])) return ''; return lh_scout_data[key1][key2]; } /* Internal function to HTML-escape a value */ function lh_scout_int_tohtml(str) { var newstr = str.replace(/&/g, '&'); newstr = newstr.replace(/"/g, '"'); newstr = newstr.replace(//g, '>'); return newstr; }