$(document).ready(function() { try { $('#tabs').tabs(); $('#main table').tablesorter(); $('#main table th').hover( function() { $(this).css('cursor', 'pointer'); }, function() { $(this).css('cursor', 'none'); }); } catch(e){} // Display Ads Moo.setupAds(); Moo.displayAds(); }); if(typeof(Moo) == 'undefined') { Moo = {}; } Moo.calculateBrokerage = function(total) { var brokerage = 80; var percentage_brokerage = 0.01 * total; if(percentage_brokerage > brokerage) { brokerage = percentage_brokerage; } return brokerage; }; Moo.formatCurrency = function(amount) { var i = parseFloat(amount); if(isNaN(i)) { i = 0.00; } var minus = ''; if(i < 0) { minus = '-'; } i = Math.abs(i); i = parseInt((i + .005) * 100); i = i / 100; s = new String(i); if(s.indexOf('.') < 0) { s += '.00'; } if(s.indexOf('.') == (s.length - 2)) { s += '0'; } s = minus + s; return s; }; /********************************* * MOO COW ADVERTISING SYSTEM * ********************************** Data is stored in objects at /pages/data/ads.js */ Moo.setupAds = function() { $(document).ready(function() { $('#content').append(''); $('#sidebar').append(''); }); }; Moo.displayAds = function() { var urlPath = window.location.pathname; var adsObjectKey = ''; $.each(MOO_ADS_PAGES, function(key, val) { if(key.indexOf(urlPath) > -1) { adsObjectKey = key; return false; } }); if(adsObjectKey == '') { return false; } // If adsObjectKey isn't false, we've found a match for ads on this page // For each ad in adsObject, get one ad per ID and display $.each(MOO_ADS_PAGES[adsObjectKey], function(key, val) { if(typeof MOO_ADS_PAGES[adsObjectKey][key] == 'undefined') { return; } try { if($.isArray(MOO_ADS_PAGES[adsObjectKey][key])) { var randomNumber = Math.floor(Math.random() * MOO_ADS_PAGES[adsObjectKey][key].length); $(key).html(MOO_ADS_PAGES[adsObjectKey][key][randomNumber]); } else { $(key).html(MOO_ADS_PAGES[adsObjectKey][key]); } $(key).show(); } catch(e) {} }); }; Moo.displayAd = function(id, ad) { $(document).ready(function() { $(id).html(MOO_ADS[ad]); }); };