YAHOO.namespace('okomo');

YAHOO.okomo.interpolate = function(fmt, obj, named) {
    if (named) {
        return fmt.replace(/%\(\w+\)s/g, function(match){return String(obj[match.slice(2,-2)])});
    } else {
        return fmt.replace(/%s/g, function(match){return String(obj.shift())});
    }   
};

// Open Ads
YAHOO.okomo.get_ad = function(server, zone) {
    if (!document.phpAds_used) document.phpAds_used = ',';
    phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);

    document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
    document.write (server + "adjs.php?n=" + phpAds_random);
    document.write ("&amp;what=zone:" + zone);
    document.write ("&amp;exclude=" + document.phpAds_used);
    if (document.referrer)
        document.write ("&amp;referer=" + escape(document.referrer));
    document.write ("'><" + "/script>");
};
