
function createScriptName()
{
	var ad_type;
	var script_string = "/global/CM/CMAdSystem.cgi?";

	if (subscriber_id === undefined)
	{
		script_string += "sid=bcnetwork_private\&";
	}
	else
	{
		script_string += "sid=" + escape(subscriber_id) + "\&";
	} 

	script_string += "referer=" + escape(document.referrer) + "\&";

	if (keyword.length == 0)
	{
		ad_type = "trulyrandom";
	}
	else
	{
		ad_type = "keywordrandom";
	}

	if (horizontal == 1)
	{
		ad_type += "_horizontal";
	}

	script_string += "ad_type=" + ad_type;

	for (var x = 0; x < keyword.length; x++)
	{
		script_string += "&keyword=" + keyword[x];
	}

	return script_string;
}

var width;
var height;

if (horizontal == 1)
{
	width = 700;
	height = 110;
}
else
{
	width = 170;
	height = 470;
}

document.write( "<IFRAME width=\"" + width + "\" " + 
			"height=\"" + height + "\" " + 
			"src=\"" + createScriptName() + "\" " + 
			"frameborder=0 scrolling=no></IFRAME>");
