{
	'adzone_120x240_1' => '<!-- BEGIN ADVERTPRO CODE BLOCK -->

<SCRIPT language="JavaScript" type="text/javascript">
<!--
document.write(\'<SCR\'+\'IPT src="http://reach.slowtwitch.com/servlet/view/banner/javascript/zone?zid=21&pid=0&random=\'+Math.floor(89999999*Math.random()+10000000)+\'&millis=\'+new Date().getTime()+\'" language="JavaScript" type="text/javascript"></SCR\'+\'IPT>\');
//-->
</SCRIPT>
<NOSCRIPT>
<A href="http://reach.slowtwitch.com/servlet/click/zone?zid=21&pid=0&lookup=true&position=1" target="_top">
<IMG src="http://reach.slowtwitch.com/servlet/view/banner/image/zone?zid=21&pid=0&position=1" height="240" width="120" border="0" alt="Click Here!">
</A>
</NOSCRIPT>

<!-- END ADVERTPRO CODE BLOCK -->',
	'adzone_120x60_3' => '<!-- BEGIN ADVERTPRO CODE BLOCK -->

<SCRIPT language="JavaScript" type="text/javascript">
<!--
document.write(\'<SCR\'+\'IPT src="http://reach.slowtwitch.com/servlet/view/banner/javascript/zone?zid=4&pid=0&random=\'+Math.floor(89999999*Math.random()+10000000)+\'&millis=\'+new Date().getTime()+\'" language="JavaScript" type="text/javascript"></SCR\'+\'IPT>\');
//-->
</SCRIPT>
<NOSCRIPT>
<A href="http://reach.slowtwitch.com/servlet/click/zone?zid=4&pid=0&lookup=true&position=1" target="_top">
<IMG src="http://reach.slowtwitch.com/servlet/view/banner/image/zone?zid=4&pid=0&position=1" height="60" width="120" border="0" alt="Click Here!">
</A>
</NOSCRIPT>

<!-- END ADVERTPRO CODE BLOCK -->',
	'adzone_120x90_5' => '<!-- BEGIN ADVERTPRO CODE BLOCK -->

<SCRIPT language="JavaScript" type="text/javascript">
<!--
document.write(\'<SCR\'+\'IPT src="http://reach.slowtwitch.com/servlet/view/banner/javascript/zone?zid=14&pid=0&random=\'+Math.floor(89999999*Math.random()+10000000)+\'&millis=\'+new Date().getTime()+\'" language="JavaScript" type="text/javascript"></SCR\'+\'IPT>\');
//-->
</SCRIPT>
<NOSCRIPT>
<A href="http://reach.slowtwitch.com/servlet/click/zone?zid=14&pid=0&lookup=true&position=1" target="_top">
<IMG src="http://reach.slowtwitch.com/servlet/view/banner/image/zone?zid=14&pid=0&position=1" height="90" width="120" border="0" alt="Click Here!">
</A>
</NOSCRIPT>

<!-- END ADVERTPRO CODE BLOCK -->',
	'adzone_120x90_6' => '<!-- BEGIN ADVERTPRO CODE BLOCK -->

<SCRIPT language="JavaScript" type="text/javascript">
<!--
document.write(\'<SCR\'+\'IPT src="http://reach.slowtwitch.com/servlet/view/banner/javascript/zone?zid=15&pid=0&random=\'+Math.floor(89999999*Math.random()+10000000)+\'&millis=\'+new Date().getTime()+\'" language="JavaScript" type="text/javascript"></SCR\'+\'IPT>\');
//-->
</SCRIPT>
<NOSCRIPT>
<A href="http://reach.slowtwitch.com/servlet/click/zone?zid=15&pid=0&lookup=true&position=1" target="_top">
<IMG src="http://reach.slowtwitch.com/servlet/view/banner/image/zone?zid=15&pid=0&position=1" height="90" width="120" border="0" alt="Click Here!">
</A>
</NOSCRIPT>

<!-- END ADVERTPRO CODE BLOCK -->',
	'adzone_120x90_7' => '<!-- BEGIN ADVERTPRO CODE BLOCK -->

<SCRIPT language="JavaScript" type="text/javascript">
<!--
document.write(\'<SCR\'+\'IPT src="http://reach.slowtwitch.com/servlet/view/banner/javascript/zone?zid=16&pid=0&random=\'+Math.floor(89999999*Math.random()+10000000)+\'&millis=\'+new Date().getTime()+\'" language="JavaScript" type="text/javascript"></SCR\'+\'IPT>\');
//-->
</SCRIPT>
<NOSCRIPT>
<A href="http://reach.slowtwitch.com/servlet/click/zone?zid=16&pid=0&lookup=true&position=1" target="_top">
<IMG src="http://reach.slowtwitch.com/servlet/view/banner/image/zone?zid=16&pid=0&position=1" height="90" width="120" border="0" alt="Click Here!">
</A>
</NOSCRIPT>

<!-- END ADVERTPRO CODE BLOCK -->',
	'adzone_120x90_zone1' => '<!-- BEGIN ADVERTPRO CODE BLOCK -->

<SCRIPT language="JavaScript" type="text/javascript">
<!--
document.write(\'<SCR\'+\'IPT src="http://reach.slowtwitch.com/servlet/view/banner/javascript/zone?zid=1&pid=0&random=\'+Math.floor(89999999*Math.random()+10000000)+\'&millis=\'+new Date().getTime()+\'" language="JavaScript" type="text/javascript"></SCR\'+\'IPT>\');
//-->
</SCRIPT>
<NOSCRIPT>
<A href="http://reach.slowtwitch.com/servlet/click/zone?zid=1&pid=0&lookup=true&position=1" target="_top">
<IMG src="http://reach.slowtwitch.com/servlet/view/banner/image/zone?zid=1&pid=0&position=1" height="90" width="120" border="0" alt="Click Here!">
</A>
</NOSCRIPT>

<!-- END ADVERTPRO CODE BLOCK -->',
	'adzone_300x250_1' => '<!-- BEGIN ADVERTPRO CODE BLOCK -->

<SCRIPT language="JavaScript" type="text/javascript">
<!--
document.write(\'<SCR\'+\'IPT src="http://reach.slowtwitch.com/servlet/view/banner/javascript/zone?zid=19&pid=0&random=\'+Math.floor(89999999*Math.random()+10000000)+\'&millis=\'+new Date().getTime()+\'" language="JavaScript" type="text/javascript"></SCR\'+\'IPT>\');
//-->
</SCRIPT>
<NOSCRIPT>
<A href="http://reach.slowtwitch.com/servlet/click/zone?zid=19&pid=0&lookup=true&position=1" target="_top">
<IMG src="http://reach.slowtwitch.com/servlet/view/banner/image/zone?zid=19&pid=0&position=1" height="250" width="300" border="0" alt="Click Here!">
</A>
</NOSCRIPT>

<!-- END ADVERTPRO CODE BLOCK -->',
	'adzone_728x90_1' => '<!-- BEGIN ADVERTPRO CODE BLOCK -->

<SCRIPT language="JavaScript" type="text/javascript">
<!--
document.write(\'<SCR\'+\'IPT src="http://reach.slowtwitch.com/servlet/view/banner/javascript/zone?zid=20&pid=0&random=\'+Math.floor(89999999*Math.random()+10000000)+\'&millis=\'+new Date().getTime()+\'" language="JavaScript" type="text/javascript"></SCR\'+\'IPT>\');
//-->
</SCRIPT>
<NOSCRIPT>
<A href="http://reach.slowtwitch.com/servlet/click/zone?zid=20&pid=0&lookup=true&position=1" target="_top">
<IMG src="http://reach.slowtwitch.com/servlet/view/banner/image/zone?zid=20&pid=0&position=1" height="90" width="728" border="0" alt="Click Here!">
</A>
</NOSCRIPT>

<!-- END ADVERTPRO CODE BLOCK -->',
	'adzone_skyscraper_1' => '<!-- BEGIN ADVERTPRO CODE BLOCK -->

<SCRIPT language="JavaScript" type="text/javascript">
<!--
document.write(\'<SCR\'+\'IPT src="http://reach.slowtwitch.com/servlet/view/banner/javascript/zone?zid=18&pid=0&random=\'+Math.floor(89999999*Math.random()+10000000)+\'&millis=\'+new Date().getTime()+\'" language="JavaScript" type="text/javascript"></SCR\'+\'IPT>\');
//-->
</SCRIPT>
<NOSCRIPT>
<A href="http://reach.slowtwitch.com/servlet/click/zone?zid=18&pid=0&lookup=true&position=1" target="_top">
<IMG src="http://reach.slowtwitch.com/servlet/view/banner/image/zone?zid=18&pid=0&position=1" height="600" width="120" border="0" alt="Click Here!">
</A>
</NOSCRIPT>

<!-- END ADVERTPRO CODE BLOCK -->',
	'category_url' => 'sub {
    my $fullname = shift || return;
    my $url = $DB->table(\'Category\')->as_url($fullname);
    return $url;
}',
	'convert_nl_br' => 'sub {
  my $tags = GT::Template->tags;
  foreach (keys %$tags) {
      next if ($_ eq \'RelatedArticles\');
      $tags->{$_} =~ s/\r//g;
      $tags->{$_} =~ s/\n/<br \/>/g;
  }
  return $tags;
}',
	'dans_series' => '- <a href="http://www.slowtwitch.com/News/F.I.S.T._Workshop_schedule_set_957.html">F.I.S.T. Workshops</a>
<br />- <a href="http://www.slowtwitch.com/Fit_Calculator/fit_calculator.php">Geometry Calculator</a>
<br />- <a href="http://www.slowtwitch.com/retailers/">Retailers</a>
<br />- <a href="http://www.slowtwitch.com/stackreach.html">Stack // Reach</a>
<br />- <a href="http://training.slowtwitch.com/">Training Log</a>
<br />- <a href="http://www.slowtwitch.com/triclubs/">Triathlon Clubs</a>',
	'get_detailed_url' => 'sub {
    my $id = shift;
    return $CFG->{build_detail_url} . \'/\' . $DB->table(\'Links\')->detailed_url($id);
}
',
	'get_footer_categories' => 'sub {
# usage ($depth, $sb, $so);
	my $category = $DB->table(\'Category\');
	my $depth = shift || 0;
	my $sb = shift || "Name";
	my $so = shift ||"ASC";
	my $pos = shift || 1;

	$category->select_options("ORDER BY $sb $so");
	my $sth = $category->select( { CatDepth => $depth, Cat_Pos => $pos });
	my @loop;
	while (my $link = $sth->fetchrow_hashref) {
                                     $link->{URL} = "$CFG->{build_root_url}/" .  $category->as_url($link->{Full_Name}) . "/" . ($CFG->{build_index_include} ? $CFG->{build_index} : \'\');

		push @loop, $link;
	}
	return { \'category_links_loop\' => \@loop };
}',
	'get_header_categories' => 'sub {
# usage ($depth, $sb, $so);
	my $category = $DB->table(\'Category\');
	my $depth = shift || 0;
	my $sb = shift || "Name";
	my $so = shift ||"ASC";
	my $pos = shift || 0;

	$category->select_options("ORDER BY $sb $so");
	my $sth = $category->select( { CatDepth => $depth, Cat_Pos => $pos });
	my @loop;
	while (my $link = $sth->fetchrow_hashref) {
                                     $link->{URL} = "$CFG->{build_root_url}/" .  $category->as_url($link->{Full_Name}) . "/" . ($CFG->{build_index_include} ? $CFG->{build_index} : \'\');

		push @loop, $link;
	}
	return { \'category_links_loop\' => \@loop };
}',
	'get_links' => 'sub {
# usage ($type, $sb, $so);
	my $db = $DB->table(\'Links\');
	my $type = shift || "editorial";
	my $sb = shift || "Add_Date";
	my $so = shift ||"DESC";
	my $mh = shift || 10;

	$db->select_options("ORDER BY $sb $so", "LIMIT $mh");
	my $sth = $db->select({ Type => $type }, VIEWABLE);
	my @loop;
	while (my $link = $sth->fetchrow_hashref) {
		$link = Links::SiteHTML::tags(\'link\',$link);
		push @loop, $link;
	}
	return { $type . \'_links_loop\' => \@loop };
}',
	'get_links_categories' => 'sub {
    my $links = shift;
    my @ids     = map { $_->{ID} } @$links;
    my $catlink = $DB->table(\'CatLinks\',\'Category\');
    my %names = $catlink->select(\'LinkID\', \'Full_Name\', { LinkID => \@ids })->fetchall_list;

    return \%names;
}',
	'glam_widget' => '<script type="text/javascript" language="JavaScript">
brash_affiliate_id = \'19564997\';
brash_logo_type = \'BSSPGL\';
brash_logo_size = \'120x28\';
color_or_grayscale_flag =\'\';
brash_logo_color = \'wht\';
brash_gs_logo_color = \'wht\';
brash_logo_country = \'US\';
</script>
<script src="http://www8.glam.com/js/widgets/brash_logo.js"></script>',
	'poll' => '<!--#include virtual="/cgi-bin/ssi_poll.cgi?poll=home" -->',
	'related_articles' => 'sub {
	my $related = shift || return;
	my @ids = split ("\n",$related);
	my @loop;
	my $db = $DB->table(\'Links\');
	require Links::SiteHTML;
	foreach my $id (@ids) {
		my $link = $db->get($id);
		$link = Links::SiteHTML::tags(\'link\',$link);
		push @loop, $link;
	}
	return { related_articles_loop => \@loop };
}',
	'related_photos' => 'sub {
	my $related = shift || return;
	my @ids = split ("\n",$related);
	my @loop;
	use lib \'/home/slowtwitch/slowtwitch.com/cgi-bin/photos/admin\';
	Links::init(\'/home/slowtwitch/slowtwitch.com/cgi-bin/photos/admin\');
	require Plugins::SlideShow;
	my $DBH = new GT::SQL \'/home/slowtwitch/slowtwitch.com/cgi-bin/photos/admin/defs\';
	my $db = $DBH->table(\'Links\');
	require Links::SiteHTML;
	foreach my $id (@ids) {
		my $link = $db->get($id);
		my $fh = $db->file_info("Image1_thumbnail", $link->{ID});
		my $fdir  = $fh->File_Directory();
		my $full_path = "$fh";
		my $rel_path = $full_path;
		$rel_path =~ s,$fdir,,;
		$rel_path =~ s,%,%25,g;

		$link->{Image1_thumbnail_path} = $rel_path;
		$link = Links::SiteHTML::tags(\'link\',$link);
		push @loop, $link;
	}
	return { related_photos_loop => \@loop };
}',
	'replace_line_break' => 'sub {
    my $text = shift;
    $text =~ s/<br\s*\/?>/ /g;
    return $text;
}',
	'rewrite_detail_url' => 'sub {
  my $tags = GT::Template->tags;
  if ($tags->{detailed_url} and !$IN->param(\'d\')) {
      $tags->{detailed_url} =~ s/(\d+)\.html$/j$1.html/;
  }
  return $tags;
}',
	'round' => 'sub {
    my $num = shift;
    return sprintf("%.1f", $num - 0.05);
}
',
	'shorten_it' => 'sub {
    my $str = shift;
    my $length = shift || 160;
    if ($length > 0 and length $str > $length) {
        $str = substr($str,0,$length);
        $str =~ s/\s+\w+$//g;
        $str .= " ...";
    }
    return $str;
}',
	'sidenav' => '<ul class="sidenav">
  <li><a href="http://www.slowtwitch.com/retailers/">Bike Shops</a></li>
  <li><a href="http://www.slowtwitch.com/coaches/">Coaches</a></li>
  <li><a href="http://www.slowtwitch.com/Bike_Fit/F.I.S.T._2010/11_Schedule_live_1426.html">F.I.S.T. Workshops</a></li>
  <li><a href="http://www.slowtwitch.com/fitters/">Fitters</a></li>
  <li><a href="http://www.slowtwitch.com/Fit_Calculator/fit_calculator.php">Geometry Calculator</a></li>
  <li><a href="http://www.slowtwitch.com/runshops/">Running Stores</a></li>
  <li><a href="http://www.slowtwitch.com/stackreach.html">Stack // Reach</a></li>
  <li><a href="http://training.slowtwitch.com/">Training Log</a></li>
  <li><a class="last" href="http://www.slowtwitch.com/triclubs/">Triathlon Clubs</a></li>
</ul>',
	'site_title' => '&lt;:: Welcome to Slowtwitch.com ::&gt;',
	'site_title_short' => 'Slowtwitch.com',
	'thumbnail' => 'sub {
   my $link = shift;
   my $image1_thumbnail_path = shift;
   if ($image1_thumbnail_path) {
       return $image1_thumbnail_path;
   } elsif ($link->{Link_Type} ne \'video\') {
       return;
   }

   if ($link->{Thumbnail_URL} and $link->{Thumbnail_URL} ne \'http://\') {
        return $link->{Thumbnail_URL};
   } else {
        require Plugins::ConvertVideo;

        my $field = Plugins::ConvertVideo::get_file_path($link->{ID}, "thumbnail_file_field");
        if ($field->{thumbnail_file_field_path}) {
             return $field->{thumbnail_file_field_path};
        }
    }

    return;
}
',
	'ticker_loop' => 'sub {
	my @coupon_links_loop;
        my $db = $DB->table(\'Ticker\');
	my $sth = $db->do(\'SELECT ticker_text, ticker_link FROM glinks_Ticker ORDER BY ticker_text ASC\');
	while (my $result = $sth->fetchrow_hashref) {
		push @coupon_links_loop, {
		    coupon => $result->{ticker_text},
			url => $result->{ticker_link}
		};
	}

	return { \'coupon_links_loop\' => \@coupon_links_loop };
}',
	'unescape_tags' => 'sub {
    my $text = shift;

    my @tags = (\'b\', \'i\', \'u\');

    foreach my $tag (@tags) {
        $text =~ s/&lt;$tag&gt;/<$tag>/g;
        $text =~ s/&lt;\/$tag&gt;/<\/$tag>/g;
    }

    return $text;
}
'
};

# vim:syn=perl:ts=4:noet
