//
// RealAge specific JavaScript
//

// The following code is for serving ads from DoubleClick

// This value must be random for each page but the same for each ad on the page
var dblclick_ord = Math.random()*10000000000000000;

// get the value from either cbr or exclusive sponsor found in either querystring or cookies
var cbr_val = getDoubleClickCBR();

// get the forum id and topic id from the querystring
var forum_id = getQueryStringVariable("f", "0");
var topic_id = getQueryStringVariable("t", "0");

// Generate and write the DoubleClick JavaScript block of code
function WriteDoubleClickScriptBlock(site_zone, ad_dimensions, tile_order)
{
    document.write('<script language="JavaScript" src="http://ad.doubleclick.net/adj/' + site_zone + ';g='+ cbr_val + ';frm=' + forum_id + ';tpc=' + topic_id + ';sz=' + ad_dimensions + ';tile=' + tile_order + ';ord=' + dblclick_ord + '?" type="text/javascript"></scr' + 'ipt>');
}

function GetSiteZoneForumCat(site_zone, forum_nav)
{
	// clean up the forum nav, getting the category
	if (forum_nav != null) {
	forum_nav=forum_nav.replace(/Topics./, "");
	forum_nav=forum_nav.substring(0, forum_nav.indexOf("|"));
	forum_nav=forum_nav.toLowerCase();
	forum_nav = forum_nav.replace(/[^a-zA-Z0-9-\s]/g, "");
	forum_nav = forum_nav.replace(/ /g, "_");
	site_zone = site_zone.replace(/\/.*/, "");
	site_zone = site_zone + "/" + forum_nav;
	}
	return site_zone;
}
