# This file is auto generated and contains a perl hash of
# your template globals for 'twitch' template set.
# Generated on: Wed Mar 16 15:40:42 2016

{
	'ad_300x250' => '<script type="text/javascript">
document.write(\'<scr\'+\'ipt src="https://reach.slowtwitch.com/servlet/view/banner/javascript/zone?zid=61&pid=0&resolution=\'+screen.width+\'x\'+screen.height+\'&random=\'+Math.floor(89999999*Math.random()+10000000)+\'&millis=\'+new Date().getTime()+\'&referrer=\'+encodeURIComponent((window!=top&&window.location.ancestorOrigins)?window.location.ancestorOrigins[window.location.ancestorOrigins.length-1]:document.location)+\'" type="text/javascript"></scr\'+\'ipt>\');
</script>',
	'ad_300x600' => '<script type="text/javascript">
document.write(\'<scr\'+\'ipt src="https://reach.slowtwitch.com/servlet/view/banner/javascript/zone?zid=60&pid=0&resolution=\'+screen.width+\'x\'+screen.height+\'&random=\'+Math.floor(89999999*Math.random()+10000000)+\'&millis=\'+new Date().getTime()+\'&referrer=\'+encodeURIComponent((window!=top&&window.location.ancestorOrigins)?window.location.ancestorOrigins[window.location.ancestorOrigins.length-1]:document.location)+\'" type="text/javascript"></scr\'+\'ipt>\');
</script>',
	'ad_728x90' => '<script type="text/javascript">
document.write(\'<scr\'+\'ipt src="https://reach.slowtwitch.com/servlet/view/banner/javascript/zone?zid=62&pid=0&resolution=\'+screen.width+\'x\'+screen.height+\'&random=\'+Math.floor(89999999*Math.random()+10000000)+\'&millis=\'+new Date().getTime()+\'&referrer=\'+encodeURIComponent((window!=top&&window.location.ancestorOrigins)?window.location.ancestorOrigins[window.location.ancestorOrigins.length-1]:document.location)+\'" type="text/javascript"></scr\'+\'ipt>\');
</script>
',
	'ad_wallpaper' => '<script type="text/javascript">
document.write(\'<scr\'+\'ipt src="https://reach.slowtwitch.com/servlet/view/wallpaper/javascript/zone?zid=52&pid=0&resolution=\'+screen.width+\'x\'+screen.height+\'&random=\'+Math.floor(89999999*Math.random()+10000000)+\'&millis=\'+new Date().getTime()+\'&referrer=\'+encodeURIComponent((window!=top&&window.location.ancestorOrigins)?window.location.ancestorOrigins[window.location.ancestorOrigins.length-1]:document.location)+\'" type="text/javascript"></scr\'+\'ipt>\');
</script>',
	'comscore' => '<script type="text/javascript">
 var _comscore = _comscore || [];
  _comscore.push({ c1: "2", c2: "10037191" });
  (function() {
  var s = document.createElement("script"), el = document.getElementsByTagName("script")[0]; s.async = true;
  s.src = (document.location.protocol == "https:" ? "https://sb" : "http://b") + ".scorecardresearch.com/beacon.js <http://scorecardresearch.com/beacon.js>  <http://scorecardresearch.com/beacon.js> ";
   el.parentNode.insertBefore(s, el);
  })();
</script>
<noscript>
  <img src="http://b.scorecardresearch.com/p?c1=2&c2=10037191&cv=2.0&cj=1" />
</noscript>',
	'current_poll' => 'home',
	'fb_pixel' => '<script type="text/javascript">
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version=\'2.0\';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,\'script\',\'//connect.facebook.net/en_US/fbevents.js\');

fbq(\'init\', \'895910530528995\');
fbq(\'track\', "PageView");</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=895910530528995&ev=PageView&noscript=1"
/></noscript>',
	'forum_url' => 'sub {
    return $CFG->{cgi_root_url};
}',
	'ga_link_tracker' => '<script type="text/javascript">
  function recordOutboundLink(link, category, action) {
    _gat._getTrackerByName()._trackEvent(category, action);
  }
</script>',
	'get_cgi' => 'sub {
  my $in = $IN->get_hash();
  return $in;
}',
	'get_cgi_value' => 'sub {
  my $name = shift || return;
  my $val = $IN->param($name);
  return $val ? { \'cgi_\' . $name => $val } : {};
}',
	'google_analytics' => '<!-- Google Analytics -->
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push([\'_setAccount\', \'UA-2419103-1\']);
  _gaq.push([\'_setDomainName\', \'.slowtwitch.com\']);
  _gaq.push([\'_trackPageview\']);

  (function() {
    var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;
    ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';
    var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>',
	'main_site_url' => 'http://www.slowtwitch.com',
	'mixed_calendar_loop' => 'sub {
	my ($user_id, $username) = @_;
	my (@racetags, @race_loop);

	my $db = $DB->table("User");
	my $sth = $db->select(["user_racetags"], { user_username => $username }) or die($GT::SQL::error);
	my ($racetags) = $sth->fetchrow_array;

	if ($racetags) {
		$racetags =~ s/\s*|^,//g;
		$racetags =~ s/,$//g;
		
		@racetags = split (\',\',$racetags);
		$db = $DB->table("Triathlons");

        my $cond = GT::SQL::Condition->new(\'uid\',\'=\', \@racetags);
      $db->select_options(\'ORDER BY date ASC\');
        my $sth = $db->select($cond) or die $GT::SQL::error;
		
		while (my $result = $sth->fetchrow_hashref) {
			$result->{racedate} = GT::Date::date_transform($result->{date}, \'%yyyy%-%mm%-%dd% %HH%:%MM%:%ss%\', \'%ddd% %mmm% %dd% %yyyy%\');

			push @race_loop, {
				name		=> $result->{name},
				location	=> "$result->{city}, $result->{state}",
				racedate    => "$result->{racedate}",
				url			=> "http://forum.slowtwitch.com/racecalendar/$result->{statetag}/$result->{nametag}-$result->{uid}.html",
				date	    => $result->{date},
			};
		}
	}

	my $sth = $DB->table("UserPersonalRace", "PersonalRace")->select({ user_id_fk => $user_id });
	while (my $row = $sth->fetchrow_hashref) {
		my $added;
		for (my $i = 0; $i < @race_loop; ++$i) {
			if (GT::Date::date_is_smaller($row->{pr_date}, $race_loop[$i]->{date})) {
				my $racedate = GT::Date::date_transform($row->{pr_date}, \'%yyyy%-%mm%-%dd%\', \'%ddd% %mmm% %dd% %yyyy%\');
				splice @race_loop, $i, 0, {
					id       => $row->{pr_id},
					name     => $row->{pr_name},
					location => "$row->{pr_city}, $row->{pr_state}, $row->{pr_country}",
					racedate => $racedate,
					url      => $row->{pr_url},
					date     => $row->{pr_date},
					user_race=> 1
				};
				$added = 1;
				last;
			}
		}
		unless ($added) {
			my $racedate = GT::Date::date_transform($row->{pr_date}, \'%yyyy%-%mm%-%dd%\', \'%ddd% %mmm% %dd% %yyyy%\');
			push @race_loop, {
				id       => $row->{pr_id},
				name     => $row->{pr_name},
				location => "$row->{pr_city}, $row->{pr_state}, $row->{pr_country}",
				racedate => $racedate,
				url      => $row->{pr_url},
				date     => $row->{pr_date},
				user_race=> 1
			};
		}
	}


	return { race_loop => \@race_loop };
}',
	'quantcast' => '<!-- Quantcast Tag -->
<script type="text/javascript">
var _qevents = _qevents || [];

(function() {
var elem = document.createElement(\'script\');
elem.src = (document.location.protocol == "https:" ? "https://secure" : "http://edge") + ".quantserve.com/quant.js";
elem.async = true;
elem.type = "text/javascript";
var scpt = document.getElementsByTagName(\'script\')[0];
scpt.parentNode.insertBefore(elem, scpt);
})();

_qevents.push({
qacct:"p-wtcPAHdnETGn_"
});
</script>

<noscript>
<div style="display:none;">
<img src="//pixel.quantserve.com/pixel/p-wtcPAHdnETGn_.gif" border="0" height="1" width="1" alt="Quantcast"/>
</div>
</noscript>
<!-- End Quantcast tag -->',
	'site_description' => '',
	'slowtwitch_retailer_loop' => 'sub {
	my $username = shift;
	my @shoptags;
	my $db = $DB->table("User");
	my $sth = $db->select(["user_shoptags"], { user_username => $username }) or die($GT::SQL::error);
	my ($shoptags) = $sth->fetchrow_array;
	if ($shoptags) {
		$shoptags =~ s/\s*|^,//g;
		$shoptags =~ s/,$//g;
		my @shop_loop;
		
		@shoptags = split (\',\',$shoptags);
		$db = $DB->table("Retailers");

        my $cond = GT::SQL::Condition->new(\'retailer_id\',\'=\', \@shoptags);
		$db->select_options(\'ORDER BY retailer_name ASC\');
        my $sth = $db->select($cond);
		
		while (my $result = $sth->fetchrow_hashref) {
			push @shop_loop, {
				name		=> $result->{retailer_name},
				location	=> "$result->{retailer_city}, $result->{retailer_state}",
				url			=> "http://www.slowtwitch.com/retailers/individual.php?retailer_id=$result->{retailer_id}",
			};
		}
		return { shop_loop => \@shop_loop };
	}
}',
	'ticker_flashvars_loop' => 'sub {
	my @flashvars_links_loop;
	my $db = $DB->table(\'Ticker\');
	my $sth = $db->do(\'SELECT ticker_text, ticker_link FROM gforum_Ticker\');
	while (my $result = $sth->fetchrow_hashref) {
		$result->{ticker_link} =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
		$result->{ticker_text} =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
		push @flashvars_links_loop, {
			coupon => $result->{ticker_text},
			url => $result->{ticker_link}
		};
	}

	return { \'flashvars_links_loop\' => \@flashvars_links_loop };
}',
	'ticker_loop' => 'sub {
	my @coupon_links_loop;
        my $db = $DB->table(\'Forum\');
	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 };
}',
	'tri_search' => '<script language="javascript">
var partnerID = "tas.search_TRI_slowtwitch";
var ad = "aa_p_slowtwitch";
var site1 = "www.slowtwitch.com,forum.slowtwitch.com";
var site2 = "";
var site3 = "";
</script>

<script src="http://www.activeathletevector.net/search_box/trisearch_site.js"
language="javascript" type="text/javascript"></script>'
};

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