/**
* Copyright 2009 KaChing Group Inc. Licensed under the Apache License,
* Version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
* or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
(function() {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'http://www.kaching.com/api/client.js';
document.getElementsByTagName('head')[0].appendChild(script);
var style = document.styleSheets[0];
if (!style) {
style = document.createElement('style');
style.setAttribute('type', 'text/css');
document.getElementsByTagName('head')[0].appendChild(style);
style = document.styleSheets[0];
}
var css = style.addRule ?
function(s,r) { style.addRule(s, r) } :
function(s,r) { style.insertRule([s,' {',r,'}'].join(''), style.cssRules.length) };
css('.miniholdings a', 'color:black;text-decoration:none;');
css('.miniholdings a:hover', 'text-decoration:underline;');
})();
var miniholdings = {
_PERLINE: 6,
_INTERVAL: 3000,
_holdings: function(name, holdings, topDiv) {
var withIcon = 0, withoutIcon = 0;
var buffer = [];
for (symbol in holdings) {
if (withIcon > 0 && withIcon % this._PERLINE == 0
&& holdings[symbol].companyIconUrl) {
buffer.push('
');
}
if (holdings[symbol].companyIconUrl) {
withIcon++;
buffer.push(
'');
} else {
withoutIcon++;
}
}
buffer.push('