/* inputs appropriate site title into CMT_MenuTemplate*/
$id = $modx->resource->get('id');
$resource = $modx->getObject('modResource', $id);
$bannerSwitch = $resource->getTVValue(41); /* TV: bannerAdFooter */

if ($bannerSwitch == 'None'||null)
{
}

if ($bannerSwitch == 'Patreon') 
{
// create arrays of ad images, alt texts, and URLs
$image = array('PatreonBanner_ResourcesFunding.gif', 'PatreonBanner_VideoDevelopment.gif');
$alttext = array('Fund new CMT resources via Patreon!', 'Support my video work via Patreon!');
$url = array('https://www.patreon.com/CambridgeMT', 'https://www.patreon.com/CambridgeMT');

// Generate random number between 0 and 1
$randomnumber = rand(0,1);

// Generate output
$output = '<a href="' . $url[$randomnumber] . '">';

/*
$output .= '<img alt="' . $alttext[$randomnumber] . '" ';
$output .= 'src="' . $siteRoot . '/SitePix/Ads/' . $image[$randomnumber] . '" class="imgBannerAd"></a>';
$output .= '<br><br>';
$output .= '<a href="' . $url[$randomnumber] . '">';
*/

$output .= '<img alt="' . $alttext[$randomnumber] . '" ';
$output .= 'src="' . $siteRoot . '/SitePix/Ads/' . $image[$randomnumber] . '" class="imgBannerAd"></a>';
}

return $output;