(4374,138,0.80,'smarty','0','flashgraph v2 date range now working.',1127362151,3,'216.194.127.150','{assign var=\"pgLayout\" value=\"none\"}<html>\r\n<head>\r\n	<link rel=\"stylesheet\" href=\"{$skinFolder}/styles/base.css\" />\r\n	{if $styleName neq \"\"}<link rel=\"stylesheet\" type=\"text/css\" href=\"{$skinFolder}styles/{$styleName}.css\" />{/if}\r\n	{assign var=\"vanityStyle\" value=\"`$skinFolder`styles/`$smarty.session.company.companyVanity`.css\"}\r\n	{if $vanityStyle|file_exists}<link rel=\"stylesheet\" href=\"{$vanityStyle}\" type=\"text/css\" />{/if}\r\n</head>\r\n<body style=\"margin:0px;background-image:none;\">\r\n\r\n{if $smarty.request.compId}\r\n	{assign var=\"compId\" value=\"comp\"|cat:$smarty.request.compId}\r\n{/if}\r\n{include_php file=\"shared_handle:assignGraphBackNextTimes\"}\r\n{assign var=\"type\" value=$smarty.request.type}\r\n{assign var=\"fillPrevious\" value=$smarty.request.fillPrevious|default:\"1\"}\r\n{assign var=\"precision\" value=$smarty.request.precision|default:\"0\"}\r\n{assign var=\"stars\" value=$smarty.request.stars|default:\"\"}\r\n{assign var=\"totalChange\" value=$smarty.request.totalChange|default:\"0\"}\r\n{assign var=\"userIds\" value=$smarty.request.userIds|default:\"\"}\r\n{assign var=\"esId\" value=$smarty.request.esId}\r\n{if $smarty.request.gParams}{include_php file=\"shared_handle:assignGraphParams\"}{/if}\r\n{if $smarty.request.format eq \"small\"}\r\n	{assign var=\"url\" value=$skinFolder|cat:\"/flash/grapher_sm.swf?id=\":$compId:\"!\":$type:\"!\":$fillPrevious:\"!\":$precision:\"!\":$stars:\"!\":$totalChange:\"!\":$userIds:\"!\":$esId:\"&session_id=\":$smarty.session.session_id}\r\n{elseif $smarty.request.format eq \"wide\"}\r\n	{assign var=\"url\" value=$skinFolder|cat:\"/flash/grapher_wide.swf?id=\":$compId:\"!\":$type:\"!\":$fillPrevious:\"!\":$precision:\"!\":$stars:\"!\":$totalChange:\"!\":$userIds:\"!\":$esId:\"&session_id=\":$smarty.session.session_id}\r\n{else}\r\n	{assign var=\"url\" value=$skinFolder|cat:\"/flash/grapher.swf?id=\":$compId:\"!\":$type:\"!\":$fillPrevious:\"!\":$precision:\"!\":$stars:\"!\":$totalChange:\"!\":$userIds:\"!\":$esId:\"&session_id=\":$smarty.session.session_id}\r\n{/if}\r\n\r\n{* assign var=\"url\" value=$skinFolder|cat:\"/flash/grapher{if $smarty.request.format eq \"small\"}_sm{elseif $smarty.request.format eq \"wide\"}_wide{/if}.swf?id=comp1!weight!1!0!!1&session_id=\":$smarty.session.session_id\" *}\r\n\r\n{if !$compId}\r\n<div style=\"position:absolute;top:0px;right:0px;\">\r\n	<small><i>{$graphTimeFrom|date_format2:\"M jS, y\"|replace:\" \":\"&nbsp;\"} - {$graphTimeUntil|date_format2:\"M jS, y\"|replace:\" \":\"&nbsp;\"}</i></small>\r\n</div>\r\n{/if}\r\n\r\n<h3 class=\"underline\">&nbsp; {if $userIds}Showing{else}Comparing{/if} {if $totalChange}Change in {/if}{$type|niceText} Over Time</h3>\r\n{if true AND ($type OR $smarty.get.esId)}\r\n	{if $smarty.request.format eq \"small\"}\r\n		{swf src=$url width=\"425\" height=\"195\" bgcolor=\"#FFFFFF\" wmode=\"transparent\"}\r\n	{elseif $smarty.request.format eq \"wide\"}\r\n		{swf src=$url width=\"595\" height=\"195\" bgcolor=\"#FFFFFF\" wmode=\"transparent\"}\r\n	{else}\r\n		{swf src=$url width=\"555\" height=\"195\" bgcolor=\"#FFFFFF\" wmode=\"transparent\"}\r\n	{/if}\r\n{elseif true OR $user->username eq \"jhyde\"}\r\n	{if $smarty.request.format eq \"small\"}\r\n		<img src=\"{$systemFolder}images/choose_graph_small.gif\" width=\"421\" height=\"187\" />\r\n	{else}\r\n		<img src=\"{$systemFolder}images/choose_graph_wide.gif\" width=\"588\" height=\"180\" />\r\n	{/if}\r\n{else}\r\n<ul>\r\n	<li>The eHealthCompete graphing engine is temporarily unavailable due to upgrades.</li>\r\n</ul>\r\n{/if}\r\n\r\n{if true OR $user->username eq \"trave\"}\r\n{capture name=\"graphLink\"}?pg=flashgraph-frame&format=small&userIds={$smarty.request.userIds}&esId={$smarty.request.esId}&type={$smarty.request.type|niceText|htmlspecialchars}&precision={$smarty.request.precision|default:1}{/capture}\r\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\r\n<tr>\r\n	<td nowrap=\"nowrap\">{if !$compId AND $graphTimeBack}<a href=\"{$smarty.capture.graphLink}&graphTime={$graphTimeBack}\"><small>back <i style=\"font-weight:normal;\">({$graphTimeBack|date_format2:\"M jS, y\"})</i></small></a>{/if}</td>\r\n	<td width=\"100%\" align=\"center\">&nbsp;\r\n	{if $acm->isDomainAdmin() && $user->username neq \"trave\"}\r\n		{$smarty.request.gParams}\r\n		{assign var=\"debugUrl\" value=$url|regex_replace:\"/.*\\?/\":\"?pg=flashgraph&\"}\r\n		<a href=\"{$debugUrl}\" target=\"_blank\">Source</a> | <a href=\"{$debugUrl}&debug=1\" target=\"_blank\">Debugger</a>\r\n	{/if}</td>\r\n	<td nowrap=\"nowrap\">{if !$compId AND $graphTimeNext}<a href=\"{$smarty.capture.graphLink}&graphTime={$graphTimeNext}\"><small>forward <i style=\"font-weight:normal;\">({$graphTimeNext|date_format2:\"M jS, y\"})</i></small></a>{/if}</td>\r\n</tr>\r\n</table>\r\n{/if}\r\n</body></html>'),(4379,263,0.10,'smarty','0','Page created.',1127364719,3,'216.194.127.150',''),(4137,195,0.52,'smarty','0','Imported from V2 conversion',1123491043,3,'67.166.75.78','{include file=\"layouts/forceLoggedIn.tpl\"}\r\n{include_php file=\"shared_handle:myHome\"}\r\n{include_php file=\"shared_handle:getProfile\"}\r\n{assign var=\"pgLayout\" value=\"layouts/withLeftNav.tpl\"}\r\n<h1>{$page.title} - {$userProfile.firstName} {$userProfile.lastName} ({$userProfile.username})</h1>\r\n\r\n{select_query return=\"row\" assign=\"aHRA\"}\r\n	dateTaken, pointsEarned FROM surveys_taken\r\n		WHERE userId = {$user->id}\r\n		AND surveyId = 8\r\n		ORDER BY dateTaken DESC\r\n		LIMIT 1\r\n{/select_query}\r\n\r\n<table width=\"700\">\r\n<tr>\r\n	<td>\r\n	<div id=\"statsContainer\" style=\"overflow:hidden;\">\r\n		<a name=\"updateStats\"></a>\r\n		<iframe name=\"profileUpdateFrame\" id=\"profileUpdateIFrame\" src=\"?pg=my_statistics/update&userId={$smarty.request.userId|default:$userProfile.id}\" frameborder=\"0\" width=\"700\" height=\"440\" scrolling=\"no\"></iframe>\r\n	</div>\r\n	</td>\r\n</tr>\r\n</table>\r\n\r\n<table width=\"700\">\r\n<tr><td>\r\n<h2 class=\"withBG\">\r\n	<div class=\"topRight hideShow\">\r\n		<a href=\"javascript:toggle(\'profileGraphTable\', \'\', \'showHide\');\"><img id=\"profileGraphTable_img\" src=\"blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a>\r\n	</div>User Profile &amp; Graphs</h2>\r\n</td></tr></table>\r\n\r\n<table id=\"profileGraphTable\" width=\"700\">\r\n<tr><td width=\"205\" valign=\"top\">\r\n	<div id=\"UserProfileColumn\" class=\"contentColumn\">\r\n	<h2 class=\"withBG\">Your Profile</h2>\r\n		<span class=\"cellHeadLarge\">Age:</span><span class=\"cellSmall\">{$userProfile.age|default:\"-\"}</span><br />\r\n		<span class=\"cellHeadLarge\">Height:</span><span class=\"cellSmall\">{$userProfile.heightFeet|default:\"-\"}\'{$userProfile.heightInches|default:\"-\"}&quot;</span><br />\r\n		<span class=\"cellHeadLarge\">Start BMI:</span><span class=\"cellSmall\">{$userProfile.startBMI|default:\"-\"}</span><br />\r\n		<span class=\"cellHeadLarge\">Start Weight:</span><span class=\"cellSmall\">{$userProfile.initialWeight|default:\"-\"}</span><br /><span class=\"cellHeadLarge\">Goal Weight:</span><span class=\"cellSmall\">{$userProfile.goalWeight|default:\"-\"}</span><br />\r\n		<span class=\"cellHeadLarge\">Current Weight:</span><span class=\"cellSmall\">{$userProfile.currentWeight|default:\"-\"}</span><br />\r\n		<span class=\"cellHeadLarge\">HRA Score:</span><span class=\"cellSmall\">{$aHRA.pointsEarned|default:\"-\"}</span><br />\r\n\r\n		<a href=\"?pg=my_profile\" class=\"link\"><img src=\"{$skinFolder}images/btn_profile.gif\" border=\"0\" alt=\"Update Profile\" vspace=\"10\" /></a><br />\r\n		<a href=\"?pg=my_settings\" class=\"link\"><img src=\"{$skinFolder}images/btn_settings.gif\" border=\"0\" alt=\"Account Settings\" vspace=\"0\" /></a>\r\n	</div>\r\n</td><td valign=\"top\" align=\"center\">	\r\n	<div id=\"graphContainer\">\r\n	<iframe name=\"graphwindow\" src=\"?pg=flashgraph-frame&compId={$compData.id}&format=small{* &type=weight&fillPrevious=1&precision=1&totalChange=0&userIds={$userProfile.id} *}\" frameborder=\"0\" width=\"425\" height=\"230\" scrollbars=\"no\"></iframe></div>\r\n	<small>\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=weight&fillPrevious=1&precision=1&totalChange=1\" target=\"graphwindow\">Change in Weight</a> |\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=weight&fillPrevious=1&precision=1\" target=\"graphwindow\">Weight</a> |\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=fat&fillPrevious=0&precision=1\" target=\"graphwindow\">Fat Intake</a> |\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=calories&fillPrevious=0&precision=1\" target=\"graphwindow\">Calorie Intake</a> |\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=carbs&fillPrevious=0&precision=1\" target=\"graphwindow\">Carb Intake</a><br />\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=water&fillPrevious=0&precision=1\" target=\"graphwindow\">Water Intake</a> |\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=minutesExercise&fillPrevious=0&precision=1\" target=\"graphwindow\">Exercise Min</a> |\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=distanceExercised&fillPrevious=0&precision=1\" target=\"graphwindow\">Distance Exercised</a>\r\n	</small>\r\n</td></tr>\r\n</table>\r\n<br />\r\n<table width=\"700\">\r\n<tr><td colspan=\"2\">\r\n<h2 class=\"withBG\">\r\n	<div class=\"topRight hideShow\">\r\n		<a href=\"javascript:toggle(\'goalsMottosBlock\', \'\', \'showHide\');\"><img id=\"goalsMottosBlock_img\" src=\"blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a>\r\n	</div>\r\n	Goals &amp; Mottos</h2>\r\n<blockquote id=\"goalsMottosBlock\" style=\"display:block;\">\r\n<dl>\r\n	<dt>Motto:</dt>\r\n	<dd>{$userProfile.personalSaying|default:\"- Not Set - Click on the <i><b>Update my Profile</b></i> button toward the top of this page to set your goal\"}</dd>\r\n	<dt>Nutrition Goal:</dt>\r\n	<dd>{$userProfile.nutritionGoal|default:\"- Not Set - Click on the <i><b>Update my Profile</b></i> button toward the top of this page to set your goal\"}</dd>\r\n	<dt>Fitness Goal:</dt>\r\n	<dd>{$userProfile.fitnessGoal|default:\"- Not Set - Click on the <i><b>Update my Profile</b></i> button toward the top of this page to set your goal\"}</dd>\r\n	<dt>Lifestyle Goal:</dt>\r\n	<dd>{$userProfile.lifestyleGoal|default:\"- Not Set - Click on the <i><b>Update my Profile</b></i> button toward the top of this page to set your goal\"}</dd>\r\n</dl>\r\n</blockquote>\r\n</td></tr>\r\n</table>'),(4141,256,0.11,'smarty','0','Page created.',1123491987,3,'67.166.75.78','{assign var=\"pgLayout\" value=\"file:layouts/blank.tpl\"}\r\n{include_php file=\"shared_handle:estats/userEntry\"}\r\n\r\n{capture name=\"headExtra\"}\r\n<script language=\"javascript\">{literal}\r\nfunction xWindow(name, w, h, x, y, loc, men, res, scr, sta, too)\r\n{\r\n  var f = \'\';\r\n  if (w && h) {\r\n    if (document.layers) f = \'screenX=\' + x + \',screenY=\' + y;\r\n    else f = \'left=\' + x + \',top=\' + y;\r\n    f += \',width=\' + w + \',height=\' + h + \',\';\r\n  }\r\n  f += (\'location=\'+loc+\',menubar=\'+men+\',resizable=\'+res\r\n    +\',scrollbars=\'+scr+\',status=\'+sta+\',toolbar=\'+too);\r\n  this.features = f;\r\n  this.name = name;\r\n  this.load = function(sUrl) {\r\n    if (this.wnd && !this.wnd.closed) this.wnd.location.href = sUrl;\r\n    else this.wnd = window.open(sUrl, this.name, this.features);\r\n    this.wnd.focus();\r\n    return false;\r\n  }\r\n}\r\nwinUpdater = new xWindow(\'nutritionWin\', 750, 500, 10, 10, \'yes\', \'no\', \'yes\', \'yes\', \'yes\', \'no\');\r\n{/literal}</script>\r\n{/capture}\r\n\r\n{if $userInfo.id}\r\n<form name=\"updateForm\" method=\"post\" action=\"index.php\" style=\"margin:0px;\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\">\r\n<input type=\"hidden\" name=\"no_expire\" value=\"true\">\r\n<input type=\"hidden\" name=\"start\" value=\"{$smarty.request.start}\">\r\n<input type=\"hidden\" name=\"userId\" value=\"{$smarty.request.userId}\">\r\n\r\n<h2 class=\"withBG\">\r\n	<div class=\"topRight hideShow\">\r\n		<a href=\"javascript:toggle(\'statsUpdateTable\', \'\', \'showHide\');updateParentHeight();\"><img id=\"statsUpdateTable_img\" src=\"blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a>\r\n	</div>\r\n	Update Stats{if $userInfo.id neq $user->id} For: {$userInfo.firstName} {$userInfo.lastName} ({$userInfo.username}){/if}\r\n</h2>\r\n<table id=\"statsUpdateTable\" cellpadding=\"2\" cellspacing=\"2\" style=\"display:block;\">\r\n<tr>\r\n	<td colspan=\"4\" align=\"left\"><div>{if $lastWeek}<a class=\"button\" href=\"?pg={$page.name}&start={$lastWeek}&userId={$userInfo.id}\">&lt; Previous Week</a>{/if}</div></td>\r\n	<td colspan=\"4\" align=\"right\"><div>{if $nextWeek}<a class=\"button\" href=\"?pg={$page.name}&start={$nextWeek}&userId={$userInfo.id}\">Next Week &gt;</a>{/if}</div></td>\r\n</tr>\r\n<tr>\r\n	<td class=\"\"><div>&nbsp;</div></td>\r\n	{section loop=\"7\" name=\"day\"}{assign var=\"dayNo\" value=$smarty.section.day.iteration}\r\n		<td width=\"75\" align=\"right\" class=\"datacell\"><b>{$dayInfo.$dayNo.timestamp|date_format2:\"l\"}</b><br />{$dayInfo.$dayNo.timestamp|date_format2:\"n/j/y\"}</td>\r\n	{/section}\r\n</tr>\r\n{assign var=\"columnCounter\" value=0}\r\n{foreach from=$estats item=\"estat\"}\r\n{assign var=\"estatId\" value=$estat.id}\r\n{if $estat.frequency eq \"daily\"}\r\n<tr>	\r\n	<td align=\"right\" class=\"\">\r\n	{if $estat.description}\r\n		<a href=\"javascript://\" onmouseover=\"toggle(\'eStatNote_{$estatId}\');\" onmouseout=\"toggle(\'eStatNote_{$estatId}\');\"><b>{$estat.name|niceText}</b></a><br />\r\n		<div id=\"eStatNote_{$estatId}\" class=\"floatInfoBox\" style=\"display:none;\">&quot;{$estat.description}&quot;{if $estat.groupName}<br /><small><i>Requested By:</i> <b>{$estat.groupDescription}</b></small>{/if}</div>\r\n	{else}\r\n		<b>{$estat.name|niceText}</b><br />\r\n	{/if}\r\n		{if $estat.units}<small class=\"note\">({$estat.units.name|niceText})</small>{/if}</td>\r\n		{section loop=\"7\" name=\"day\"}\r\n			{assign var=\"dayNo\" value=$smarty.section.day.iteration}\r\n			<td align=\"right\" class=\"datacell\"><input tabindex=\"{$smarty.section.day.iteration*7}\" type=\"text\" class=\"largeInput\" name=\"day[{$dayNo}][estats][{$estatId}][value]\" value=\"{if $dayInfo.$dayNo.estats.$estatId.id gt 0}{$dayInfo.$dayNo.estats.$estatId.value}{/if}\" onfocus=\"this.className=\'largeInputSelected\';\" onblur=\"this.className=\'largeInput\';\"><input type=\"hidden\" name=\"day[{$dayNo}][estats][{$estatId}][id]\" value=\"{$dayInfo.$dayNo.estats.$estatId.id}\"></td>\r\n		{/section}\r\n</tr>\r\n{/if}\r\n{/foreach}\r\n\r\n{foreach from=$estats item=\"estat\"}\r\n{assign var=\"estatId\" value=$estat.id}\r\n{if $estat.frequency eq \"weekly\"}\r\n{if $columnCounter eq 0 OR !$hasShownWeeklyHeader}<tr>{/if}\r\n	{if $estat.frequency eq \"weekly\" && !$hasShownWeeklyHeader}\r\n		{assign var=\"hasShownWeeklyHeader\" value=1}\r\n		<td>&nbsp;</td>\r\n		<td colspan=\"7\" align=\"center\"><br /><small>The following statistics are entered only once per week.<br /><br /></small></td>\r\n	</tr>\r\n	<tr>\r\n	{/if}	\r\n	<td align=\"right\" class=\"\"{if $columnCounter gt 0} colspan=\"2\"{/if}>\r\n	{if $estat.description}\r\n		<a href=\"javascript://\" onmouseover=\"toggle(\'eStatNote_{$estatId}\');\" onmouseout=\"toggle(\'eStatNote_{$estatId}\');\"><b>{$estat.name|niceText}</b></a><br />\r\n		<div id=\"eStatNote_{$estatId}\" class=\"floatInfoBox\" style=\"display:none;\">&quot;{$estat.description}&quot;{if $estat.groupName}<br /><small><i>Requested By:</i> <b>{$estat.groupDescription}</b></small>{/if}</div>\r\n	{else}\r\n		<b>{$estat.name|niceText}</b><br />\r\n	{/if}\r\n		{if $estat.units}<small class=\"note\">({$estat.units.name|niceText})</small>{/if}</td>\r\n		{assign var=\"columnCounter\" value=$columnCounter|math:\"x+1\"}\r\n		<td align=\"center\" class=\"datacell\"><input type=\"text\" class=\"largeInput\" name=\"day[1][estats][{$estatId}][value]\" value=\"{if $dayInfo.1.estats.$estatId.id gt 0}{$dayInfo.1.estats.$estatId.value}{/if}\" onfocus=\"this.className=\'largeInputSelected\';\" onblur=\"this.className=\'largeInput\';\"><input type=\"hidden\" name=\"day[{$dayNo}][estats][{$estatId}][id]\" value=\"{$dayInfo.1.estats.$estatId.id}\"></td>\r\n{if !$hasShownWeeklyHeader OR $columnCounter eq 3}{assign var=\"columnCounter\" value=0}</tr>{/if}\r\n{/if}\r\n{/foreach}\r\n<tr>\r\n	<td colspan=\"8\" align=\"right\"><br />\r\n		<input type=\"submit\" class=\"button\" value=\"Submit Updates!\" />\r\n		<input type=\"button\" value=\"Change Statistics Settings\" onclick=\"location.replace(\'?pg=eStatWizard\');\" />\r\n	</td>\r\n</tr>\r\n</table>\r\n\r\n</form>\r\n<span id=\"eStatsSinker\">&nbsp;</span>\r\n{/if}\r\n<script type=\"text/javascript\">{literal}\r\n	function xDef() {\r\n		for(var i=0; i<arguments.length; ++i) {\r\n			if(typeof(arguments[i])==\'undefined\') return false;\r\n		}\r\n		return true;\r\n	}\r\n\r\n	function xPageY(e) {\r\n	  if (!(e=document.getElementById(e))) return 0;\r\n	  var y = 0;\r\n	  while (e) {\r\n	    if (xDef(e.offsetTop)) y += e.offsetTop;\r\n	    e = xDef(e.offsetParent) ? e.offsetParent : null;\r\n	  }\r\n	  return y;\r\n	}\r\n\r\n	function updateParentHeight() {\r\n		parent.xHeight(\'profileUpdateIFrame\', xPageY(\'eStatsSinker\')+30);\r\n		parent.xHeight(\'statsContainer\', xPageY(\'eStatsSinker\')+30);\r\n	}\r\n\r\n	updateParentHeight();\r\n\r\n{/literal}</script>'),(4178,126,0.25,'smarty','0','attempting to remove smarty code from included page',1125379454,2,'24.2.76.126','{assign var=\"pgLayout\" value=\"layouts/default.tpl\"}\r\n\r\n{stored_object name=$smarty.session.session_id|truncate:10:\"\" type=\"signup\" from=\"signup\" assign=\"signup\"}\r\n<!-- {$signup.return} -->\r\n{if $smarty.request.confirmReset}{stored_object name=$smarty.session.session_id|truncate:10:\"\" type=\"signup\" destroy=\"true\"}{/if}\r\n\r\n{select_query assign=\"termsOfUse\" return=\"val\"}\r\n	h.content \r\nFROM _toc t \r\n	INNER JOIN _pages p ON (t.pageId = p.id)\r\n	INNER JOIN _page_history h ON (h.pageId = p.id)\r\n	LEFT JOIN _users u ON (h.userId = u.id)\r\nWHERE\r\n	t.pageName = \'terms\' AND h.isActive = \'1\'\r\nORDER BY h.version DESC\r\n{/select_query}\r\n\r\n{$termsOfUse|regex_replace:\"/\\{[^\\}]*\\}/\":\"\"}\r\n\r\n{toc_next assign=\"next\"}\r\n{toc_prev assign=\"prev\"}\r\n<form name=\"signup\" method=\"post\" action=\"index.php\" style=\"margin:0px;\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$next.pageName}\">\r\n<input type=\"hidden\" name=\"no_expire\" value=\"true\">\r\n<input type=\"hidden\" name=\"email\" value=\"{$signup.email}\">\r\n<input type=\"hidden\" name=\"signup[return]\" value=\"{$signup.return}\">\r\n\r\n<div align=\"center\" class=\"quote\">\r\n	I, {$signup.firstName} {$signup.lastName}, agree to these terms:<br />\r\n	<em>\r\n	<input type=\"radio\" name=\"signup[agree]\" value=\"Yes\"> Yes &nbsp; <input type=\"radio\" name=\"signup[agree]\" value=\"No\"> No\r\n	</em>\r\n</div>\r\n<br />\r\n<h2 class=\"withBG\">Sign up for our Newsletter?</h2>\r\n<p>eHealthCompete sends its users useful tips and advice from the health and wellness world, if you would like to add yourself to this group of recipients, select \'Yes\' below.</p>\r\n\r\n<div style=\"text-align:center;\"><input type=\"radio\" name=\"newsletterAction\" value=\"add\" checked=\"checked\"> Yes <input type=\"radio\" name=\"newsletterAction\" value=\"\"> No</div>\r\n\r\n<div align=\"right\">\r\n	<br />\r\n	{if $prev.pageName}<input type=\"image\" src=\"{$skinFolder}images/btn_back.gif\" class=\"btn_image\" onclick=\"pg.value=\'{$prev.pageName}\';\">&nbsp; {/if}\r\n	{if $next.pageName}<input type=\"image\" src=\"{$skinFolder}images/btn_next.gif\" class=\"btn_image\" onclick=\"pg.value=\'{$next.pageName}\';\">{/if}\r\n</div>\r\n\r\n{stored_object_fill_form object=$signup name=\"signup\"}\r\n\r\n</form>'),(4720,277,0.16,'smarty','0','Page created.',1138085662,2,'24.2.76.126','{assign var=\"pgLayout\" value=\"file:layouts/blank.tpl\"}\r\n{include_php file=\"shared_handle:competition/winners\"}\r\n<h2>Winners</h2>\r\n\r\n{if $competition.current_prize and $competition.current_parameter}\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n{display var=$competition}\r\n\r\n\r\n\r\n\r\n{/if}'),(4721,233,1.56,'smarty','0','Testing new Other Winners section',1138089231,2,'24.2.76.126','{assign var=\"hideWidgets\" value=0}\r\n{assign var=\"hideUserBox\" value=\"false\"}\r\n{assign var=\"showCompanyNews\" value=\"true\"}\r\n{assign var=\"pgLayout\" value=\"layouts/withLeftNav.tpl\"}\r\n{assign var=\"GUIDs\" value=\"\"}\r\n\r\n{select_query assign=\"managerId\" return=\"val\"}\r\n	userId FROM competitions c WHERE c.id = {$smarty.request.cid}\r\n{/select_query}\r\n\r\n{if $managerId eq $user->id or $acm->isDomainAdmin()}\r\n	{assign var=\"isManager\" value=\"true\"}\r\n	<!-- ismanager -->\r\n	{include_php file=\"shared_handle:competition/management\"}\r\n{/if}\r\n\r\n{include_php file=\"shared_handle:competition/load\"}\r\n\r\n<script type=\"text/javascript\">{literal}\r\n	var GUIDs = \'0\';\r\n\r\n	function updateGUIDs() {\r\n		var checkBoxes = document.forms[\'leaderBoardForm\'][\"graphCheckbox[]\"];\r\n		if (!checkBoxes.length) {\r\n			checkBoxes[0] = checkBoxes;\r\n			checkBoxes.length = 1;\r\n		}\r\n		GUIDs = \'\';\r\n		for (var x = 0; x < checkBoxes.length; x++) {\r\n			if (checkBoxes[x].checked == true && checkBoxes[x].value) {\r\n				GUIDs += checkBoxes[x].value+\',\'; \r\n			}\r\n			\r\n		}\r\n		rewriteGraphLinks();\r\n	}\r\n\r\n\r\n	function loadGraphWindow(graphParams) {\r\n		uri = \'?pg=flashgraph-frame&compId={/literal}{$competition.id}{literal}; //&\'+graphParams+\'&userIds=\'+GUIDs;\r\n		var gFrame = window.frames[\'graphwindow\'];\r\n		// gFrame.location.replace(uri);\r\n		var gForm = document.getElementById(\'form_leaderBoard\');\r\n		gForm.gParams.value = graphParams;\r\n		gForm.userIds.value = GUIDs;\r\n		gForm.submit();\r\n		return false;\r\n	}\r\n{/literal}</script>\r\n\r\n{include_php file=\"shared_handle:competition.verifyInitialPot\"}\r\n\r\n{capture name=\"scoringMethod\"}\r\n	<b>{$competition.current_parameter.name|capitalize}</b> ({$competition.current_parameter.units}) - {$competition.current_parameter.basedOn|capitalize}{* - {$competition.current_parameter.polarity|capitalize} *}\r\n{/capture}\r\n\r\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\r\n	<tr>\r\n		<td valign=\"top\" width=\"275\">\r\n\r\n		{if $acm->isDomainAdmin() and $competition.prizes|@count}\r\n		<br />\r\n		<h2 class=\"withBG\">\r\n			<div class=\"topRight hideShow\">\r\n					<a href=\"javascript:toggle(\'winners\', \'\', \'showHide\');\"><img id=\"winners_img\" src=\"./img/blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a>\r\n				</div>\r\n			Winners\r\n		</h2>\r\n\r\n		<div id=\"winners\" style=\"display:block;\">\r\n		{foreach from=$competition.prizes item=\"prize\" key=\"prizeId\"}\r\n			<a href=\"javascript://\" onclick=\"window.open(\'?pg=competition/winners&cid={$competition.id}&prizeId={$prizeId}\', \'\', \'height=550,width=325,menubar=no,status=no,scrollbars=yes,titlebar=no,resizable=yes\');\">{$prize.title}</a><br />\r\n		{/foreach}\r\n		</div>\r\n		{/if}\r\n		\r\n		<br />\r\n		<h2 class=\"withBG\">\r\n			<div class=\"topRight hideShow\">\r\n					<a href=\"javascript:toggle(\'leaderBoard\', \'\', \'showHide\');\"><img id=\"leaderBoard_img\" src=\"./img/blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a>\r\n				</div>\r\n			Leaders\r\n		</h2>\r\n		\r\n		{if $competition.dateOfObject}<div align=\"right\"><small><i>as of {$competition.dateOfObject|date_format2:\"n/j/Y g:i A\"}</i></small></div>{/if}\r\n\r\n		<div id=\"leaderBoard\" style=\"display:block;\">\r\n		<small>{$smarty.capture.scoringMethod}</small><br />\r\n		{if $competition.style eq \"Group-vs-Group\"}\r\n			<div align=\"center\" style=\"font-size:9px; color:#000;\">(Team Average)</div>\r\n		{elseif $competition.style eq \"Company-vs-Company\"}\r\n			<div align=\"center\" style=\"font-size:9px; color:#000;\">(Company Average)</div>\r\n		{/if}\r\n		{if $competition.parameters|@count gt 1}\r\n			<select name=\"scoringMethod\" onchange=\"if(this.value)location.replace(\'?pg={$page.name}&cid={$competition.id}&cpid=\'+this.value);\" style=\"width:200px;\">\r\n				<option value=\"\">(Choose Leaderboard)</option>\r\n			{foreach from=$competition.parameters key=\"paramId\" item=\"param\"}\r\n				{if $paramId neq $competition.current_parameter.id}\r\n				<option value=\"{$paramId}\">{$param.name|capitalize} - {$param.basedOn|capitalize}{* - {$param.polarity} *}</option>\r\n				{/if}\r\n			{/foreach}\r\n			</select>\r\n		{/if}\r\n		<form id=\"form_leaderBoard\" name=\"leaderBoardForm\" method=\"POST\" action=\"index.php?pg=flashgraph-frame&compId={$competition.id}\" target=\"graphwindow\">\r\n		<input type=\"hidden\" name=\"gParams\" value=\"\" />\r\n		<input type=\"hidden\" name=\"userIds\" value=\"\" />\r\n		<table cellpadding=\"0\" cellspacing=\"0\">\r\n		{if $competition.style eq \'Group-vs-Group\' or $competition.style eq \'Company-vs-Company\'}\r\n			<tr>\r\n			<td class=\"thinCell\">#</td>\r\n			<td class=\"thinCell\">Team</td>\r\n			<td class=\"thinCell\"><img src=\"{$skinFolder}images/trophy_ico.gif\" width=\"15\" height=\"15\" alt=\"\" /></span>\r\n			<td class=\"thinCell\">#Pl</td>\r\n			{* <td class=\"cellHeadTiny\"><img src=\"{$skinFolder}images/graph_ico.gif\" width=\"15\" height=\"15\" alt=\"Show In Graphs\" /></td> *}\r\n			</tr>\r\n			{foreach name=\"rankLoop\" from=$competition.team_data item=\"teamScore\" key=\"teamName\"}\r\n				{if $teamName ne \"Waiting to Join\"}\r\n					<tr>\r\n						<td class=\"thinCell\"><small>{$smarty.foreach.rankLoop.iteration}</small></td>\r\n						<td class=\"thinCell\"><small class=\"mini\">{$teamName|default:\"&nbsp;\"}</small></td>\r\n						<td class=\"thinCell\"><small>{$teamScore|number_format:2}</small></td>\r\n						<td class=\"thinCell\"><small>{$competition.teams.$teamName|@count|default:\"0\"}</small></td>\r\n						{* <td class=\"thinCell\"><input class=\"graphCheckbox\" name=\"graphCheckbox[]\" type=\"checkbox\" value=\"{foreach from=$teams.users item=teamUser}{$teamUser.id},{if $smarty.foreach.rankLoop.iteration lt 11}{append var=\"GUIDs\" value=\"`$teamUser.id`,\"}{/if}{/foreach}{$GUIDs}\"{if $smarty.foreach.rankLoop.iteration lt 11} checked=\"checked\"{/if} onclick=\"updateGUIDs();\" /></td> *}\r\n					</tr>\r\n				{/if}\r\n			{/foreach}\r\n		{else} \r\n			<tr>\r\n			<td class=\"thinCell\">#</td>\r\n			<td class=\"thinCell\" align=\"center\">Name</td>\r\n			<td class=\"thinCell\"><img src=\"{$skinFolder}images/trophy_ico.gif\" width=\"15\" height=\"15\" alt=\"{$smarty.capture.scoringMethod|strip_tags}\" /></td>\r\n			<td class=\"thinCell\">Update</td>\r\n			<td class=\"thinCell\" align=\"center\"><img src=\"{$skinFolder}images/graph_ico.gif\" width=\"15\" height=\"15\" alt=\"Show in Graphs\" /></td>\r\n			</tr>\r\n			{foreach from=$competition.data item=\"userData\" key=\"userId\" name=\"compData\"}\r\n			{assign var=\"curIteration\" value=$smarty.foreach.compData.iteration}\r\n			{if $curIteration eq 21}\r\n			</table>\r\n			</div>\r\n			<br />\r\n			<h2 class=\"withBG\">\r\n				<div class=\"topRight hideShow\">\r\n					<a href=\"javascript:toggle(\'runnerUps\', \'\', \'showHide\');\"><img id=\"runnerUps_img\" src=\"./img/blank.gif\" class=\"showHide_off\" alt=\"show/hide\" border=\"0\" /></a>\r\n				</div>\r\n				Runner Ups\r\n			</h2>\r\n			<div id=\"runnerUps\" style=\"display:none;\">\r\n			<table cellpadding=\"0\" cellspacing=\"0\">\r\n			{/if}\r\n			<tr>\r\n			<td class=\"thinCell\"><small>{$curIteration}</small></td>\r\n			<td class=\"thinCell\"><small class=\"mini\">{$competition.users[$userId]}</small></td>\r\n			<td class=\"thinCell\"><small>{$userData.val|number_format:$competition.current_parameter.decimalPlaces}</small></td>\r\n			<td class=\"thinCell\"><small>{if $userData.doe}{$userData.doe|date_format2:\"n/j/y\"}{else}-Never-{/if}</small></td>\r\n			<td class=\"thinCell\"><input class=\"graphCheckbox\" name=\"graphCheckbox[]\" type=\"checkbox\" value=\"{$userId}{if $curIteration lt 11}{append var=\"GUIDs\" value=\"`$userId`,\"}{/if}\"{if $curIteration lt 11} checked=\"checked\"{/if} onclick=\"updateGUIDs();\" /></td>\r\n			</tr>\r\n			{/foreach}\r\n		{/if}\r\n		</form>\r\n		<script type=\"text/javascript\">GUIDs = \'{$GUIDs}\';</script>\r\n		</table>\r\n		</div> \r\n		<div align=\"right\"><small><i><a href=\"?pg=faq#comp\">How is the competition scored?</a></i></small></div>\r\n		<img src=\"./img/blank.gif\" width=\"168\" height=\"1\" alt=\"\" />\r\n		{if $isManager and $competition.style neq \'Company-vs-Company\'}\r\n		<h2 class=\"withBG\">\r\n			<div class=\"topRight hideShow\">\r\n				<a href=\"javascript:toggle(\'managePlayers\', \'\', \'showHide\');\"><img id=\"managePlayers_img\" src=\"./img/blank.gif\" class=\"showHide_off\" alt=\"show/hide\" border=\"0\" /></a>\r\n			</div> \r\n			Manage\r\n		</h2>\r\n		<div id=\"managePlayers\" style=\"display:none;\">\r\n					<form name=\"managePlayers[]\" action=\"index.php\" method=\"POST\" style=\"margin:0px;\">\r\n					<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\">\r\n					<input type=\"hidden\" name=\"cid\" value=\"{$competition.id}\">\r\n					<input type=\"hidden\" name=\"no_expire\" value=\"true\">\r\n					<input type=\"hidden\" name=\"no_expire_keep_alive\" value=\"cid\">\r\n					<input type=\"hidden\" name=\"style\" value=\"{$competition.style}\">\r\n					<span class=\"cellHeadTiny\" style=\"clear:left;\">Del</span>\r\n					<span class=\"cellHead\">View Stats</span>\r\n					{* <span class=\"cellHeadSmall\">-</span> *}\r\n					<br />\r\n					{foreach from=$competition.users item=\"username\" key=\"userId\" name=\"dateUpdated\"}\r\n						<span class=\"cellTiny\" style=\"clear:left;\"><small><input type=\"checkbox\" name=\"managePlayers[delete][]\" value=\"{$username}\" style=\"width:14px;height:14px;margin:0px 2px;\"></small></span>\r\n						<span class=\"cell\"><small><a href=\"?pg=my_home&cid={$competition.id}&userId={$userId}&hideComps=1\">{$username}</a></small></span>\r\n						{* <span class=\"cellSmall\"><small><a href=\"mailto:{$compUser.email}\">email</a></small></span> *}\r\n						<br />\r\n					{/foreach}\r\n					<div style=\"text-align:center;\">\r\n                                                <br />\r\n						<input type=\"submit\" class=\"button\" value=\"Remove Selected\">\r\n					</div>\r\n					</form>\r\n		</div><br/>\r\n		{/if}\r\n		{* End new section for Player management. *}\r\n		\r\n		{* Begin new section for Team management.  This can be moved where ever. *}\r\n		{* ******************************** TEAM MANAGEMENT ***************************************** *}\r\n		{if $isManager and $competition.style eq \'Group-vs-Group\'}\r\n		<h2 class=\"withBG\">\r\n			<div class=\"topRight hideShow\">\r\n				<a href=\"javascript:toggle(\'teamManagement\', \'\', \'showHide\');\"><img id=\"teamManagement_img\" src=\"./img/blank.gif\" class=\"showHide_{if $smarty.request.showTeamManagement}on{else}off{/if}\" alt=\"show/hide\" border=\"0\" /></a>\r\n			</div>\r\n			Teams</h2>\r\n		<div id=\"teamManagement\" style=\"display:{if $smarty.request.showTeamManagement}block{else}none{/if};\">\r\n			<form name=\"manageTeam[]\" action=\"index.php\" method=\"POST\" style=\"margin:0px;\">\r\n			<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\">\r\n			<input type=\"hidden\" name=\"cid\" value=\"{$competition.id}\">\r\n			<input type=\"hidden\" name=\"no_expire\" value=\"true\">\r\n			<input type=\"hidden\" name=\"no_expire_keep_alive\" value=\"cid\">\r\n			<div id=\"playersList{counter}\">\r\n				<span class=\"cellHeadTiny\">Del</span>\r\n				<span class=\"cellHeadLarge\" style=\"width:134px;\">Team Name</span><br />\r\n				{foreach from=$competition.teams item=\"teams\" key=\"teamName\"}\r\n					{counter name=\"counterI\" start=\"0\" print=0}\r\n					{if $teamName ne \"Waiting to Join\"}\r\n						<span class=\"cellTiny\" style=\"clear:left;\"><small><input type=\"checkbox\" name=\"manageTeam[delete][]\" value=\"{$teamName|htmlspecialchars}\"></small></span>\r\n						<span class=\"cellLarge\" style=\"width:134px;\"><small><input id=\"renameTeam\" type=\"text\" value=\"{$teamName|htmlspecialchars}\" name=\"manageTeam[rename][{$teamName|htmlspecialchars}]\" size=\"10\" style=\"width:124px;height:12px\"></small></span><br />\r\n					{/if}\r\n				{/foreach}\r\n			</div>\r\n                        <br />\r\n			<div style=\"text-align:center;\">New Team: <input id=\"addTeam\" type=\"text\" name=\"manageTeam[addTeam]\" size=\"10\"><br />\r\n			<br />\r\n                        <input type=\"submit\" class=\"button\" value=\"Submit Changes\"></div>\r\n			</form>\r\n		</div><br />\r\n		{/if}\r\n		{* End new section for Team management. *}\r\n\r\n		\r\n		{* if !$isManager AND $competition.users|@count lt 45}{include file=\"layouts/ads.tpl\"}{assign var=\"adsShown\" value=\"1\"}{/if *}\r\n\r\n		{*\r\n			<h2 class=\"withBG\">Competition Stats</h2>\r\n			<span class=\"cellHeadLarge\">Category</span><span class=\"cellHeadSmall\">Result</span><br />\r\n			<span class=\"cellLarge\"><small>start weight</small></span>\r\n			<span class=\"cellSmall\"><small>{$competition.groupStartWeight|default:0} lbs</small></span><br />\r\n			<span class=\"cellLarge\"><small>weight lost</small></span>\r\n			<span class=\"cellSmall\"><small>{$competition.groupWeightLost|default:0} lbs</small></span><br />\r\n			{if $competition.groupPercentageWeightLost gt 0}<span class=\"cellLarge\"><small>% lost</small></span>\r\n			<span class=\"cellSmall\"><small>{$competition.groupPercentageWeightLost|default:0|number_format:\"2\"}</small></span><br />{/if}\r\n			<span class=\"cellLarge\"><small>fat intake</small></span>\r\n			<span class=\"cellSmall\"><small>{$competition.groupFat|default:0}</small></span><br />\r\n			<span class=\"cellLarge\"><small>calorie intake</small></span>\r\n			<span class=\"cellSmall\"><small>{$competition.groupCalories|default:0}</small></span><br />\r\n			<span class=\"cellLarge\"><small>minutes exercised</small></span>\r\n			<span class=\"cellSmall\"><small>{$competition.groupExercise|default:0}</small></span><br />\r\n			<span class=\"cellLarge\"><small>distance exercised</small></span>\r\n			<span class=\"cellSmall\"><small>{$competition.groupDistanceExercised|default:0}</small></span><br />\r\n			<img src=\"./img/blank.gif\" width=\"165\" height=\"1\" alt=\"\" />\r\n		*}\r\n		</td>\r\n		<td width=\"100%\" valign=\"top\">\r\n			<div id=\"contentBox\" class=\"centerBox\" style=\"margin-left:10px;\"><div class=\"topRightTreasure\">\r\n<div id=\"jackpot\">{if $competition.potAmount gt 0}${$competition.potAmount|number_format:2}{/if}</div>\r\n<h1 class=\"underline\">{$competition.title|default:\"Competition Title\"}</h1>\r\n\r\n{* ******************************** COMPETITION END *********************************** *}\r\n{if $competition.endDate lt $smarty.now}   {* COMPETITION IS OVER *}\r\n	{if $competition.results.winners|@count eq 1}\r\n		{* There was one winner, either by scoringMethod or tieBreakerMethod *}\r\n\r\n		{math assign=\"daysOfCompetition\" equation=\"(x - y) / z\" x=$competition.endDate|default:\"0\" y=$competition.startDate|default:\"0\" z=\"86400\"}\r\n		{math assign=\"marginOfVictory\" equation=\"x - y\" x=$competition.results.winningStat|default:\"0\" y=$competition.results.secondPlaceStat|default:\"0\"}\r\n\r\n		{foreach from=$competition.results.winners item=\"winnerName\"}    {*key=\"winnerName\"*}\r\n			{assign var=\"winnerData\" value=$competitions.users.$winnerName}\r\n			\r\n			{if $competition.style eq \"Group-vs-Group\"}\r\n				{assign var=\"description\" value=\"Winning Team\"}\r\n				{assign var=\"avg\" value=\"average\"}\r\n			{else}\r\n				{assign var=\"description\" value=\"Winner\"}\r\n			{/if}\r\n\r\n			<h2><br /><b>{$winnerName}</b> is the {$description}{if $competition.potAmount}, taking home <b>$<i>{$competition.potAmount|number_format:2}</i></b>{/if}!</h2>\r\n			<br />\r\n			{strip}\r\n			{if not $competition.results.isTie}   {* Not a Tie *}\r\n				After a difficult <b>{$daysOfCompetition|number_format:0}</b> days of \r\n				fierce competition, <b>{$winnerName}</b> is the \r\n				{$description}!	Based on \r\n				<b>{$competition.results.winningMethod}</b>, <b>{$winnerName}</b> \r\n				won with <b>{$competition.results.winningStat|number_format:2} \r\n				{if $competition.results.winningMethod eq \"Weight Lost\"}{$avg} pounds lost\r\n				{elseif $competition.results.winningMethod eq \"Percentage Weight Lost\"}{$avg} % body weight lost\r\n				{elseif $competition.results.winningMethod eq \"Minutes Exercise\"}{$avg} minutes exercised\r\n				{elseif $competition.results.winningMethod eq \"Distance Exercised\"}{$avg} miles exercised\r\n				{elseif $competition.results.winningMethod eq \"Weight Gained\"}{$avg} pounds gained\r\n				{/if}</b>.\r\n			{else}                                {* A Tie! *}\r\n				{assign var=\"weightLost\" value=\"Weight Lost\"}\r\n				{assign var=\"percentLost\" value=\"Percentage Weight Lost\"}\r\n\r\n				After a difficult <b>{$daysOfCompetition|number_format:0}</b> \r\n				days of fierce competition, there was a tie in the judging \r\n				method, <b>{$competition.scoringMethod}</b>. To break this \r\n				tie, the selected tie breaking method, \r\n				<b>{$competition.tieBreakerMethod}</b>, was used to determine \r\n				<b>{$winnerName}</b> as the {$description}. <b>{$winnerName}</b> \r\n				won with <b>{$competition.results.winningStat|number_format:2}\r\n				{if $competition.results.winningMethod eq \"Weight Lost\"}{$avg} pounds lost\r\n				{elseif $competition.results.winningMethod eq \"Percentage Weight Lost\"}{$avg} % body weight lost\r\n				{elseif $competition.results.winningMethod eq \"Minutes Exercise\"}{$avg} minutes exercised\r\n				{elseif $competition.results.winningMethod eq \"Distance Exercised\"}{$avg} miles exercised\r\n				{elseif $competition.results.winningMethod eq \"Weight Gained\"}{$avg} pounds gained\r\n				{/if}</b>.\r\n				<!--\r\n				<b>{$winnerData.$weightLost|number_format:0} pounds</b>, which \r\n				was <b>{$winnerData.$percentLost|number_format:4}%</b> body weight.\r\n				-->\r\n			{/if}\r\n			{/strip}\r\n			<br />\r\n			<br />\r\n			<b>{$winnerName}</b> won with a <b>{$marginOfVictory|number_format:3}</b> margin over <b>{$competition.results.secondPlaceUser}</b>.\r\n			\r\n			<h2><br />Congratulations to you all!</h2>\r\n			<br />\r\n			<div class=\"underline\"></div>\r\n		{/foreach}\r\n\r\n	{elseif $competition.results.winners|@count gt 1}\r\n		{* There were multiple winners, even after tieBreakerMethod (should RARELY happen) *}\r\n	\r\n		<h2>There was a tie in this competition. The winners, by <b>{$competition.results.winningMethod}</b> having lost <b>{$competition.results.winningStat}</b>, are:<br /></h2>\r\n		<ul>\r\n		{foreach from=$competition.results.winners item=\"winnerData\" key=\"winnerName\"}\r\n			<li>{$winnerName}</li>\r\n		{/foreach}\r\n		</ul>\r\n		\r\n	{else}\r\n		{* For some reason, there were no winners *}\r\n\r\n		<h2><br />\r\n		Winner information is being calculated. <br />\r\n		Please check back soon.\r\n		<br /><br /></h2>\r\n	{/if}\r\n	This competition has ended and is no longer active.<br />\r\n{/if}\r\n{* ************************************************************************************ *}\r\n\r\n<div id=\"prizeDesc\">{$competition.potDescription}<br />\r\n{if $competition.potAmount}<small style=\"color:#FFF;\">(${$competition.individualPotAmount} from {$competition.potMethod})</small>{/if}</div>\r\n\r\n{if $competition.startDate lt $smarty.now}\r\n	Time remaining: <b>{$competition.timeLeft}</b><br />\r\n{else}\r\n	This competition has not yet started!<br />\r\n{/if}\r\n\r\nStart{if $competition.startDate lt $smarty.now}ed{else}s{/if}: <b>{$competition.startDate|date_format2:\"n/j/Y\"}</b> &nbsp; \r\nEnd{if $competition.endDate lt $smarty.now}ed{else}s{/if}: <b>{$competition.endDate|date_format2:\"n/j/Y\"}</b><br />\r\n{if $competition.calculationMode neq \"Real-Time\"}Competition stats/scoring updated as of {$competition.dateOfObject|date_format2:\"n/j/Y g:i A\"}{if $isManager} (<a href=\"?pg=competition&cid={$smarty.request.cid}&nocache=1\">Update Now!</a>){/if}<br />{/if}\r\n<div style=\"font-size:5px;clear:left;\">&nbsp;</div>\r\n{assign var=\"scoringMethod\" value=$competition.scoringMethod}\r\n{assign var=\"tieBreakerMethod\" value=$competition.tieBreakerMethod}\r\n{assign var=\"weeklyWinnersMethod1\" value=$competition.weeklyWinnersMethod1}\r\n{assign var=\"weeklyWinnersMethod2\" value=$competition.weeklyWinnersMethod2}\r\n\r\n{* ******************** WEEKLY WINNERS ********************* *}\r\n{if $competition.weeklyWinners}\r\n	{if $weeklyWinnersMethod1}             {* DON\'T FORGET TO REMOVE THE ACM CHECK WHEN READY!!! *}\r\n		<h2 class=\"withBG\">\r\n			<div class=\"topRight hideShow\">\r\n			<a href=\"javascript:toggle(\'weeklyWinners\', \'\', \'showHide\');\"><img id=\"weeklyWinners_img\" src=\"./img/blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a></div>\r\n			Last Week\'s Winners<i>!</i> <small style=\"color:#000; font-size:11px;\">(<i><b>{$competition.weeklyWinners.startDate|date_format2:\"D n/j\"}</b> through <b>{$competition.weeklyWinners.endDate|date_format2:\"D n/j\"}</b></i>)</small></h2> \r\n		<div id=\"weeklyWinners\">\r\n		<table width=\"100%\" cellpadding=\"3\" cellspacing=\"0\"><tr>\r\n		<td valign=\"top\" width=\"50%\">\r\n		<div class=\"cellHeadLarge\" style=\"width:auto;float:none;\">{$weeklyWinnersMethod1}</div>\r\n		<img src=\"{$skinFolder}images/winner_1.gif\" style=\"float:left;\" />\r\n		{strip}\r\n		{foreach name=\"method1\" from=$competition.weeklyWinners.$weeklyWinnersMethod1 item=\"username\"}\r\n			{assign var=\"userValue\" value=$competition.weeklyWinners.users.$username.$weeklyWinnersMethod1}\r\n			{if $smarty.foreach.method1.iteration gt 3 OR $userValue lte 0}{if $smarty.foreach.method1.iteration eq 1}Don\'t forget to update your progress so there will be winners next week{/if}<i>!</i>{php}break;{/php}\r\n			{elseif $smarty.foreach.method1.iteration eq 1}\r\n				<b>{$username|default:\"[ ?? ]\"|ucfirst}</b> led the way last week by \r\n				{if $weeklyWinnersMethod1 eq \'Weight Lost\'}losing <b>{$userValue}</b> pounds{elseif $weeklyWinnersMethod1 eq \'Percentage Weight Lost\'}losing <b>{$userValue|number_format:\"2\"}%</b> body weight{elseif $weeklyWinnersMethod1 eq \'Minutes Exercise\'}exercising <b>{$userValue}</b> minutes{elseif $weeklyWinnersMethod1 eq \'Distance Exercised\'}exercising a distance of <b>{$userValue}</b> {elseif $weeklyWinnersMethod1 eq \'Weight Gained\'}gaining <b>{$userValue}</b> pounds{else}<b>default</b>{/if}\r\n			{else}\r\n				{if $smarty.foreach.method1.iteration eq 2}, followed by <b>{$username|default:\"[ ?? ]\"|ucfirst}</b> with \r\n				{else} and <b>{$username|default:\"[ ?? ]\"|ucfirst}</b> with \r\n				{/if}\r\n				{if $weeklyWinnersMethod1 eq \'Weight Lost\'}<b>{$userValue}</b> pounds{elseif $weeklyWinnersMethod1 eq \'Percentage Weight Lost\'}<b>{$userValue|number_format:\"2\"}%</b>{elseif $weeklyWinnersMethod1 eq \'Minutes Exercise\'}<b>{$userValue}</b> minutes{elseif $weeklyWinnersMethod1 eq \'Distance Exercised\'}a distance of <b>{$userValue}</b>{elseif $weeklyWinnersMethod1 eq \'Weight Gained\'}<b>{$userValue}</b> pounds{/if}\r\n			{/if}\r\n		{/foreach}\r\n		{/strip}\r\n		</td>\r\n	{/if}\r\n	{if $weeklyWinnersMethod2} \r\n		<td valign=\"top\" width=\"50%\">\r\n		<div class=\"cellHeadLarge\" style=\"width:auto;float:none;\">{$weeklyWinnersMethod2}</div>\r\n		<img src=\"{$skinFolder}images/winner_2.gif\" style=\"float:left;\" />\r\n		{* display var=$competition.weeklyWinners.users *}\r\n		{strip}\r\n		{foreach name=\"method2\" from=$competition.weeklyWinners.$weeklyWinnersMethod2 item=\"username\"}\r\n			{assign var=\"userValue\" value=$competition.weeklyWinners.users.$username.$weeklyWinnersMethod2}\r\n			\r\n			{if $smarty.foreach.method2.iteration gt 3 OR $userValue lte 0}{if $smarty.foreach.method2.iteration eq 1}Don\'t forget to update your progress so there will be winners next week{/if}<i>!</i>{php}break;{/php}\r\n			{elseif $smarty.foreach.method2.iteration eq 1}\r\n				<b>{$username|default:\"[ ?? ]\"|ucfirst}</b> won by \r\n				{if $weeklyWinnersMethod2 eq \'Weight Lost\'}losing <b>{$userValue}</b> pounds{elseif $weeklyWinnersMethod2 eq \'Percentage Weight Lost\'}losing <b>{$userValue|number_format:\"2\"}%</b> body weight{elseif $weeklyWinnersMethod2 eq \'Minutes Exercise\'}exercising <b>{$userValue}</b> minutes{elseif $weeklyWinnersMethod2 eq \'Distance Exercised\'}exercising a distance of <b>{$userValue}</b>{elseif $weeklyWinnersMethod2 eq \'Weight Gained\'}gaining <b>{$userValue}</b> pounds{/if}\r\n			{else}\r\n				{if $smarty.foreach.method2.iteration eq 2}, followed by <b>{$username|default:\"[ ?? ]\"|ucfirst}</b> with \r\n				{else} and <b>{$username|default:\"[ ?? ]\"|ucfirst}</b> with \r\n				{/if}\r\n				{if $weeklyWinnersMethod2 eq \'Weight Lost\'}<b>{$userValue}</b> pounds{elseif $weeklyWinnersMethod2 eq \'Percentage Weight Lost\'}<b>{$userValue|number_format:\"2\"}%</b>{elseif $weeklyWinnersMethod2 eq \'Minutes Exercise\'}<b>{$userValue}</b> minutes{elseif $weeklyWinnersMethod2 eq \'Distance Exercised\'}a distance of <b>{$userValue}</b>{elseif $weeklyWinnersMethod2 eq \'Weight Gained\'}<b>{$userValue}</b> pounds{/if}\r\n			{/if}\r\n		{/foreach}\r\n		{/strip}\r\n		</td>\r\n	{/if}\r\n	{if $weeklyWinnersMethod1}\r\n	</tr></table></div>{/if}\r\n{/if}\r\n{* ********************************************************* *}\r\n\r\n{if $acm->isDomainAdmin() and $smarty.request.debug}\r\n	{display var=$competition}\r\n{/if} \r\n\r\n{* ******************************** COMPARISON GRAPHS ***************************************** *}\r\n{if $competition.graphParameters|@count}\r\n<script type=\"text/javascript\">{literal}\r\n	function rewriteGraphLinks() {\r\n		var gLinksDiv = document.getElementById(\'graphLinksDiv\');\r\n		gLinksDiv.innerHTML = \'\';\r\n		{/literal}{foreach name=\"graphTypes\" from=$competition.graphParameters item=\"cgp\"}\r\n		gLinksDiv.innerHTML += \'<a href=\"?pg=flashgraph-frame&compId={$competition.id}&type={$cgp.name|niceText|replace:\" \":\"+\"}&esId={$cgp.estatId}&basedOn={$cgp.basedOn|replace:\" \":\"+\"}&fillPrevious={if $cgp.assumeConstantValues eq \"yes\"}1{else}0{/if}&precision={$cgp.decimalPlaces}&format=wide&userIds=\'+GUIDs+\'\" target=\"graphwindow\"><small>{$cgp.name|niceText|replace:\" \":\"&nbsp;\"}&nbsp;-&nbsp;{$cgp.basedOn|niceText|replace:\" \":\"&nbsp;\"}</small></a>{if !$smarty.foreach.graphTypes.last} | {/if}\';\r\n		{/foreach}\r\n	{literal}\r\n	}\r\n{/literal}</script>\r\n<h2 class=\"withBG\"><a name=\"graph\"></a>\r\n	<div class=\"topRight hideShow\">\r\n		<a href=\"javascript:toggle(\'graphs\', \'\', \'showHide\');\"><img id=\"graphs_img\" src=\"./img/blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a></div> \r\n	Comparison Graphs &nbsp; <small><i>No graph? <a href=\"http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash\" target=\"_blank\">click here</a> to download the free Flash Player plug-in.</i></small></h2>\r\n<div id=\"graphs\" style=\"display:block;\">\r\n	<table border=\"0\" cellpadding=\"0\" width=\"100%\">\r\n		{assign var=\"graphURL\" value=\"?pg=flashgraph-frame&format=wide\"}\r\n	<tr>\r\n		<td><div style=\"border:#999 1px solid;background-color:#FFF;padding:5px;\"><iframe \"iframe_graphwindow\" name=\"graphwindow\" src=\"{$graphURL}\" frameborder=\"0\" width=\"625\" height=\"230\" scrollbars=\"no\"></iframe></div></td>\r\n	</tr>\r\n	<tr>\r\n		<td valign=\"top\" align=\"center\" width=\"100%\">\r\n		<div id=\"graphLinksDiv\">\r\n		<small>\r\n		{foreach name=\"graphTypes\" from=$competition.availableGraphs key=\"graphType\" item=\"graphParams\"}\r\n		<a href=\"?pg=flashgraph-frame&compId={$competition.id}&{$graphParams}\');\" target=\"graphwindow\">{$graphType}</a>{if $smarty.foreach.graphTypes.iteration neq $competition.availableGraphs|@count} | {/if}\r\n		{/foreach}\r\n		</small></div></td>\r\n	</tr>\r\n	</table>\r\n	<script type=\"text/javascript\">\r\n		rewriteGraphLinks();\r\n	</script>\r\n<br />\r\n</div>\r\n{/if}\r\n\r\n{* ******************************** GROUP TEAMS/PLAYERS SUMMARY W/MOVING ***************************************** *}\r\n{if $competition.style eq \'Group-vs-Group\' or $competition.style eq \'Company-vs-Company\'}\r\n<h2 class=\"withBG\">\r\n	<div class=\"topRight hideShow\">\r\n		<a href=\"javascript:toggle(\'teams\', \'\', \'showHide\');\"><img id=\"teams_img\" src=\"./img/blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a></div> \r\n	The Teams &nbsp; <small><i>Assignments and statistics</i></small></h2>\r\n<div id=\"teams\" style=\"display:block;\">\r\n<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" border=\"0\"><tr><td>\r\n	<div align=\"right\" style=\"border-bottom:1px solid black; margin:2px; padding:2px;\">All stats based on: {$smarty.capture.scoringMethod}</div>\r\n	{if $isManager}\r\n		<form name=\"changeTeam\" action=\"index.php\" method=\"POST\" style=\"margin:0px;\">\r\n			<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\">\r\n			<input type=\"hidden\" name=\"cid\" value=\"{$competition.id}\">\r\n			<input type=\"hidden\" name=\"no_expire\" value=\"true\">\r\n			<input type=\"hidden\" name=\"no_expire_keep_alive\" value=\"cid\">\r\n	{/if}\r\n		{assign var=\"minEx\" value=\"Minutes Exercise\"}\r\n		{assign var=\"distEx\" value=\"Distance Exercised\"}\r\n		{assign var=\"pctLst\" value=\"Percentage Weight Lost\"}\r\n		{assign var=\"wtLst\" value=\"Percentage Weight Lost\"}\r\n		{foreach from=$competition.team_data name=\"teamsLoop\" item=\"teamScore\" key=\"teamName\"}\r\n			<div id=\"playersList{$smarty.foreach.teamsLoop.iteration}\" style=\"float:left;width:310px;overflow:hidden;word-wrap:nowrap; margin:0px 5px 5px 0px;\">\r\n			{if $teamName eq \"Waiting to Join\"}<h2>Not assigned to a team</h2>{else}<h4><span style=\"font-weight:normal;\">#{$smarty.foreach.teamsLoop.iteration}) </span>{$teamName|default:\"&nbsp;\"}{/if}</h4>\r\n			<table cellpadding=\"0\" cellspacing=\"0\" style=\"width:250px; background-color:#FFC;\">\r\n			<tr>\r\n				<td class=\"thinCell\" width=\"55%\">Name</td>\r\n				<td class=\"thinCell\" width=\"25%\"><img src=\"{$skinFolder}images/trophy_ico.gif\" width=\"15\" height=\"15\" alt=\"\" /></td>\r\n				<td class=\"thinCell\" width=\"20%\">Update</span>\r\n			</tr>\r\n			{foreach from=$competition.teams.$teamName item=\"userId\"}\r\n			<tr>\r\n				<td class=\"thinCell\" style=\"text-align:left;\"><small>{if $isManager}<input type=\"checkbox\" name=\"changeTeam[players][{$competition.users.$userId}]\" />{/if}{$competition.users.$userId}</small></td>\r\n				{* <span class=\"cellTiny\"><small>{if $users.hideInitialWeight neq \"Yes\"}{$users.$pctLst|number_format:\"2\"|replace:\".00\":\"\"}{else}-{/if}</small></span> *}\r\n				<td class=\"thinCell\"><small>{$competition.data.$userId.val|number_format:$competition.current_parameter.decimalPlaces}</small></td>\r\n				<td class=\"thinCell\"><small>{if $competition.data.$userId.doe}{$competition.data.$userId.doe|date_format2:\"n/j/y\"}{else}Never{/if}</small></td>\r\n			</tr>\r\n			{foreachelse}\r\n			{* No players assigned to this team. *}\r\n			<tr>\r\n				<td class=\"thinCell\">No players yet.</td>\r\n			</tr>\r\n			{/foreach}\r\n\r\n			</table>\r\n			</div>\r\n		{/foreach}\r\n	{if $isManager and $competition.style neq \'Company-vs-Company\'}\r\n		<br />\r\n		<select name=\"changeTeam[team]\">\r\n			<option value=\"\">Move selected players to...</option>\r\n			{foreach from=$competition.teams item=\"newTeams\" key=\"newTeamName\"}\r\n				{*if $newTeamName ne $teamName and $newTeamName ne \"Waiting to Join\"*}\r\n				{if $newTeamName ne \"Waiting to Join\"}\r\n					<option value=\"{$newTeamName}\">{$newTeamName}</option>\r\n				{/if}\r\n			{/foreach}\r\n		</select><br />\r\n		<input type=\"submit\" class=\"button\" value=\"Submit Changes\">\r\n		</form>\r\n	{/if}\r\n</td></tr></table>\r\n</div>\r\n{/if}\r\n</div>\r\n	{* ******************************** DISCUSSION BOARD ***************************************** *}\r\n<br />\r\n<h2 class=\"withBG\">\r\n	<div class=\"topRight hideShow\">\r\n		<a href=\"javascript:toggle(\'discuss\', \'\', \'showHide\');\"><img id=\"discuss_img\" src=\"./img/blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a></div> \r\n	Discussion Board</h2>\r\n<div id=\"discuss\" style=\"display:block;\">\r\n	<table cellpadding=\"0\" width=\"100%\" border=\"0\"><tr><td><iframe src=\"?pg=competition/forum\" id=\"discussionBoard\" frameborder=\"0\" scrolling=\"yes\" style=\"width:100%;\"></iframe></td></tr></table>\r\n</div>\r\n\r\n</div></td>\r\n</tr></table>\r\n\r\n{*\r\n<script type=\"text/javascript\">{literal}\r\n	if ( window.frames != null ) {\r\n	    for ( i = 0; i< window.frames.length; i++ )\r\n	        window.alert (\"Child window \" +i+ \" is named \"+window.frames(i).name);\r\n	}\r\n{/literal}</script>\r\n*}'),(4144,45,0.29,'smarty','0','Hiding widgets.',1123492236,3,'67.166.75.78','{assign var=\"hideWidgets\" value=\"true\"}\r\n{assign var=\"wideFormat\" value=\"true\"}\r\n\r\n{php}$GLOBALS[\'SPADE\'][\'db\']->debugModeOn();{/php}\r\n\r\n{if $smarty.request.tm_style_table}\r\n	{session_write var=\"tm_style_table\" value=$smarty.request.tm_style_table}\r\n{/if}\r\n{if $smarty.request.tm_template}\r\n	{session_write var=\"tm_template\" value=$smarty.request.tm_template}\r\n{/if}\r\n\r\n<div align=\"right\">\r\n<form style=\"margin:0px;\" name=\"tmstyleform\" method=\"get\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\">\r\nBorder Styles:\r\n<select name=\"tm_style_table\" onchange=\"if(this.value != \'\')this.form.submit();\">\r\n	<option value=\"\">-Change-</option>\r\n	<option value=\"gray\">Gray</option>\r\n	<option value=\"gray_bubble\">Gray Bubble</option>\r\n	<option value=\"blue-white\">Blue-White</option>\r\n	<option value=\"blue-blue\">Blue-Blue</option>\r\n	<option value=\"chrome\">Chrome</option>\r\n	<option value=\"purple-white\">Purple-White</option>\r\n	<option value=\"redlava\">redlava</option>\r\n</select>\r\n&nbsp;&nbsp;\r\nTemplate:\r\n<select name=\"tm_template\" onchange=\"if(this.value != \'\')this.form.submit();\">\r\n	<option value=\"\">-Change-</option>\r\n	<option value=\"default\">Default</option>\r\n	<option value=\"slate\">Slate</option>\r\n</select>\r\n</form>\r\n</div>\r\n\r\n{assign var=\"template\" value=$smarty.session.safe.tm_template|default:\"slate\"}\r\n\r\n\r\n{tablemanager\r\n	Assign=\"tm\"\r\n	Group=\"admin_tools\"\r\n	Profile=\"manage_users\"\r\n	DeleteLogFile=\"tm-delete.log\"\r\n	TemplatePath=\"TM/templates/\"\r\n	StyleTablePath=\"systems/onai/img/st/\"\r\n	StyleTable=$smarty.session.safe.tm_style_table|default:\"gray\"\r\n	AddTemplate=$template|cat:\"_edit.tpl\"\r\n	MainTemplate=$template|cat:\"_main.tpl\"\r\n	ListTemplate=$template|cat:\"_list.tpl\"\r\n	EditTemplate=$template|cat:\"_edit.tpl\"\r\n	Action=\"list\"\r\n	LoginRequired=\"false\"\r\n	HeadingColor=\"90A9C4\"\r\n	HighlightColor=\"F6F9B5\"\r\n	ResultsPerPage=\"20\"\r\n	Color1=\"F7F7F7\"\r\n	Color2=\"E7E7E7\"\r\n	DataStyle=\"hideWrap\"\r\n	MaxStringLength=\"50\"\r\n	DateFormat=\"M j, Y h:i a \"\r\n	}\r\n\r\n'),(4145,259,0.10,'smarty','0','Page created.',1123492362,3,'67.166.75.78',''),(4146,259,0.11,'smarty','0','Page created.',1123492388,3,'67.166.75.78','<h1>{$page.title}</h1>\r\n\r\n{include_php file=\"shared_handle:preferences/userUpdate\"}\r\n\r\n{assign var=\"currentCategory\" value=\"\"}\r\n\r\n<form method=\"post\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n\r\n{literal}\r\n<script type=\"text/javascript\">\r\nfunction checkNumber(value, min, max, precision) {\r\n	if(value == \'\') return;\r\n	var message = \'\';\r\n	if(value < min || value > max) {\r\n		message = \'Value must be between \' + min + \' and \' + max + \'.\\n\\n\';\r\n		if(precision > 0) {\r\n			message += \'NOTE: Value may be truncated after \' + precision + \' decimal places.\';\r\n		}\r\n	}\r\n	if (value.match(/.*\\..*\\./)) {\r\n		message += \'Please enter a valid number.\';\r\n	}\r\n	if(message) alert(message);\r\n}\r\n</script>\r\n{/literal}\r\n{display var=$prefValues}\r\n<table>\r\n{foreach from=$aPrefs item=row}\r\n{* display var=$row *}\r\n{assign var=\"lockedName\" value=\"`$row.name`_locked\"}\r\n{if $currentCategory neq $row.category}\r\n	{assign var=\"currentCategory\" value=$row.category}\r\n	<tr><td colspan=\"2\"><h2 class=\"withBG\">{$currentCategory}</h2></td></tr>\r\n{/if}\r\n<tr><td valign=\"top\">{$row.description}</td>\r\n{if $row.inputType|test_or:\"select-one\":\"select-multiple\":\"radios\":\"checkboxes\"}\r\n	{assign_array var=\"aOptions\" values=$row.validInput}\r\n	{assign_array var=\"aValues\" values=$prefValues[$row.name]}\r\n	{assign_array var=\"aDefaults\" values=$row.defaultValue}\r\n	{* display var=$aDefaults *}\r\n	{display var=$aValues}\r\n{/if}\r\n	<td valign=\"top\">\r\n{if $row.inputType eq \"string\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" maxlength=\"{$row.validInput}\" name=\"prefs[{$row.name}]\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n{elseif $row.inputType eq \"integer\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9]/))this.value = this.value.replace(/[^0-9]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n{elseif $row.inputType eq \"float\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9\\.]/))this.value = this.value.replace(/[^0-9\\.]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n{elseif $row.inputType eq \'select-one\' OR $row.inputType eq \'select-multiple\'}\r\n	<select name=\"prefs[{$row.name}]{if $row.inputType eq \'select-multiple\'}[]\" multiple=\"multiple\" size=\"{$row.inputSize}{/if}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if}>\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<option value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option|@in_array:$aValues)} selected=\"selected\"{/if}>{$option}</option>\r\n	{/foreach}</select>\r\n{elseif $row.inputType eq \"radios\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"radio\" name=\"prefs[{$row.name}]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option eq $prefValues[$row.name])} checked=\"checked\"{/if}{if $prefValues[$lockedName]} disabled=\"disabled\"{/if}> {$option}<br />\r\n	{/foreach}\r\n{elseif $row.inputType eq \"checkboxes\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"checkbox\" name=\"prefs[{$row.name}][]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND !$row.name|@inArray:$savedPrefs AND $option|@inArray:$aDefaults) OR ($option|@inArray:$aValues)} checked=\"checked\"{/if}{if $prefValues[$lockedName]} disabled=\"disabled\"{/if}> {$option}<br />\r\n	{/foreach}\r\n	<input type=\"hidden\" name=\"prefs[{$row.name}][]\" value=\"END:{$row.name}\" /> \r\n{elseif $row.inputType eq \"regex\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onchange=\"if(!this.value.match({$row.validInput})) alert (\'\\\'\' + this.value + \'\\\' is not valid for \\\'{$row.description}\\\'.\')\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n{else}\r\n	Unrecognized Input Type! <b>({$row.inputType})</b>\r\n{/if} \r\n	</td>\r\n</tr>\r\n{/foreach}\r\n</tr>\r\n</table>\r\n\r\n<div align=\"right\">\r\n	<input type=\"submit\" name=\"prefAction\" value=\"Save Changes\" />\r\n</div>\r\n</form>'),(4147,138,0.42,'smarty','0','Added a quick debug link.',1123492688,3,'67.166.75.78','{assign var=\"pgLayout\" value=\"none\"}<html>\r\n<head>\r\n	<link rel=\"stylesheet\" href=\"{$skinFolder}/styles/base.css\" />\r\n	{if $styleName neq \"\"}<link rel=\"stylesheet\" type=\"text/css\" href=\"{$skinFolder}styles/{$styleName}.css\" />{/if}\r\n</head>\r\n<body style=\"margin:0px;background-image:none;\">\r\n\r\n{if $smarty.request.compId}\r\n	{assign var=\"compId\" value=\"comp\"|cat:$smarty.request.compId}\r\n{/if}\r\n{assign var=\"type\" value=$smarty.request.type}\r\n{assign var=\"fillPrevious\" value=$smarty.request.fillPrevious|default:\"1\"}\r\n{assign var=\"precision\" value=$smarty.request.precision|default:\"0\"}\r\n{assign var=\"stars\" value=$smarty.request.stars|default:\"\"}\r\n{assign var=\"totalChange\" value=$smarty.request.totalChange|default:\"0\"}\r\n{assign var=\"userIds\" value=$smarty.request.userIds|default:\"\"}\r\n{if $smarty.request.gParams}{include_php file=\"shared_handle:assignGraphParams\"}{/if}\r\n{if $smarty.request.format eq \"small\"}\r\n	{assign var=\"url\" value=$skinFolder|cat:\"/flash/grapher_sm.swf?id=\":$compId:\"!\":$type:\"!\":$fillPrevious:\"!\":$precision:\"!\":$stars:\"!\":$totalChange:\"!\":$userIds:\"&session_id=\":$smarty.session.session_id}\r\n{elseif $smarty.request.format eq \"wide\"}\r\n	{assign var=\"url\" value=$skinFolder|cat:\"/flash/grapher_wide.swf?id=\":$compId:\"!\":$type:\"!\":$fillPrevious:\"!\":$precision:\"!\":$stars:\"!\":$totalChange:\"!\":$userIds:\"&session_id=\":$smarty.session.session_id}\r\n{else}\r\n	{assign var=\"url\" value=$skinFolder|cat:\"/flash/grapher.swf?id=\":$compId:\"!\":$type:\"!\":$fillPrevious:\"!\":$precision:\"!\":$stars:\"!\":$totalChange:\"!\":$userIds:\"&session_id=\":$smarty.session.session_id}\r\n{/if}\r\n\r\n{* assign var=\"url\" value=$skinFolder|cat:\"/flash/grapher{if $smarty.request.format eq \"small\"}_sm{elseif $smarty.request.format eq \"wide\"}_wide{/if}.swf?id=comp1!weight!1!0!!1&session_id=\":$smarty.session.session_id\" *}\r\n\r\n<h3 class=\"underline\">&nbsp; {if $userIds}Showing{else}Comparing{/if} {if $totalChange}Change in {/if}{$type|niceText} Over Time</h3>\r\n{* if $type}\r\n	{if $smarty.request.format eq \"small\"}\r\n		{swf src=$url width=\"425\" height=\"195\" bgcolor=\"#FFFFFF\" wmode=\"transparent\"}\r\n	{elseif $smarty.request.format eq \"wide\"}\r\n		{swf src=$url width=\"595\" height=\"195\" bgcolor=\"#FFFFFF\" wmode=\"transparent\"}\r\n	{else}\r\n		{swf src=$url width=\"555\" height=\"195\" bgcolor=\"#FFFFFF\" wmode=\"transparent\"}\r\n	{/if}\r\n{else}\r\n	{if $smarty.request.format eq \"small\"}\r\n		<img src=\"{$systemFolder}images/choose_graph_small.gif\" width=\"421\" height=\"187\" />\r\n	{else}\r\n		<img src=\"{$systemFolder}images/choose_graph_wide.gif\" width=\"588\" height=\"180\" />\r\n	{/if}\r\n{/if *}\r\n\r\n<ul>\r\n	<li>The eHealthCompete graphing engine is temporarily unavailable due to upgrades.</li>\r\n</ul>\r\n\r\n{if $acm->isDomainAdmin()}\r\n	{$smarty.request.gParams}\r\n	{assign var=\"debugUrl\" value=$url|regex_replace:\"/.*\\?/\":\"?pg=flashgraph&\"}\r\n	Debug this graph: <a href=\"{$debugUrl}\" target=\"_blank\">Source</a> | <a href=\"{$debugUrl}&debug=1\" target=\"_blank\">Debugger</a>\r\n{/if}\r\n\r\n</body></html>'),(5330,233,1.76,'smarty','0','Working on e-mail your team feature.',1258158620,2,'206.71.78.158','{assign var=\"hideWidgets\" value=0}\r\n{assign var=\"hideUserBox\" value=\"false\"}\r\n{assign var=\"showCompanyNews\" value=\"true\"}\r\n{assign var=\"pgLayout\" value=\"layouts/withLeftNav.tpl\"}\r\n{assign var=\"GUIDs\" value=\"\"}\r\n\r\n{select_query assign=\"managerId\" return=\"val\"}\r\n	userId FROM competitions c WHERE c.id = {$smarty.request.cid}\r\n{/select_query}\r\n\r\n{if $managerId eq $user->id or $acm->isDomainAdmin()}\r\n	{assign var=\"isManager\" value=\"true\"}\r\n	<!-- ismanager -->\r\n{/if}\r\n\r\n{if $isManager or \'yes\' == $smarty.session.company.preferences.anyone_joins_teams}\r\n	{assign var=\"canCreateTeams\" value=\"true\"}\r\n	{assign var=\"canAssignToTeams\" value=\"true\"}\r\n	{include_php file=\"shared_handle:competition/management\"}\r\n{/if}\r\n\r\n{include_php file=\"shared_handle:competition/load\"}\r\n\r\n<script type=\"text/javascript\">{literal}\r\n	var GUIDs = \'0\';\r\n\r\n	function updateGUIDs() {\r\n		var checkBoxes = document.forms[\'leaderBoardForm\'][\"graphCheckbox[]\"];\r\n		if (!checkBoxes.length) {\r\n			checkBoxes[0] = checkBoxes;\r\n			checkBoxes.length = 1;\r\n		}\r\n		GUIDs = \'\';\r\n		for (var x = 0; x < checkBoxes.length; x++) {\r\n			if (checkBoxes[x].checked == true && checkBoxes[x].value) {\r\n				GUIDs += checkBoxes[x].value+\',\'; \r\n			}\r\n			\r\n		}\r\n		rewriteGraphLinks();\r\n	}\r\n\r\n\r\n	function loadGraphWindow(graphParams) {\r\n		uri = \'?pg=flashgraph-frame&compId={/literal}{$competition.id}{literal}; //&\'+graphParams+\'&userIds=\'+GUIDs;\r\n		var gFrame = window.frames[\'graphwindow\'];\r\n		// gFrame.location.replace(uri);\r\n		var gForm = document.getElementById(\'form_leaderBoard\');\r\n		gForm.gParams.value = graphParams;\r\n		gForm.userIds.value = GUIDs;\r\n		gForm.submit();\r\n		return false;\r\n	}\r\n{/literal}</script>\r\n\r\n{include_php file=\"shared_handle:competition.verifyInitialPot\"}\r\n\r\n{capture name=\"scoringMethod\"}\r\n	<b>{$competition.current_parameter.name|capitalize}</b> ({$competition.current_parameter.units}) - {$competition.current_parameter.basedOn|capitalize}{* - {$competition.current_parameter.polarity|capitalize} *}\r\n{/capture}\r\n\r\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\r\n	<tr>\r\n		<td valign=\"top\" width=\"275\">\r\n\r\n		{if $competition.prizes|@count}\r\n		<br />\r\n		<h2 class=\"withBG\">\r\n			<div class=\"topRight hideShow\">\r\n					<a href=\"javascript:toggle(\'winners\', \'\', \'showHide\');\"><img id=\"winners_img\" src=\"./img/blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a>\r\n				</div>\r\n			Winners\r\n		</h2>\r\n\r\n		<div id=\"winners\" style=\"display:block;\">\r\n		{foreach from=$competition.prizes item=\"prize\" key=\"prizeId\"}\r\n			<a href=\"javascript://\" onclick=\"window.open(\'?pg=competition/winners&cid={$competition.id}&prizeId={$prizeId}\', \'\', \'height=425,width=300,menubar=no,status=no,scrollbars=yes,titlebar=no,resizable=yes\');\">{$prize.title}</a><br />\r\n		{/foreach}\r\n		</div>\r\n		{/if}\r\n		\r\n		<br />\r\n		<h2 class=\"withBG\">\r\n			<div class=\"topRight hideShow\">\r\n					<a href=\"javascript:toggle(\'leaderBoard\', \'\', \'showHide\');\"><img id=\"leaderBoard_img\" src=\"./img/blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a>\r\n				</div>\r\n			Leaders\r\n		</h2>\r\n		\r\n		{if $competition.dateOfObject}<div align=\"right\"><small><i>as of {$competition.dateOfObject|date_format2:\"n/j/Y g:i A\"}</i></small></div>{/if}\r\n\r\n		<div id=\"leaderBoard\" style=\"display:block;\">\r\n		<small>{$smarty.capture.scoringMethod}</small><br />\r\n		{if $competition.style eq \"Group-vs-Group\"}\r\n			<div align=\"center\" style=\"font-size:9px; color:#000;\">(Team Average)</div>\r\n		{elseif $competition.style eq \"Company-vs-Company\"}\r\n			<div align=\"center\" style=\"font-size:9px; color:#000;\">(Company Average)</div>\r\n		{/if}\r\n		{if $competition.parameters|@count gt 1}\r\n			<select name=\"scoringMethod\" onchange=\"if(this.value)location.replace(\'?pg={$page.name}&cid={$competition.id}&cpid=\'+this.value);\" style=\"width:200px;\">\r\n				<option value=\"\">(Choose Leaderboard)</option>\r\n			{foreach from=$competition.parameters key=\"paramId\" item=\"param\"}\r\n				{if $paramId neq $competition.current_parameter.id}\r\n				<option value=\"{$paramId}\">{$param.name|capitalize} - {$param.basedOn|capitalize}{* - {$param.polarity} *}</option>\r\n				{/if}\r\n			{/foreach}\r\n			</select>\r\n		{/if}\r\n		<form id=\"form_leaderBoard\" name=\"leaderBoardForm\" method=\"POST\" action=\"index.php?pg=flashgraph-frame&compId={$competition.id}\" target=\"graphwindow\">\r\n		<input type=\"hidden\" name=\"gParams\" value=\"\" />\r\n		<input type=\"hidden\" name=\"userIds\" value=\"\" />\r\n		<table cellpadding=\"0\" cellspacing=\"0\">\r\n		{if $competition.style eq \'Group-vs-Group\' or $competition.style eq \'Company-vs-Company\'}\r\n			<tr>\r\n			<td class=\"thinCell\">#</td>\r\n			<td class=\"thinCell\">Team</td>\r\n			<td class=\"thinCell\"><img src=\"{$skinFolder}images/trophy_ico.gif\" width=\"15\" height=\"15\" alt=\"\" /></span>\r\n			<td class=\"thinCell\">#Pl</td>\r\n			{* <td class=\"cellHeadTiny\"><img src=\"{$skinFolder}images/graph_ico.gif\" width=\"15\" height=\"15\" alt=\"Show In Graphs\" /></td> *}\r\n			</tr>\r\n			{foreach name=\"rankLoop\" from=$competition.team_data item=\"teamScore\" key=\"teamName\"}\r\n				{if $teamName ne \"Waiting to Join\"}\r\n					<tr>\r\n						<td class=\"thinCell\"><small>{$smarty.foreach.rankLoop.iteration}</small></td>\r\n						<td class=\"thinCell\"><small class=\"mini\">{$teamName|default:\"&nbsp;\"}</small></td>\r\n						<td class=\"thinCell\"><small>{$teamScore|number_format:2}</small></td>\r\n						<td class=\"thinCell\"><small>{$competition.teams.$teamName|@count|default:\"0\"}</small></td>\r\n						{* <td class=\"thinCell\"><input class=\"graphCheckbox\" name=\"graphCheckbox[]\" type=\"checkbox\" value=\"{foreach from=$teams.users item=teamUser}{$teamUser.id},{if $smarty.foreach.rankLoop.iteration lt 11}{append var=\"GUIDs\" value=\"`$teamUser.id`,\"}{/if}{/foreach}{$GUIDs}\"{if $smarty.foreach.rankLoop.iteration lt 11} checked=\"checked\"{/if} onclick=\"updateGUIDs();\" /></td> *}\r\n					</tr>\r\n				{/if}\r\n			{/foreach}\r\n		{else} \r\n			<tr>\r\n			<td class=\"thinCell\">#</td>\r\n			<td class=\"thinCell\" align=\"center\">Name</td>\r\n			<td class=\"thinCell\"><img src=\"{$skinFolder}images/trophy_ico.gif\" width=\"15\" height=\"15\" alt=\"{$smarty.capture.scoringMethod|strip_tags}\" /></td>\r\n			<td class=\"thinCell\">Update</td>\r\n			<td class=\"thinCell\" align=\"center\"><img src=\"{$skinFolder}images/graph_ico.gif\" width=\"15\" height=\"15\" alt=\"Show in Graphs\" /></td>\r\n			</tr>\r\n			{foreach from=$competition.data item=\"userData\" key=\"userId\" name=\"compData\"}\r\n			{assign var=\"curIteration\" value=$smarty.foreach.compData.iteration}\r\n			{if $curIteration eq 21}\r\n			</table>\r\n			</div>\r\n			<br />\r\n			<h2 class=\"withBG\">\r\n				<div class=\"topRight hideShow\">\r\n					<a href=\"javascript:toggle(\'runnerUps\', \'\', \'showHide\');\"><img id=\"runnerUps_img\" src=\"./img/blank.gif\" class=\"showHide_off\" alt=\"show/hide\" border=\"0\" /></a>\r\n				</div>\r\n				Runner Ups\r\n			</h2>\r\n			<div id=\"runnerUps\" style=\"display:none;\">\r\n			<table cellpadding=\"0\" cellspacing=\"0\">\r\n			{/if}\r\n			<tr>\r\n			<td class=\"thinCell\"><small>{$curIteration}</small></td>\r\n			<td class=\"thinCell\"><small class=\"mini\">{$competition.users[$userId]}</small></td>\r\n			<td class=\"thinCell\"><small>{$userData.val|number_format:$competition.current_parameter.decimalPlaces}</small></td>\r\n			<td class=\"thinCell\"><small>{if $userData.doe}{$userData.doe|date_format2:\"n/j/y\"}{else}-Never-{/if}</small></td>\r\n			<td class=\"thinCell\"><input class=\"graphCheckbox\" name=\"graphCheckbox[]\" type=\"checkbox\" value=\"{$userId}{if $curIteration lt 11}{append var=\"GUIDs\" value=\"`$userId`,\"}{/if}\"{if $curIteration lt 11} checked=\"checked\"{/if} onclick=\"updateGUIDs();\" /></td>\r\n			</tr>\r\n			{/foreach}\r\n		{/if}\r\n		</form>\r\n		<script type=\"text/javascript\">GUIDs = \'{$GUIDs}\';</script>\r\n		</table>\r\n		</div> \r\n		<div align=\"right\"><small><i><a href=\"?pg=faq#comp\">How is the competition scored?</a></i></small></div>\r\n		<img src=\"./img/blank.gif\" width=\"168\" height=\"1\" alt=\"\" />\r\n		{if $isManager and $competition.style neq \'Company-vs-Company\'}\r\n		<h2 class=\"withBG\">\r\n			<div class=\"topRight hideShow\">\r\n				<a href=\"javascript:toggle(\'managePlayers\', \'\', \'showHide\');\"><img id=\"managePlayers_img\" src=\"./img/blank.gif\" class=\"showHide_off\" alt=\"show/hide\" border=\"0\" /></a>\r\n			</div> \r\n			Manage\r\n		</h2>\r\n		<div id=\"managePlayers\" style=\"display:none;\">\r\n					<form name=\"managePlayers[]\" action=\"index.php\" method=\"POST\" style=\"margin:0px;\">\r\n					<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\">\r\n					<input type=\"hidden\" name=\"cid\" value=\"{$competition.id}\">\r\n					<input type=\"hidden\" name=\"no_expire\" value=\"true\">\r\n					<input type=\"hidden\" name=\"no_expire_keep_alive\" value=\"cid\">\r\n					<input type=\"hidden\" name=\"style\" value=\"{$competition.style}\">\r\n					<span class=\"cellHeadTiny\" style=\"clear:left;\">Del</span>\r\n					<span class=\"cellHead\">View Stats</span>\r\n					{* <span class=\"cellHeadSmall\">-</span> *}\r\n					<br />\r\n					{foreach from=$competition.users item=\"username\" key=\"userId\" name=\"dateUpdated\"}\r\n						<span class=\"cellTiny\" style=\"clear:left;\"><small><input type=\"checkbox\" name=\"managePlayers[delete][]\" value=\"{$username}\" style=\"width:14px;height:14px;margin:0px 2px;\"></small></span>\r\n						<span class=\"cell\"><small><a href=\"?pg=my_home&cid={$competition.id}&userId={$userId}&hideComps=1\">{$username}</a></small></span>\r\n						{* <span class=\"cellSmall\"><small><a href=\"mailto:{$compUser.email}\">email</a></small></span> *}\r\n						<br />\r\n					{/foreach}\r\n					<div style=\"text-align:center;\">\r\n                                                <br />\r\n						<input type=\"submit\" class=\"button\" value=\"Remove Selected\">\r\n					</div>\r\n					</form>\r\n		</div><br/>\r\n		{/if}\r\n		{* End new section for Player management. *}\r\n		\r\n		{* Begin new section for Team management.  This can be moved where ever. *}\r\n		{* ******************************** TEAM MANAGEMENT ***************************************** *}\r\n		{if $canCreateTeams and $competition.style eq \'Group-vs-Group\'}\r\n		<h2 class=\"withBG\">\r\n			<div class=\"topRight hideShow\">\r\n				<a href=\"javascript:toggle(\'teamManagement\', \'\', \'showHide\');\"><img id=\"teamManagement_img\" src=\"./img/blank.gif\" class=\"showHide_{if $smarty.request.showTeamManagement}on{else}off{/if}\" alt=\"show/hide\" border=\"0\" /></a>\r\n			</div>\r\n			Teams</h2>\r\n		<div id=\"teamManagement\" style=\"display:{if $smarty.request.showTeamManagement}block{else}none{/if};\">\r\n			<form name=\"manageTeam[]\" action=\"index.php\" method=\"POST\" style=\"margin:0px;\">\r\n			<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\">\r\n			<input type=\"hidden\" name=\"cid\" value=\"{$competition.id}\">\r\n			<input type=\"hidden\" name=\"no_expire\" value=\"true\">\r\n			<input type=\"hidden\" name=\"no_expire_keep_alive\" value=\"cid\">\r\n			<div id=\"playersList{counter}\">\r\n				{if $isManager}<span class=\"cellHeadTiny\">Del</span>{/if}\r\n				<span class=\"cellHeadLarge\" style=\"width:134px;\">Team Name</span><br />\r\n				{foreach from=$competition.teams item=\"team\" key=\"teamName\"}\r\n					{counter name=\"counterI\" start=\"0\" print=0}\r\n					{if $teamName ne \"Waiting to Join\"}\r\n						{if $isManager}<span class=\"cellTiny\" style=\"clear:left;\"><small><input type=\"checkbox\" name=\"manageTeam[delete][]\" value=\"{$teamName|htmlspecialchars}\"></small></span>{/if}\r\n						<span class=\"cellLarge\" style=\"width:134px;\"><small>\r\n							{if $isManager or $team|@in_array:$user->id}<input id=\"renameTeam\" type=\"text\" value=\"{$teamName|htmlspecialchars}\" name=\"manageTeam[rename][{$teamName|htmlspecialchars}]\" size=\"10\" style=\"width:124px;height:12px\">\r\n							{else}<span>{$teamName}</span>\r\n							{/if}\r\n						</small></span><br />\r\n					{/if}\r\n				{/foreach}\r\n			</div>\r\n                        <br />\r\n			<div style=\"text-align:center;\">New Team: <input id=\"addTeam\" type=\"text\" name=\"manageTeam[addTeam]\" size=\"10\"><br />\r\n			<br />\r\n                        <input type=\"submit\" class=\"button\" value=\"Submit Changes\"></div>\r\n			</form>\r\n		</div><br />\r\n		{/if}\r\n		{* End new section for Team management. *}\r\n\r\n		\r\n		{* if !$isManager AND $competition.users|@count lt 45}{include file=\"layouts/ads.tpl\"}{assign var=\"adsShown\" value=\"1\"}{/if *}\r\n\r\n		{*\r\n			<h2 class=\"withBG\">Competition Stats</h2>\r\n			<span class=\"cellHeadLarge\">Category</span><span class=\"cellHeadSmall\">Result</span><br />\r\n			<span class=\"cellLarge\"><small>start weight</small></span>\r\n			<span class=\"cellSmall\"><small>{$competition.groupStartWeight|default:0} lbs</small></span><br />\r\n			<span class=\"cellLarge\"><small>weight lost</small></span>\r\n			<span class=\"cellSmall\"><small>{$competition.groupWeightLost|default:0} lbs</small></span><br />\r\n			{if $competition.groupPercentageWeightLost gt 0}<span class=\"cellLarge\"><small>% lost</small></span>\r\n			<span class=\"cellSmall\"><small>{$competition.groupPercentageWeightLost|default:0|number_format:\"2\"}</small></span><br />{/if}\r\n			<span class=\"cellLarge\"><small>fat intake</small></span>\r\n			<span class=\"cellSmall\"><small>{$competition.groupFat|default:0}</small></span><br />\r\n			<span class=\"cellLarge\"><small>calorie intake</small></span>\r\n			<span class=\"cellSmall\"><small>{$competition.groupCalories|default:0}</small></span><br />\r\n			<span class=\"cellLarge\"><small>minutes exercised</small></span>\r\n			<span class=\"cellSmall\"><small>{$competition.groupExercise|default:0}</small></span><br />\r\n			<span class=\"cellLarge\"><small>distance exercised</small></span>\r\n			<span class=\"cellSmall\"><small>{$competition.groupDistanceExercised|default:0}</small></span><br />\r\n			<img src=\"./img/blank.gif\" width=\"165\" height=\"1\" alt=\"\" />\r\n		*}\r\n		</td>\r\n		<td width=\"100%\" valign=\"top\">\r\n			<div id=\"contentBox\" class=\"centerBox\" style=\"margin-left:10px;\"><div class=\"topRightTreasure\">\r\n<div id=\"jackpot\">{if $competition.potAmount gt 0}${$competition.potAmount|number_format:2}{/if}</div>\r\n<h1 class=\"underline\">{$competition.title|default:\"Competition Title\"}</h1>\r\n\r\n{* ******************************** COMPETITION END *********************************** *}\r\n{if $competition.endDate lt $smarty.now}   {* COMPETITION IS OVER *}\r\n	{if $competition.results.winners|@count eq 1}\r\n		{* There was one winner, either by scoringMethod or tieBreakerMethod *}\r\n\r\n		{math assign=\"daysOfCompetition\" equation=\"(x - y) / z\" x=$competition.endDate|default:\"0\" y=$competition.startDate|default:\"0\" z=\"86400\"}\r\n		{math assign=\"marginOfVictory\" equation=\"x - y\" x=$competition.results.winningStat|default:\"0\" y=$competition.results.secondPlaceStat|default:\"0\"}\r\n\r\n		{foreach from=$competition.results.winners item=\"winnerName\"}    {*key=\"winnerName\"*}\r\n			{assign var=\"winnerData\" value=$competitions.users.$winnerName}\r\n			\r\n			{if $competition.style eq \"Group-vs-Group\"}\r\n				{assign var=\"description\" value=\"Winning Team\"}\r\n				{assign var=\"avg\" value=\"average\"}\r\n			{else}\r\n				{assign var=\"description\" value=\"Winner\"}\r\n			{/if}\r\n\r\n			<h2><br /><b>{$winnerName}</b> is the {$description}{if $competition.potAmount}, taking home <b>$<i>{$competition.potAmount|number_format:2}</i></b>{/if}!</h2>\r\n			<br />\r\n			{strip}\r\n			{if not $competition.results.isTie}   {* Not a Tie *}\r\n				After a difficult <b>{$daysOfCompetition|number_format:0}</b> days of \r\n				fierce competition, <b>{$winnerName}</b> is the \r\n				{$description}!	Based on \r\n				<b>{$competition.results.winningMethod}</b>, <b>{$winnerName}</b> \r\n				won with <b>{$competition.results.winningStat|number_format:2} \r\n				{if $competition.results.winningMethod eq \"Weight Lost\"}{$avg} pounds lost\r\n				{elseif $competition.results.winningMethod eq \"Percentage Weight Lost\"}{$avg} % body weight lost\r\n				{elseif $competition.results.winningMethod eq \"Minutes Exercise\"}{$avg} minutes exercised\r\n				{elseif $competition.results.winningMethod eq \"Distance Exercised\"}{$avg} miles exercised\r\n				{elseif $competition.results.winningMethod eq \"Weight Gained\"}{$avg} pounds gained\r\n				{/if}</b>.\r\n			{else}                                {* A Tie! *}\r\n				{assign var=\"weightLost\" value=\"Weight Lost\"}\r\n				{assign var=\"percentLost\" value=\"Percentage Weight Lost\"}\r\n\r\n				After a difficult <b>{$daysOfCompetition|number_format:0}</b> \r\n				days of fierce competition, there was a tie in the judging \r\n				method, <b>{$competition.scoringMethod}</b>. To break this \r\n				tie, the selected tie breaking method, \r\n				<b>{$competition.tieBreakerMethod}</b>, was used to determine \r\n				<b>{$winnerName}</b> as the {$description}. <b>{$winnerName}</b> \r\n				won with <b>{$competition.results.winningStat|number_format:2}\r\n				{if $competition.results.winningMethod eq \"Weight Lost\"}{$avg} pounds lost\r\n				{elseif $competition.results.winningMethod eq \"Percentage Weight Lost\"}{$avg} % body weight lost\r\n				{elseif $competition.results.winningMethod eq \"Minutes Exercise\"}{$avg} minutes exercised\r\n				{elseif $competition.results.winningMethod eq \"Distance Exercised\"}{$avg} miles exercised\r\n				{elseif $competition.results.winningMethod eq \"Weight Gained\"}{$avg} pounds gained\r\n				{/if}</b>.\r\n				<!--\r\n				<b>{$winnerData.$weightLost|number_format:0} pounds</b>, which \r\n				was <b>{$winnerData.$percentLost|number_format:4}%</b> body weight.\r\n				-->\r\n			{/if}\r\n			{/strip}\r\n			<br />\r\n			<br />\r\n			<b>{$winnerName}</b> won with a <b>{$marginOfVictory|number_format:3}</b> margin over <b>{$competition.results.secondPlaceUser}</b>.\r\n			\r\n			<h2><br />Congratulations to you all!</h2>\r\n			<br />\r\n			<div class=\"underline\"></div>\r\n		{/foreach}\r\n\r\n	{elseif $competition.results.winners|@count gt 1}\r\n		{* There were multiple winners, even after tieBreakerMethod (should RARELY happen) *}\r\n	\r\n		<h2>There was a tie in this competition. The winners, by <b>{$competition.results.winningMethod}</b> having lost <b>{$competition.results.winningStat}</b>, are:<br /></h2>\r\n		<ul>\r\n		{foreach from=$competition.results.winners item=\"winnerData\" key=\"winnerName\"}\r\n			<li>{$winnerName}</li>\r\n		{/foreach}\r\n		</ul>\r\n		\r\n	{else}\r\n		{* For some reason, there were no winners *}\r\n\r\n		<h2><br />\r\n		Winner information is being calculated. <br />\r\n		Please check back soon.\r\n		<br /><br /></h2>\r\n	{/if}\r\n	This competition has ended and is no longer active.<br />\r\n{/if}\r\n{* ************************************************************************************ *}\r\n\r\n<div id=\"prizeDesc\">{$competition.potDescription}<br />\r\n{if $competition.potAmount}<small style=\"color:#FFF;\">(${$competition.individualPotAmount} from {$competition.potMethod})</small>{/if}</div>\r\n\r\n{if $competition.startDate lt $smarty.now}\r\n	Time remaining: <b>{$competition.timeLeft}</b><br />\r\n{else}\r\n	This competition has not yet started!<br />\r\n{/if}\r\n\r\nStart{if $competition.startDate lt $smarty.now}ed{else}s{/if}: <b>{$competition.startDate|date_format2:\"n/j/Y\"}</b> &nbsp; \r\nEnd{if $competition.endDate lt $smarty.now}ed{else}s{/if}: <b>{$competition.endDate|date_format2:\"n/j/Y\"}</b><br />\r\n{if $competition.calculationMode neq \"Real-Time\"}Competition stats/scoring updated as of {$competition.dateOfObject|date_format2:\"n/j/Y g:i A\"}{if $isManager} (<a href=\"?pg=competition&cid={$smarty.request.cid}&nocache=1\">Update Now!</a>){/if}<br />{/if}\r\n<div style=\"font-size:5px;clear:left;\">&nbsp;</div>\r\n{assign var=\"scoringMethod\" value=$competition.scoringMethod}\r\n{assign var=\"tieBreakerMethod\" value=$competition.tieBreakerMethod}\r\n{assign var=\"weeklyWinnersMethod1\" value=$competition.weeklyWinnersMethod1}\r\n{assign var=\"weeklyWinnersMethod2\" value=$competition.weeklyWinnersMethod2}\r\n\r\n{* ******************** WEEKLY WINNERS ********************* *}\r\n{if $competition.weeklyWinners}\r\n	{if $weeklyWinnersMethod1}             {* DON\'T FORGET TO REMOVE THE ACM CHECK WHEN READY!!! *}\r\n		<h2 class=\"withBG\">\r\n			<div class=\"topRight hideShow\">\r\n			<a href=\"javascript:toggle(\'weeklyWinners\', \'\', \'showHide\');\"><img id=\"weeklyWinners_img\" src=\"./img/blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a></div>\r\n			Last Week\'s Winners<i>!</i> <small style=\"color:#000; font-size:11px;\">(<i><b>{$competition.weeklyWinners.startDate|date_format2:\"D n/j\"}</b> through <b>{$competition.weeklyWinners.endDate|date_format2:\"D n/j\"}</b></i>)</small></h2> \r\n		<div id=\"weeklyWinners\">\r\n		<table width=\"100%\" cellpadding=\"3\" cellspacing=\"0\"><tr>\r\n		<td valign=\"top\" width=\"50%\">\r\n		<div class=\"cellHeadLarge\" style=\"width:auto;float:none;\">{$weeklyWinnersMethod1}</div>\r\n		<img src=\"{$skinFolder}images/winner_1.gif\" style=\"float:left;\" />\r\n		{strip}\r\n		{foreach name=\"method1\" from=$competition.weeklyWinners.$weeklyWinnersMethod1 item=\"username\"}\r\n			{assign var=\"userValue\" value=$competition.weeklyWinners.users.$username.$weeklyWinnersMethod1}\r\n			{if $smarty.foreach.method1.iteration gt 3 OR $userValue lte 0}{if $smarty.foreach.method1.iteration eq 1}Don\'t forget to update your progress so there will be winners next week{/if}<i>!</i>{php}break;{/php}\r\n			{elseif $smarty.foreach.method1.iteration eq 1}\r\n				<b>{$username|default:\"[ ?? ]\"|ucfirst}</b> led the way last week by \r\n				{if $weeklyWinnersMethod1 eq \'Weight Lost\'}losing <b>{$userValue}</b> pounds{elseif $weeklyWinnersMethod1 eq \'Percentage Weight Lost\'}losing <b>{$userValue|number_format:\"2\"}%</b> body weight{elseif $weeklyWinnersMethod1 eq \'Minutes Exercise\'}exercising <b>{$userValue}</b> minutes{elseif $weeklyWinnersMethod1 eq \'Distance Exercised\'}exercising a distance of <b>{$userValue}</b> {elseif $weeklyWinnersMethod1 eq \'Weight Gained\'}gaining <b>{$userValue}</b> pounds{else}<b>default</b>{/if}\r\n			{else}\r\n				{if $smarty.foreach.method1.iteration eq 2}, followed by <b>{$username|default:\"[ ?? ]\"|ucfirst}</b> with \r\n				{else} and <b>{$username|default:\"[ ?? ]\"|ucfirst}</b> with \r\n				{/if}\r\n				{if $weeklyWinnersMethod1 eq \'Weight Lost\'}<b>{$userValue}</b> pounds{elseif $weeklyWinnersMethod1 eq \'Percentage Weight Lost\'}<b>{$userValue|number_format:\"2\"}%</b>{elseif $weeklyWinnersMethod1 eq \'Minutes Exercise\'}<b>{$userValue}</b> minutes{elseif $weeklyWinnersMethod1 eq \'Distance Exercised\'}a distance of <b>{$userValue}</b>{elseif $weeklyWinnersMethod1 eq \'Weight Gained\'}<b>{$userValue}</b> pounds{/if}\r\n			{/if}\r\n		{/foreach}\r\n		{/strip}\r\n		</td>\r\n	{/if}\r\n	{if $weeklyWinnersMethod2} \r\n		<td valign=\"top\" width=\"50%\">\r\n		<div class=\"cellHeadLarge\" style=\"width:auto;float:none;\">{$weeklyWinnersMethod2}</div>\r\n		<img src=\"{$skinFolder}images/winner_2.gif\" style=\"float:left;\" />\r\n		{* display var=$competition.weeklyWinners.users *}\r\n		{strip}\r\n		{foreach name=\"method2\" from=$competition.weeklyWinners.$weeklyWinnersMethod2 item=\"username\"}\r\n			{assign var=\"userValue\" value=$competition.weeklyWinners.users.$username.$weeklyWinnersMethod2}\r\n			\r\n			{if $smarty.foreach.method2.iteration gt 3 OR $userValue lte 0}{if $smarty.foreach.method2.iteration eq 1}Don\'t forget to update your progress so there will be winners next week{/if}<i>!</i>{php}break;{/php}\r\n			{elseif $smarty.foreach.method2.iteration eq 1}\r\n				<b>{$username|default:\"[ ?? ]\"|ucfirst}</b> won by \r\n				{if $weeklyWinnersMethod2 eq \'Weight Lost\'}losing <b>{$userValue}</b> pounds{elseif $weeklyWinnersMethod2 eq \'Percentage Weight Lost\'}losing <b>{$userValue|number_format:\"2\"}%</b> body weight{elseif $weeklyWinnersMethod2 eq \'Minutes Exercise\'}exercising <b>{$userValue}</b> minutes{elseif $weeklyWinnersMethod2 eq \'Distance Exercised\'}exercising a distance of <b>{$userValue}</b>{elseif $weeklyWinnersMethod2 eq \'Weight Gained\'}gaining <b>{$userValue}</b> pounds{/if}\r\n			{else}\r\n				{if $smarty.foreach.method2.iteration eq 2}, followed by <b>{$username|default:\"[ ?? ]\"|ucfirst}</b> with \r\n				{else} and <b>{$username|default:\"[ ?? ]\"|ucfirst}</b> with \r\n				{/if}\r\n				{if $weeklyWinnersMethod2 eq \'Weight Lost\'}<b>{$userValue}</b> pounds{elseif $weeklyWinnersMethod2 eq \'Percentage Weight Lost\'}<b>{$userValue|number_format:\"2\"}%</b>{elseif $weeklyWinnersMethod2 eq \'Minutes Exercise\'}<b>{$userValue}</b> minutes{elseif $weeklyWinnersMethod2 eq \'Distance Exercised\'}a distance of <b>{$userValue}</b>{elseif $weeklyWinnersMethod2 eq \'Weight Gained\'}<b>{$userValue}</b> pounds{/if}\r\n			{/if}\r\n		{/foreach}\r\n		{/strip}\r\n		</td>\r\n	{/if}\r\n	{if $weeklyWinnersMethod1}\r\n	</tr></table></div>{/if}\r\n{/if}\r\n{* ********************************************************* *}\r\n\r\n{if $acm->isDomainAdmin() and $smarty.request.debug}\r\n	{display var=$competition}\r\n{/if} \r\n\r\n{* ******************************** COMPARISON GRAPHS ***************************************** *}\r\n{if $competition.graphParameters|@count}\r\n<script type=\"text/javascript\">{literal}\r\n	function rewriteGraphLinks() {\r\n		var gLinksDiv = document.getElementById(\'graphLinksDiv\');\r\n		gLinksDiv.innerHTML = \'\';\r\n		{/literal}{foreach name=\"graphTypes\" from=$competition.graphParameters item=\"cgp\"}\r\n		gLinksDiv.innerHTML += \'<a href=\"?pg=flashgraph-frame&compId={$competition.id}&type={$cgp.name|niceText|replace:\" \":\"+\"}&esId={$cgp.estatId}&basedOn={$cgp.basedOn|replace:\" \":\"+\"}&fillPrevious={if $cgp.assumeConstantValues eq \"yes\"}1{else}0{/if}&precision={$cgp.decimalPlaces}&format=wide&userIds=\'+GUIDs+\'\" target=\"graphwindow\"><small>{$cgp.name|niceText|replace:\" \":\"&nbsp;\"}&nbsp;-&nbsp;{$cgp.basedOn|niceText|replace:\" \":\"&nbsp;\"}</small></a>{if !$smarty.foreach.graphTypes.last} | {/if}\';\r\n		{/foreach}\r\n	{literal}\r\n	}\r\n{/literal}</script>\r\n<h2 class=\"withBG\"><a name=\"graph\"></a>\r\n	<div class=\"topRight hideShow\">\r\n		<a href=\"javascript:toggle(\'graphs\', \'\', \'showHide\');\"><img id=\"graphs_img\" src=\"./img/blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a></div> \r\n	Comparison Graphs &nbsp; <small><i>No graph? <a href=\"http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash\" target=\"_blank\">click here</a> to download the free Flash Player plug-in.</i></small></h2>\r\n<div id=\"graphs\" style=\"display:block;\">\r\n	<table border=\"0\" cellpadding=\"0\" width=\"100%\">\r\n		{assign var=\"graphURL\" value=\"?pg=flashgraph-frame&format=wide\"}\r\n	<tr>\r\n		<td><div style=\"border:#999 1px solid;background-color:#FFF;padding:5px;\"><iframe \"iframe_graphwindow\" name=\"graphwindow\" src=\"{$graphURL}\" frameborder=\"0\" width=\"625\" height=\"230\" scrollbars=\"no\"></iframe></div></td>\r\n	</tr>\r\n	<tr>\r\n		<td valign=\"top\" align=\"center\" width=\"100%\">\r\n		<div id=\"graphLinksDiv\">\r\n		<small>\r\n		{foreach name=\"graphTypes\" from=$competition.availableGraphs key=\"graphType\" item=\"graphParams\"}\r\n		<a href=\"?pg=flashgraph-frame&compId={$competition.id}&{$graphParams}\');\" target=\"graphwindow\">{$graphType}</a>{if $smarty.foreach.graphTypes.iteration neq $competition.availableGraphs|@count} | {/if}\r\n		{/foreach}\r\n		</small></div></td>\r\n	</tr>\r\n	</table>\r\n	<script type=\"text/javascript\">\r\n		rewriteGraphLinks();\r\n	</script>\r\n<br />\r\n</div>\r\n{/if}\r\n\r\n{* ******************************** GROUP TEAMS/PLAYERS SUMMARY W/MOVING ***************************************** *}\r\n{if $competition.style eq \'Group-vs-Group\' or $competition.style eq \'Company-vs-Company\'}\r\n<h2 class=\"withBG\">\r\n	<div class=\"topRight hideShow\">\r\n		<a href=\"javascript:toggle(\'teams\', \'\', \'showHide\');\"><img id=\"teams_img\" src=\"./img/blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a></div> \r\n	The Teams &nbsp; <small><i>Assignments and statistics</i></small></h2>\r\n<div id=\"teams\" style=\"display:block;\">\r\n<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" border=\"0\"><tr><td>\r\n	<div align=\"right\" style=\"border-bottom:1px solid black; margin:2px; padding:2px;\">All stats based on: {$smarty.capture.scoringMethod}</div>\r\n	{if $canAssignToTeams}\r\n		<form name=\"changeTeam\" action=\"index.php\" method=\"POST\" style=\"margin:0px;\">\r\n			<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\">\r\n			<input type=\"hidden\" name=\"cid\" value=\"{$competition.id}\">\r\n			<input type=\"hidden\" name=\"no_expire\" value=\"true\">\r\n			<input type=\"hidden\" name=\"no_expire_keep_alive\" value=\"cid\">\r\n	{/if}\r\n		{assign var=\"minEx\" value=\"Minutes Exercise\"}\r\n		{assign var=\"distEx\" value=\"Distance Exercised\"}\r\n		{assign var=\"pctLst\" value=\"Percentage Weight Lost\"}\r\n		{assign var=\"wtLst\" value=\"Percentage Weight Lost\"}\r\n		{foreach from=$competition.team_data name=\"teamsLoop\" item=\"teamScore\" key=\"teamName\"}\r\n			<div id=\"playersList{$smarty.foreach.teamsLoop.iteration}\" style=\"float:left;width:310px;overflow:hidden;word-wrap:nowrap; margin:0px 5px 5px 0px;\">\r\n			{if $teamName eq \"Waiting to Join\"}<h2>Not assigned to a team</h2>{else}<h4><span style=\"font-weight:normal;\">#{$smarty.foreach.teamsLoop.iteration}) </span>{$teamName|default:\"&nbsp;\"}{/if}</h4>\r\n			<table cellpadding=\"0\" cellspacing=\"0\" style=\"width:250px; background-color:#FFC;\">\r\n			<tr>\r\n				<td class=\"thinCell\" width=\"55%\">Name</td>\r\n				<td class=\"thinCell\" width=\"25%\"><img src=\"{$skinFolder}images/trophy_ico.gif\" width=\"15\" height=\"15\" alt=\"\" /></td>\r\n				<td class=\"thinCell\" width=\"20%\">Update</span>\r\n			</tr>\r\n			{foreach from=$competition.teams.$teamName item=\"userId\"}\r\n			<tr>\r\n				<td class=\"thinCell\" style=\"text-align:left;\"><small>{if $isManager or $userId eq $user->id}<input type=\"checkbox\" name=\"changeTeam[players][{$competition.users.$userId}]\" />{/if}{$competition.users.$userId}</small>{if $competition.team_captains.$teamName eq $userId OR $userId|@in_array:$competition.teams.$teamName} <img src=\"/systems/v2_ehc/images/ehc/ico/ico_captain.gif\" />{/if}</td>\r\n				{* <span class=\"cellTiny\"><small>{if $users.hideInitialWeight neq \"Yes\"}{$users.$pctLst|number_format:\"2\"|replace:\".00\":\"\"}{else}-{/if}</small></span> *}\r\n				<td class=\"thinCell\"><small>{$competition.data.$userId.val|number_format:$competition.current_parameter.decimalPlaces}</small></td>\r\n				<td class=\"thinCell\"><small>{if $competition.data.$userId.doe}{$competition.data.$userId.doe|date_format2:\"n/j/y\"}{else}Never{/if}</small></td>\r\n			</tr>\r\n			{foreachelse}\r\n			{* No players assigned to this team. *}\r\n			<tr>\r\n				<td class=\"thinCell\">No players yet.</td>\r\n			</tr>\r\n			{/foreach}\r\n\r\n			</table>\r\n			{if $smarty.server.REMOTE_ADDR eq \'206.71.78.158\' and $competition.team_captains.$teamName eq $user->id}\r\n				E-Mail your team:<br />\r\n				<textarea name=\"email_team[{$teamName}][body]\"></textarea><br />\r\n				<input type=\"submit\" name=\"email_team_submit\" value=\"Send Message\" />\r\n			{/if}\r\n			</div>\r\n		{/foreach}\r\n	{if $canAssignToTeams and $competition.style neq \'Company-vs-Company\'}\r\n		<br />\r\n		<select name=\"changeTeam[team]\">\r\n			<option value=\"\">Move selected players to...</option>\r\n			{foreach from=$competition.teams item=\"newTeams\" key=\"newTeamName\"}\r\n				{*if $newTeamName ne $teamName and $newTeamName ne \"Waiting to Join\"*}\r\n				{if $newTeamName ne \"Waiting to Join\"}\r\n					<option value=\"{$newTeamName}\">{$newTeamName}</option>\r\n				{/if}\r\n			{/foreach}\r\n		</select><br />\r\n		<input id=\"assign_captains_checkbox\" type=\"checkbox\" name=\"assignCaptains\" value=\"1\"><label for=\"assign_captains_checkbox\"> Assign selected player(s) as captain(s)</label><br />\r\n		<input type=\"submit\" class=\"button\" value=\"Submit Changes\">\r\n		</form>\r\n		<img src=\"/systems/v2_ehc/images/ehc/ico/ico_captain.gif\" /> = Team Captain\r\n	{/if}\r\n</td></tr></table>\r\n</div>\r\n{/if}\r\n</div>\r\n	{* ******************************** DISCUSSION BOARD ***************************************** *}\r\n<br />\r\n<h2 class=\"withBG\">\r\n	<div class=\"topRight hideShow\">\r\n		<a href=\"javascript:toggle(\'discuss\', \'\', \'showHide\');\"><img id=\"discuss_img\" src=\"./img/blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a></div> \r\n	Discussion Board</h2>\r\n<div id=\"discuss\" style=\"display:block;\">\r\n	<table cellpadding=\"0\" width=\"100%\" border=\"0\"><tr><td><iframe src=\"?pg=competition/forum\" id=\"discussionBoard\" frameborder=\"0\" scrolling=\"yes\" style=\"width:100%;\"></iframe></td></tr></table>\r\n</div>\r\n\r\n</div></td>\r\n</tr></table>\r\n\r\n{*\r\n<script type=\"text/javascript\">{literal}\r\n	if ( window.frames != null ) {\r\n	    for ( i = 0; i< window.frames.length; i++ )\r\n	        window.alert (\"Child window \" +i+ \" is named \"+window.frames(i).name);\r\n	}\r\n{/literal}</script>\r\n*}'),(4581,197,0.50,'smarty','0','Added support for company competitions.',1130830801,2,'24.2.76.126','{if $smarty.session.company.preferences.hide_competitions eq \"yes\"}{include file=\"file:layouts/hiddenPageRedirector.tpl\"}{/if}\r\n{include file=\"layouts/forceLoggedIn.tpl\"}\r\n{assign var=\"pgLayout\" value=\"layouts/withLeftNav.tpl\"}\r\n{include_php file=\"shared_handle:acceptRejectRequests\"} \r\n{include_php file=\"shared_handle:myHome\"}\r\n<h1>{$page.title}</h1>\r\n\r\n<table width=\"100%\"><tr><td valign=\"top\">\r\n	<img class=\"iconRacers\" src=\"blank.gif\" width=\"1\" height=\"1\" alt=\"\" />\r\n</td><td valign=\"top\" width=\"100%\">\r\n	<h2 class=\"withBG\">\r\n		<div class=\"topRight hideShow\">\r\n		<a href=\"javascript:toggle(\'inComps\', \'\', \'showHide\');\"><img id=\"inComps_img\" src=\"./img/blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a></div> \r\n		Competitions I Am In</h2>\r\n	\r\n<div id=\"inComps\" style=\"display:block;\">	\r\n	<div style=\"margin:10px;padding:5px;background-color:#FFF;border:#999 1px solid;\">\r\n	<table cellspacing=\"0\" cellpadding=\"1\" align=\"center\">\r\n	<tr>\r\n		<td class=\"underline2\"><span>&nbsp;<b>ID</b></span></td>\r\n		<td class=\"underline2\" width=\"100%\"><span>&nbsp;<b>Title</b></span></td>\r\n		{*\r\n		<td class=\"underline2\"><span>&nbsp;<b>Type</b></span></td>\r\n		*}\r\n		<td class=\"underline2\"><span>&nbsp;<b>Style</b></span></td>\r\n		{* <td class=\"underline2\"><span>&nbsp;<b>Rank</b></span></td> *}\r\n		{* <td class=\"underline2\" nowrap><span>&nbsp;<b>Time Remaining</b></span></td> *}\r\n		<td class=\"underline2\" nowrap><span>&nbsp;<b>Ends</b></span></td>\r\n		{* <td class=\"underline2\" nowrap><span>&nbsp;<b>Prize</b></span></td> *}\r\n	</tr>\r\n	{* Set up the warning period... 7 days from now (604800 = 7 days in seconds) *}\r\n	{math assign=\"endsSoon\" equation=\"x + y\" x=$smarty.now y=\"604800\"}\r\n	{foreach from=$competitions item=\"comp\"}\r\n	<tr>\r\n		<td nowrap=\"nowrap\"><span><small>&nbsp;<a href=\"?pg=my_competition&cid={$comp.id}\">{$comp.id}</a> &nbsp;</small></span></td>\r\n		<td nowrap=\"nowrap\"><span>&nbsp;<a href=\"?pg=my_competition&cid={$comp.id}\"><b>{$comp.title|truncate:35:\"...\"}</b></a> &nbsp;</span></td>\r\n		{*\r\n		<td nowrap=\"nowrap\"><span><small>&nbsp;{$comp.type|niceText}</small> &nbsp;</span></td>\r\n		*}\r\n		{*<td nowrap=\"nowrap\"><span><small>&nbsp;{if $comp.style eq \"Group-vs-Group\"}Team{elseif $comp.style eq \"Company-vs-Company\"}Company{else}Individual{/if}</small> &nbsp;</span></td>*}\r\n		<td nowrap=\"nowrap\"><span><small>&nbsp;{$comp.style}</small> &nbsp;</span></td>\r\n		{* <td nowrap=\"nowrap\"><span><small>&nbsp;{if $comp.rank ne \"N/A\"}{$comp.rank}/{$comp.rankOutOf}{else}N/A{/if}</small> &nbsp;</span></td> *}\r\n		{* <td nowrap><span><small{if $comp.endDate lt $smarty.now} style=\"font-weight:bold;\"{elseif $comp.endDate lt $endsSoon} style=\"color:#C00;font-weight:bold;\"{/if}>&nbsp;{$comp.timeLeft}</small> &nbsp;</span></td> *}\r\n		<td nowrap=\"nowrap\"><span><small{if $comp.endDate lt $smarty.now} style=\"font-weight:bold;\"{elseif $comp.endDate lt $endsSoon} style=\"color:#C00;font-weight:bold;\"{/if}>&nbsp;{$comp.endDate|date_format2:\"D n/j/y\"}</small> &nbsp;</span></td>\r\n		{* <td nowrap=\"nowrap\" align=\"right\"><span><small>&nbsp;{if not $comp.potAmount and $comp.potDescription}(Special){else}{math assign=\"fontSizeFactor\" equation=\"x / y\" x=$comp.potAmount y=\"100\"}{math assign=\"fontSize\" equation=\"x + y\" x=\"11\" y=$fontSizeFactor|number_format:\"0\"}<span style=\"font-size:{$fontSize}px;\">${$comp.potAmount|number_format:\"0\"}</span>{/if}</small> &nbsp;</span></td> *}\r\n	</tr>\r\n	{foreachelse}\r\n	<tr>\r\n		<td colspan=\"6\"><span><small>You have not joined any competitions.</small></span></td>\r\n	</tr>\r\n	{/foreach}\r\n	</table>\r\n	</div>\r\n	<span style=\"margin-left:65px;\"><small>(NOTE: <b>Bold Date</b> = Ended, <span style=\"color:#C00;\"><b>Red Date</b></span> = Ends Soon)</small></span>\r\n</div>\r\n{if $user->inGroupName(\'coordinators\')}\r\n<br />\r\n<form name=\"requestsForm\" action=\"index.php\" method=\"post\" style=\"margin:0px;\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\">\r\n<input type=\"hidden\" name=\"no_expire\" value=\"true\">\r\n<input type=\"hidden\" name=\"acceptReject\" value=\"\">\r\n\r\n<h2 class=\"withBG\">\r\n	<div class=\"topRight hideShow\">\r\n		<a href=\"javascript:toggle(\'myComps\', \'\', \'showHide\');\"><img id=\"myComps_img\" src=\"./img/blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a></div> \r\n	Competitions I Have Started</h2>\r\n\r\n<div id=\"myComps\" style=\"display:block;\">\r\n{if $myCompetitions|@count gt 0}\r\n	<div style=\"margin:0px;padding:5px;background-color:#FFF;border:#999 1px solid;\">\r\n	<table cellspacing=\"0\" cellpadding=\"1\" align=\"center\">\r\n	<tr>\r\n		<td class=\"underline2\" nowrap><span>&nbsp;<b>ID</b> &nbsp;</span></td>\r\n		<td class=\"underline2\" nowrap width=\"100%\"><span>&nbsp;<b>Title</b> &nbsp;</span></td>\r\n		<td class=\"underline2\" nowrap><span>&nbsp;<b>Type</b> &nbsp;</span></td>\r\n		<td class=\"underline2\" nowrap><span>&nbsp;<b>People wanting to join</b> &nbsp;</span></td>\r\n	</tr>\r\n	{foreach from=$myCompetitions item=\"comp\"}\r\n	<tr>\r\n		<td valign=\"top\"><span>&nbsp;<small><a href=\"?pg=my_competition&cid={$comp.id}\">{$comp.id}</a></small></span></td>\r\n		<td valign=\"top\" nowrap=\"nowrap\" style=\"overflow:hidden;\"><span>&nbsp;<a href=\"?pg=my_competition&cid={$comp.id}\"><b>{$comp.title}</b></a></span></td>\r\n		<td valign=\"top\" nowrap=\"nowrap\">&nbsp;<span><small>{$comp.type}</small></td>\r\n		<td valign=\"top\" style=\"border-left:1px solid #000;\"><span>{if $comp.requests|@count}{assign var=\"isRequests\" value=\"true\"}{/if}{foreach from=$comp.requests item=\"request\"}<div class=\"hangingIndent\"><input type=\"checkbox\" name=\"request[{$comp.id}][]\" value=\"{$request.id}\"><small>({$request.dateAdded|date_format2:\"n/j/y\"}) {$request.name} &lt;{mailto address=$request.email encode=\"javascript\"}&gt;: &quot;<i>{$request.comment|strip_tags}</i>&quot;</small></div>{foreachelse}&nbsp;None right now.{/foreach}</span></td>\r\n	</tr>\r\n	{/foreach}\r\n	{if $isRequests}\r\n	<tr>\r\n		<td colspan=\"4\" align=\"center\">\r\n			<span><br /><a href=\"javascript://\" onclick=\"acceptReject.value=\'accept\';requestsForm.submit();return false;\" class=\"button\">Accept Selected</a>\r\n			<a href=\"javascript://\" onclick=\"acceptReject.value=\'reject\';requestsForm.submit();return false;\" class=\"button\">Reject Selected</a><small><br /><br /></small></span></td>\r\n	</tr>\r\n	{/if}\r\n	</table>\r\n	</div>\r\n{/if}\r\n</div>\r\n</form>\r\n{/if}\r\n</td></tr>\r\n</table>\r\n\r\n<blockquote>\r\n<table width=\"100%\">\r\n<tr><td valign=\"top\" width=\"50%\">\r\n	<a href=\"?pg=my_competitions/available\">\r\n	<img src=\"blank.gif\" width=\"1\" height=\"1\" hspace=\"5\" alt=\"\" border=\"0\" class=\"icoMedal\" style=\"float:left;\" /></a>\r\n	<b>Other Available Competitions:</b><br />\r\n	Click below to join in on any of the competitions specific to {$smarty.session.company.companyName|default:\"your company\"}.\r\n	<ul>\r\n		<li><a href=\"?pg=my_competitions/available\">Show Available Company Competitions</a></li>\r\n	</ul></td>\r\n    <td valign=\"top\" width=\"50%\"></td>\r\n</tr>\r\n</table>\r\n</blockquote>\r\n\r\n</div>'),(4460,258,0.24,'php','1','Disabling steps that shouldn\'t be run twice.',1128057485,2,'24.2.76.126','<h1><a href=\"?pg=<?php echo $SPADE[\'page\'][\'name\']; ?>\">Version 2 (V2) Conversion: Overall Step 4</a></h1>\r\n<br />\r\n\r\n<?php\r\n\r\nif (FALSE == isset($_REQUEST[\'confirm\'])) {\r\n\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=1\">Click here to proceed with the PHP conversion (step 1: User eStats).</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=2\">Execute step 2: eStat Entries.</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=3\">Execute step 3: Company / Groups (EHC ONLY).</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=4\">Execute step 4: Competitions.</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=5\">Execute step 5: Fix eStat Entries for Non-Standard Units.</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=6\">Execute step 6: Rebuild eStats From Surveys Taken (EHC ONLY).</a><br />\';\r\n	echo \'<br />\';\r\n	echo \'Make sure that you have executed steps 1 through 3 of the conversion process on a FRESH copy of of the old V1 EHC database.<br />\';\r\n\r\n	return;\r\n}\r\n\r\ndefine (\'LAST_STEP_NUMBER\', 6);\r\n\r\n/**\r\n * NOTES:\r\n \r\n*** Current eStats\r\n*\r\n\r\n1  weight  Your current weight  1  lifestyle  yes  2  1119738180  \r\n2  water  amount of water consumed  4  nutrition  yes  16  1119740160  \r\n3  time exercised  amount of time exercised  7  fitness  yes  16  1119740340  \r\n4  distance exercised  amount of distance exercised  9  fitness  yes  16  1119740400  \r\n5  fruits and vegetables  fruit and vegetables eaten  12  nutrition  yes  16  1119740460  \r\n6  sleep  amount of time slept at night  8  lifestyle  yes  16  1119740640  \r\n7  calorie intake  Calories eaten  18  nutrition  yes  2  1122444781  \r\n8  fat intake  Fat in all food eaten  17  nutrition  yes  2  1122444781  \r\n9  carb intake  Carbohydrates in all food eaten  17  nutrition  yes  2  1122444781  \r\n\r\n*** Current units\r\n*\r\n\r\n1  pounds  1  2  1119738422  \r\n2  kilograms  1  2  1119738444  \r\n4  glasses  1  16  1119742425  \r\n5  ounces  0  16  1119742425  \r\n7  minutes  0  16  1119742490  \r\n8  hours  2  16  1119742490  \r\n9  miles  2  16  1119742515  \r\n10  kilometers  2  16  1119742515  \r\n11  laps  1  16  1119742546  \r\n12  cups  1  16  1119742939  \r\n13  pieces  1  16  1119742953  \r\n16  steps  0  16  1119743102  \r\n17  grams  1  2  1122444589  \r\n18  calories  0  2  1122444589  \r\n\r\n */\r\n\r\necho \'<h2>PHP Conversion Step \' . (int)$_REQUEST[\'confirm\'] . \'</h2>\';\r\n\r\nswitch ((int)$_REQUEST[\'confirm\']) {\r\n// -------------------------------- USER ESTATS ---------------------------------------------\r\ncase \'1\':\r\n\r\n	logError(\'Disabled...\'); break;\r\n\r\n	echo \"Creating User eStats (determining which eStats to track) for all users.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	// Clear out table first (just in case)\r\n	$Q = \"DELETE FROM user_estats\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up all users to track weight with \'pounds\' as units\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT u.id AS \'userId\', 1 as \'estatId\', 1 AS \'unitId\', \'daily\' as \'frequency\'\r\n		FROM _users u\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up all users to track time exercised with \'minutes\' as units\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT u.id AS \'userId\', 3 as \'estatId\', 7 AS \'unitId\', \'daily\' as \'frequency\'\r\n		FROM _users u\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'distance exercised\' for users who had entries (estat 4, \'steps\' unit 16, \'miles\' unit 9)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT us.userId AS \'userId\', 4 AS \'estatId\', IF(avg(distanceExercised)>100,16,9) AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.distanceExercised > 0\r\n		GROUP BY us.userId\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'water\' for users who had entries (estat 2, \'ounces\' unit 5, \'glasses\' unit 4)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT us.userId AS \'userId\', 2 AS \'estatId\', IF(avg(water)>7,5,4) AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.water > 0\r\n		GROUP BY us.userId\";\r\n		\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'calories\' for users who had entries (estat 7, \'calories\' unit 18)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT us.userId AS \'userId\', 7 AS \'estatId\', 18 AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.calories > 0\r\n		GROUP BY us.userId\";\r\n	\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'fat\' for users who had entries (estat 8, \'grams\' unit 17)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)		\r\n		SELECT us.userId AS \'userId\', 8 AS \'estatId\', 17 AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.fat > 0\r\n		GROUP BY us.userId\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'carbs\' for users who had entries (estat 9, \'grams\' unit 17)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)		\r\n		SELECT us.userId AS \'userId\', 9 AS \'estatId\', 17 AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.carbs > 0\r\n		GROUP BY us.userId\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	break;\r\n\r\n// -------------------------------- ESTAT ENTRIES ---------------------------------------------\r\ncase \'2\':\r\n\r\n	logError(\'Disabled...\'); break;\r\n\r\n	echo \"Creating eStat Entries for all users.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	// Clear out table first (just in case)\r\n	$Q = \"DELETE FROM estat_entries\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'weight\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 1 AS \'estatId\', us.weight AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.weight > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'water\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 2 AS \'estatId\', us.water AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.water > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'time exercised\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 3 AS \'estatId\', us.minutesExercise AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.minutesExercise > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'distance exercised\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 4 AS \'estatId\', us.distanceExercised AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.distanceExercised > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'calories\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 7 AS \'estatId\', us.calories AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.calories > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'fat\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 8 AS \'estatId\', us.fat AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.fat > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'carb\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 9 AS \'estatId\', us.carbs AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.carbs > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	break;\r\n\r\n// -------------------------------- COMPANY / GROUPS ---------------------------------------------\r\ncase \'3\':\r\n\r\n	logError(\'Disabled...\'); break;\r\n\r\n	echo \"Creating groups for all companies and group memberships for all users.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	// Create groups for companies\r\n	$Q = \"SELECT id, companyName, companyVanity, userId\r\n		FROM companies\";\r\n\r\n	$companies = $SPADE[\'db\']->query($Q);\r\n\r\n	foreach ($companies as $company) {\r\n		$Q = \"INSERT INTO _groups (name, description, about, ownerId)\r\n			VALUES (\'\" . $company[\'companyVanity\'] . \"\', \r\n				\'\" . $company[\'companyName\'] . \"\', \r\n				\'Company Group Account\', \r\n				\" . (int)$company[\'userId\'] . \")\";\r\n\r\n		$companyGroupId = $SPADE[\'db\']->query($Q);\r\n\r\n		if (FALSE == $companyGroupId) {\r\n			logError (\'An error occurred while attempting to create a group for company \"\' . $company[\'companyName\'] . \'\".\');\r\n			continue;\r\n		}\r\n\r\n		// Update companies with group IDs\r\n		$Q = \"UPDATE companies \r\n			SET groupId = \" . (int)$companyGroupId . \"\r\n			WHERE id = \" . (int)$company[\'id\'];\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'An error occurred while attempting to update the company \"\' . $company[\'companyName\'] . \'\" with its new group id (\' . $companyGroupId . \').\');\r\n			continue;\r\n		}\r\n\r\n		// Create group memberships for all users\r\n		$Q = \"INSERT INTO _group_users (groupId, userId, title)\r\n			SELECT \" . (int)$companyGroupId . \" AS \'groupId\', u.id AS \'userId\', \'Employee: \" . addslashes($company[\'companyName\']) . \"\' AS \'title\'\r\n			FROM _users u\r\n			WHERE u.companyId = \" . (int)$company[\'id\'];\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'An error occurred while attempting to create group memberships for employees of \"\' . $company[\'companyName\'] . \'\". It is possible this company has no registered employees.\');\r\n			//continue;\r\n		}\r\n\r\n		// Update group_forums table with now corresponding group ID\r\n		$Q = \"UPDATE group_forums\r\n			SET groupId = \" . (int)$companyGroupId . \"\r\n			WHERE groupId = \" . (int)$company[\'id\'];\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'An error occurred while attempting to update the company forums for \"\' . $company[\'companyName\'] . \'\". It is possible this company had no registered forums.\');\r\n			//continue;\r\n		}\r\n	\r\n		echo \'SUCCESS: \' . $company[\'id\'] . \'.) \' . $company[\'companyName\'] . \' -- \' . $company[\'companyVanity\'] . \'.ehealthcompete.com<br />\';\r\n	}\r\n\r\n\r\n	break;\r\n\r\n// -------------------------------- COMPETITIONS ---------------------------------------------\r\ncase \'4\':\r\n\r\n	logError(\'Disabled...\'); break;\r\n\r\n	echo \"Converting competition data.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	$scoringMethods = array(\r\n		\'Weight Lost\' => array( \'estatId\' => 1, \'basedOn\' => \'actual change\', \'polarity\' => \'negative\' ),\r\n		\'Percentage Weight Lost\' => array( \'estatId\' => 1, \'basedOn\' => \'percent change\', \'polarity\' => \'negative\' ),\r\n		\'Minutes Exercise\' => array( \'estatId\' => 3, \'basedOn\' => \'total\', \'polarity\' => \'positive\' ),\r\n		\'Distance Exercised\' => array( \'estatId\' => 4, \'basedOn\' => \'total\', \'polarity\' => \'positive\' ),\r\n		\'Weight Gained\' => array( \'estatId\' => 1, \'basedOn\' => \'actual change\', \'polarity\' => \'positive\')\r\n	);\r\n\r\n	/**		\r\n	1  weight  Your current weight  1  lifestyle  yes  2  1119738180  \r\n	2  water  amount of water consumed  4  nutrition  yes  16  1119740160  \r\n	3  time exercised  amount of time exercised  7  fitness  yes  16  1119740340  \r\n	4  distance exercised  amount of distance exercised  9  fitness  yes  16  1119740400  \r\n	5  fruits and vegetables  fruit and vegetables eaten  12  nutrition  yes  16  1119740460  \r\n	6  sleep  amount of time slept at night  8  lifestyle  yes  16  1119740640  \r\n	7  calorie intake  Calories eaten  18  nutrition  yes  2  1122444781  \r\n	8  fat intake  Fat in all food eaten  17  nutrition  yes  2  1122444781  \r\n	9  carb intake  Carbohydrates in all food eaten  17  nutrition  yes  2  1122444781  \r\n	**/\r\n\r\n\r\n	$Q = \"SELECT * FROM competitions_old\";\r\n\r\n	$competitions = $SPADE[\'db\']->query($Q);\r\n\r\n	// Copy main competition data over...\r\n	// Done in SQL step 1.\r\n\r\n	foreach ($competitions as $comp) {\r\n		// ----- CREATE COMPETITION PARAMETERS ----- //\r\n		$currentParameters = array();\r\n		$currentParameters[] = $comp[\'scoringMethod\'];		\r\n\r\n		// Create competition parameters\r\n		$Q = \"INSERT INTO competition_parameters (competitionId, estatId, basedOn, polarity, displayOrder)\r\n			VALUES (\" . (int)$comp[\'id\'] . \",\r\n				\" . (int)$scoringMethods[$comp[\'scoringMethod\']][\'estatId\'] . \",\r\n				\'\" . $scoringMethods[$comp[\'scoringMethod\']][\'basedOn\'] . \"\',\r\n				\'\" . $scoringMethods[$comp[\'scoringMethod\']][\'polarity\'] . \"\',\r\n				0)\";\r\n\r\n		if (FALSE == ($parameterId = $SPADE[\'db\']->query($Q))) {\r\n			logError (\'Unable to create (primary) competition parameter for competition ID \' . $comp[\'id\'] . \'.\');\r\n			continue;\r\n		}\r\n\r\n		// Add parameter \r\n		if ($comp[\'tieBreakerMethod\'] && !in_array($comp[\'tieBreakerMethod\'], $currentParameters)) {\r\n			$currentParameters[] = $comp[\'tieBreakerMethod\'];\r\n\r\n			$Q = \"INSERT INTO competition_parameters (competitionId, estatId, basedOn, polarity, displayOrder)\r\n				VALUES (\" . (int)$comp[\'id\'] . \",\r\n					\" . (int)$scoringMethods[$comp[\'tieBreakerMethod\']][\'estatId\'] . \",\r\n					\'\" . $scoringMethods[$comp[\'tieBreakerMethod\']][\'basedOn\'] . \"\',\r\n					\'\" . $scoringMethods[$comp[\'tieBreakerMethod\']][\'polarity\'] . \"\',\r\n					1)\";\r\n	\r\n			if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n				logError (\'Unable to create (primary) competition parameter for competition ID \' . $comp[\'id\'] . \'.\');\r\n				continue;\r\n			}\r\n		}\r\n\r\n		if ($comp[\'weeklyWinnersMethod1\'] && !in_array($comp[\'weeklyWinnersMethod1\'], $currentParameters)) {\r\n			$currentParameters[] = $comp[\'weeklyWinnersMethod1\'];\r\n\r\n			$Q = \"INSERT INTO competition_parameters (competitionId, estatId, basedOn, polarity, displayOrder)\r\n				VALUES (\" . (int)$comp[\'id\'] . \",\r\n					\" . (int)$scoringMethods[$comp[\'weeklyWinnersMethod1\']][\'estatId\'] . \",\r\n					\'\" . $scoringMethods[$comp[\'weeklyWinnersMethod1\']][\'basedOn\'] . \"\',\r\n					\'\" . $scoringMethods[$comp[\'weeklyWinnersMethod1\']][\'polarity\'] . \"\',\r\n					2)\";\r\n	\r\n			if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n				logError (\'Unable to create (primary) competition parameter for competition ID \' . $comp[\'id\'] . \'.\');\r\n				continue;\r\n			}\r\n		}\r\n\r\n		if ($comp[\'weeklyWinnersMethod2\'] && !in_array($comp[\'weeklyWinnersMethod2\'], $currentParameters)) {\r\n			$currentParameters[] = $comp[\'weeklyWinnersMethod2\'];\r\n\r\n			$Q = \"INSERT INTO competition_parameters (competitionId, estatId, basedOn, polarity, displayOrder)\r\n				VALUES (\" . (int)$comp[\'id\'] . \",\r\n					\" . (int)$scoringMethods[$comp[\'weeklyWinnersMethod2\']][\'estatId\'] . \",\r\n					\'\" . $scoringMethods[$comp[\'weeklyWinnersMethod2\']][\'basedOn\'] . \"\',\r\n					\'\" . $scoringMethods[$comp[\'weeklyWinnersMethod2\']][\'polarity\'] . \"\',\r\n					3)\";\r\n	\r\n			if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n				logError (\'Unable to create (primary) competition parameter for competition ID \' . $comp[\'id\'] . \'.\');\r\n				continue;\r\n			}\r\n		}\r\n\r\n\r\n		// ----- CREATE COMPETITION PRIZES ----- //\r\n		$Q = \"INSERT INTO competition_prizes (\r\n				competitionId, title, description, maxWinners, \r\n				frequency, andOr, dateStart, dateEnd )\r\n			VALUES (\" . (int)$comp[\'id\'] . \",\r\n				\'Competition Prize\',\r\n				\'\" . addslashes($comp[\'potDescription\']) . \"\',\r\n				1,\r\n				\'once\',\r\n				\'and\',\r\n				\" . (int)$comp[\'startDate\'] . \",\r\n				\" . (int)$comp[\'endDate\'] . \")\";\r\n\r\n		if (FALSE == ($prizeId = $SPADE[\'db\']->query($Q))) {\r\n			logError (\'Unable to create a competition prize for competition ID \' . (int)$comp[\'id\'] . \'.\');\r\n			continue;\r\n		}\r\n\r\n		\r\n		// ----- CREATE COMPETITION PRIZE PARAMETERS ----- //\r\n		$Q = \"INSERT INTO competition_prize_parameters (\r\n				competitionPrizeId, competitionParameterId)\r\n			VALUES (\" . (int)$prizeId . \",\r\n				\" . (int)$parameterId . \")\";\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'Unable to create a competition prize parameter for competition ID \' . (int)$comp[\'id\'] . \'.\');\r\n			continue;\r\n		}\r\n	}\r\n\r\n	// ----- CREATE INVOICES ----- //\r\n	$Q = \"SELECT cp.userId, u.firstName, u.lastName, c.companyName, u.address1, u.address2,\r\n			u.city, u.state, u.country, u.zip, u.phone1, u.email,\r\n			cp.amount, cp.dateDonated, cp.paymentMethod, cp.entryFee,\r\n			cp.compId, comp.title\r\n		FROM competition_pot cp\r\n		INNER JOIN _users u ON (cp.userId = u.id)\r\n		LEFT JOIN competitions comp ON (cp.compId = comp.id)\r\n		LEFT JOIN companies c ON (u.companyId = c.id)\";\r\n\r\n	$paymentDetails = $SPADE[\'db\']->query($Q);\r\n\r\n	// Continue if no entry fees were paid\r\n	if (FALSE == is_array($paymentDetails) || 0 == sizeof($paymentDetails)) {\r\n		continue;\r\n	}\r\n\r\n	foreach ($paymentDetails as $payment) {\r\n		$Q = \"INSERT INTO invoices (\r\n				userId, firstName, lastName, company,\r\n				address1, address2, city, state, country, zip, phone, email,\r\n				dateDue, amountDue)\r\n			VALUES (\r\n				\" . (int)$payment[\'userId\'] . \",\r\n				\'\" . addslashes($payment[\'firstName\']) . \"\',\r\n				\'\" . addslashes($payment[\'lastName\']) . \"\',\r\n				\'\" . addslashes($payment[\'companyName\']) . \"\',\r\n				\'\" . addslashes($payment[\'address1\']) . \"\',\r\n				\'\" . addslashes($payment[\'address2\']) . \"\',\r\n				\'\" . addslashes($payment[\'city\']) . \"\',\r\n				\'\" . addslashes($payment[\'state\']) . \"\',\r\n				\'\" . addslashes($payment[\'country\']) . \"\', \r\n				\'\" . $payment[\'zip\'] . \"\',\r\n				\'\" . $payment[\'phone1\'] . \"\',\r\n				\'\" . addslashes($payment[\'email\']) . \"\',\r\n				\" . (int)$payment[\'dateDonated\'] . \",\r\n				\'\" . $payment[\'entryFee\'] . \"\')\";\r\n\r\n		if (FALSE == ($invoiceId = $SPADE[\'db\']->query($Q))) {\r\n			logError (\'Could not create an invoice for competition payment for comp ID \' . $payment[\'compId\'] . \' for \' . $payment[\'firstName\'] . \' \' . $payment[\'lastName\'] . \'.\');\r\n			continue;\r\n		}\r\n\r\n		$Q = \"INSERT INTO competition_entry_fees (\r\n				competitionId, userId, amount, invoiceId)\r\n			VALUES (\r\n				\'\" . $payment[\'compId\'] . \"\',\r\n				\" . (int)$payment[\'userId\'] . \",\r\n				\'\" . $payment[\'amount\'] . \"\',\r\n				\" . (int)$invoiceId . \")\";\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'Unable to save the competition entry fee for comp ID \' . $payment[\'compId\'] . \' for \' . $payment[\'firstName\'] . \' \' . $payment[\'lastName\'] . \'.\');\r\n			continue;\r\n		}\r\n\r\n		$Q = \"INSERT INTO invoice_line_items (\r\n				invoiceNumber, description, price, quantity)\r\n			VALUES (\r\n				\" . (int)$invoiceId . \",\r\n				\'Competition entry fee, competition #\" . $payment[\'compId\'] . \"\',\r\n				\'\" . $payment[\'entryFee\'] . \"\', \r\n				1)\";\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'Could not create an invoice line item for comp ID \' . $payment[\'compId\'] . \' for \' . $payment[\'firstName\'] . \' \' . $payment[\'lastName\'] . \'.\');\r\n		}\r\n\r\n		$Q = \"INSERT INTO invoice_payments (\r\n				invoiceNumber, dateOfPayment, amountPaid, paymentMethod)\r\n			VALUES (\r\n				\" . (int)$invoiceId . \",\r\n				\" . (int)$payment[\'dateDonated\'] . \",\r\n				\'\" . $payment[\'amount\'] . \"\',\r\n				\'\" . $payment[\'paymentMethod\'] . \"\')\";\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'Could not create an invoice payment for comp ID \' . $payment[\'compId\'] . \' for \' . $payment[\'firstName\' ] . \' \' . $payment[\'lastName\'] . \'.\');\r\n			continue;\r\n		}\r\n	}\r\n\r\n	break;\r\n\r\n// -------------------------------- FIX ESTAT ENTRIES FOR NON-STANDARD UNITS ---------------------------------------------\r\ncase \'5\':\r\n\r\n	logError(\'Disabled...\'); break;\r\n\r\n	echo \"Converting eStats for non-standard units.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	// Get userId\'s of users who have non-standard units (ounces = unitId 5) for water entries.\r\n	$Q = \"SELECT u.id\r\n		FROM user_estats ue\r\n		INNER JOIN _users u ON (ue.userId = u.id)\r\n		WHERE ue.estatId = 2\r\n		AND ue.unitId = 5\";\r\n\r\n	$userIds = $SPADE[\'db\']->query($Q, DB_LIST);\r\n	$userIds = implode(\',\', $userIds);\r\n\r\n	$Q = \"UPDATE estat_entries \r\n		SET value = (value * 0.125)\r\n		WHERE estatId = 2\r\n		AND userId IN (\" . $userIds . \")\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError (\'An error occurred while attempting to update and convert water entries from ounces to glasses.\');\r\n		break;\r\n	}\r\n\r\n	// Get userId\'s of users who have non-standard units (steps = unitId 16) for distance exercised entries.\r\n	$Q = \"SELECT u.id\r\n		FROM user_estats ue\r\n		INNER JOIN _users u ON (ue.userId = u.id)\r\n		WHERE ue.estatId = 4\r\n		AND ue.unitId = 16\";\r\n\r\n	$userIds = $SPADE[\'db\']->query($Q, DB_LIST);\r\n	$userIds = implode(\',\', $userIds);\r\n\r\n	$Q = \"UPDATE estat_entries \r\n		SET value = (value * 0.0005)\r\n		WHERE estatId = 4\r\n		AND userId IN (\" . $userIds . \")\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError (\'An error occurred while attempting to update and convert distance exercised entries from steps to miles.\');\r\n		break;\r\n	}\r\n\r\n\r\n	break;\r\n\r\n// -------------------------------- CORRECT / REBUILD estat_entries FROM company_survey_estats ---------------------------------------------\r\ncase \'6\':\r\n\r\n	echo \"Rebuilding estat_entries from company_survey_estats<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	$Q = \"SELECT *\r\n		FROM company_survey_estats\";\r\n\r\n	// Temp...\r\n	//$Q .= \" WHERE surveyId = 34\";\r\n\r\n	$companySurveyEstats = $SPADE[\'db\']->query($Q);\r\n\r\n	foreach ($companySurveyEstats as $cse) {\r\n\r\n		$whereAddition = \'\';\r\n\r\n		if ($cse[\'dateStart\']) {\r\n			$whereAddition .= \' AND st.dateTaken > \' . $cse[\'dateStart\'];\r\n		}\r\n\r\n		if ($cse[\'dateEnd\']) {\r\n			$whereAddition .= \' AND st.dateTaken < \' . $cse[\'dateEnd\'];\r\n		}\r\n\r\n		$Q = \"SELECT ee.id\r\n			FROM surveys_taken st\r\n			INNER JOIN surveys s ON (st.surveyId = s.id)\r\n			INNER JOIN estat_entries ee ON (ee.userId = st.userId AND ee.estatId = \" . $cse[\'estatId\'] . \" AND ee.dateOfEntry = st.dateTaken)\r\n			WHERE s.id = \" . $cse[\'surveyId\'] . \"\r\n			AND (s.companyId = \" . $cse[\'companyId\'] . \" OR s.companyId = 0)\" . $whereAddition;\r\n		\r\n		display($Q);\r\n\r\n		$entryIds = trim(implode(\',\', $SPADE[\'db\']->query($Q, DB_LIST)));\r\n\r\n		if ($entryIds) {\r\n			$Q = \"DELETE FROM estat_entries WHERE id IN (\" . $entryIds . \")\";\r\n	\r\n			display($Q);\r\n	\r\n			$SPADE[\'db\']->query($Q);\r\n		}\r\n\r\n		$Q = \"SELECT st.*\r\n			FROM surveys_taken st\r\n			LEFT JOIN surveys s ON (st.surveyId = s.id)\r\n			WHERE s.id = \" . $cse[\'surveyId\'] . \"\r\n			AND (s.companyId = \" . $cse[\'companyId\'] . \" OR s.companyId = 0)\" . $whereAddition;\r\n\r\n		display($Q);\r\n\r\n		$surveysTaken = $SPADE[\'db\']->query($Q);\r\n\r\n		if (is_array($surveysTaken) AND 0 < sizeof($surveysTaken)) {\r\n			foreach ($surveysTaken as $st) {\r\n				$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n					VALUES (\r\n						\" . $st[\'userId\'] . \",\r\n						\" . $cse[\'estatId\'] . \",\r\n						\" . $st[\'pointsEarned\'] . \",\r\n						\" . $st[\'dateTaken\'] . \",\r\n						\" . $SPADE[\'user\']->id . \",\r\n						\" . time() . \")\";\r\n\r\n				display($Q);\r\n\r\n				$SPADE[\'db\']->query($Q);\r\n			}\r\n		}\r\n	}\r\n\r\n\r\n\r\n	break;\r\n\r\ndefault:\r\n	logError( \'Unknown confirm step number: \' . $_REQUEST[\'confirm\'] );\r\n	return;\r\n}\r\n\r\n\r\nif ($_REQUEST[\'confirm\'] <= LAST_STEP_NUMBER) {\r\n	echo \'<br /><br /><a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=\' . ((int)$_REQUEST[\'confirm\'] + 1) . \'\">Execute the next step of the PHP conversion process.</a>\';\r\n}\r\n\r\n\r\n?>'),(5332,233,1.78,'smarty','0','Working on e-mail your team feature.',1258158747,2,'206.71.78.158','{assign var=\"hideWidgets\" value=0}\r\n{assign var=\"hideUserBox\" value=\"false\"}\r\n{assign var=\"showCompanyNews\" value=\"true\"}\r\n{assign var=\"pgLayout\" value=\"layouts/withLeftNav.tpl\"}\r\n{assign var=\"GUIDs\" value=\"\"}\r\n\r\n{select_query assign=\"managerId\" return=\"val\"}\r\n	userId FROM competitions c WHERE c.id = {$smarty.request.cid}\r\n{/select_query}\r\n\r\n{if $managerId eq $user->id or $acm->isDomainAdmin()}\r\n	{assign var=\"isManager\" value=\"true\"}\r\n	<!-- ismanager -->\r\n{/if}\r\n\r\n{if $isManager or \'yes\' == $smarty.session.company.preferences.anyone_joins_teams}\r\n	{assign var=\"canCreateTeams\" value=\"true\"}\r\n	{assign var=\"canAssignToTeams\" value=\"true\"}\r\n	{include_php file=\"shared_handle:competition/management\"}\r\n{/if}\r\n\r\n{include_php file=\"shared_handle:competition/load\"}\r\n\r\n<script type=\"text/javascript\">{literal}\r\n	var GUIDs = \'0\';\r\n\r\n	function updateGUIDs() {\r\n		var checkBoxes = document.forms[\'leaderBoardForm\'][\"graphCheckbox[]\"];\r\n		if (!checkBoxes.length) {\r\n			checkBoxes[0] = checkBoxes;\r\n			checkBoxes.length = 1;\r\n		}\r\n		GUIDs = \'\';\r\n		for (var x = 0; x < checkBoxes.length; x++) {\r\n			if (checkBoxes[x].checked == true && checkBoxes[x].value) {\r\n				GUIDs += checkBoxes[x].value+\',\'; \r\n			}\r\n			\r\n		}\r\n		rewriteGraphLinks();\r\n	}\r\n\r\n\r\n	function loadGraphWindow(graphParams) {\r\n		uri = \'?pg=flashgraph-frame&compId={/literal}{$competition.id}{literal}; //&\'+graphParams+\'&userIds=\'+GUIDs;\r\n		var gFrame = window.frames[\'graphwindow\'];\r\n		// gFrame.location.replace(uri);\r\n		var gForm = document.getElementById(\'form_leaderBoard\');\r\n		gForm.gParams.value = graphParams;\r\n		gForm.userIds.value = GUIDs;\r\n		gForm.submit();\r\n		return false;\r\n	}\r\n{/literal}</script>\r\n\r\n{include_php file=\"shared_handle:competition.verifyInitialPot\"}\r\n\r\n{capture name=\"scoringMethod\"}\r\n	<b>{$competition.current_parameter.name|capitalize}</b> ({$competition.current_parameter.units}) - {$competition.current_parameter.basedOn|capitalize}{* - {$competition.current_parameter.polarity|capitalize} *}\r\n{/capture}\r\n\r\n<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\r\n	<tr>\r\n		<td valign=\"top\" width=\"275\">\r\n\r\n		{if $competition.prizes|@count}\r\n		<br />\r\n		<h2 class=\"withBG\">\r\n			<div class=\"topRight hideShow\">\r\n					<a href=\"javascript:toggle(\'winners\', \'\', \'showHide\');\"><img id=\"winners_img\" src=\"./img/blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a>\r\n				</div>\r\n			Winners\r\n		</h2>\r\n\r\n		<div id=\"winners\" style=\"display:block;\">\r\n		{foreach from=$competition.prizes item=\"prize\" key=\"prizeId\"}\r\n			<a href=\"javascript://\" onclick=\"window.open(\'?pg=competition/winners&cid={$competition.id}&prizeId={$prizeId}\', \'\', \'height=425,width=300,menubar=no,status=no,scrollbars=yes,titlebar=no,resizable=yes\');\">{$prize.title}</a><br />\r\n		{/foreach}\r\n		</div>\r\n		{/if}\r\n		\r\n		<br />\r\n		<h2 class=\"withBG\">\r\n			<div class=\"topRight hideShow\">\r\n					<a href=\"javascript:toggle(\'leaderBoard\', \'\', \'showHide\');\"><img id=\"leaderBoard_img\" src=\"./img/blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a>\r\n				</div>\r\n			Leaders\r\n		</h2>\r\n		\r\n		{if $competition.dateOfObject}<div align=\"right\"><small><i>as of {$competition.dateOfObject|date_format2:\"n/j/Y g:i A\"}</i></small></div>{/if}\r\n\r\n		<div id=\"leaderBoard\" style=\"display:block;\">\r\n		<small>{$smarty.capture.scoringMethod}</small><br />\r\n		{if $competition.style eq \"Group-vs-Group\"}\r\n			<div align=\"center\" style=\"font-size:9px; color:#000;\">(Team Average)</div>\r\n		{elseif $competition.style eq \"Company-vs-Company\"}\r\n			<div align=\"center\" style=\"font-size:9px; color:#000;\">(Company Average)</div>\r\n		{/if}\r\n		{if $competition.parameters|@count gt 1}\r\n			<select name=\"scoringMethod\" onchange=\"if(this.value)location.replace(\'?pg={$page.name}&cid={$competition.id}&cpid=\'+this.value);\" style=\"width:200px;\">\r\n				<option value=\"\">(Choose Leaderboard)</option>\r\n			{foreach from=$competition.parameters key=\"paramId\" item=\"param\"}\r\n				{if $paramId neq $competition.current_parameter.id}\r\n				<option value=\"{$paramId}\">{$param.name|capitalize} - {$param.basedOn|capitalize}{* - {$param.polarity} *}</option>\r\n				{/if}\r\n			{/foreach}\r\n			</select>\r\n		{/if}\r\n		<form id=\"form_leaderBoard\" name=\"leaderBoardForm\" method=\"POST\" action=\"index.php?pg=flashgraph-frame&compId={$competition.id}\" target=\"graphwindow\">\r\n		<input type=\"hidden\" name=\"gParams\" value=\"\" />\r\n		<input type=\"hidden\" name=\"userIds\" value=\"\" />\r\n		<table cellpadding=\"0\" cellspacing=\"0\">\r\n		{if $competition.style eq \'Group-vs-Group\' or $competition.style eq \'Company-vs-Company\'}\r\n			<tr>\r\n			<td class=\"thinCell\">#</td>\r\n			<td class=\"thinCell\">Team</td>\r\n			<td class=\"thinCell\"><img src=\"{$skinFolder}images/trophy_ico.gif\" width=\"15\" height=\"15\" alt=\"\" /></span>\r\n			<td class=\"thinCell\">#Pl</td>\r\n			{* <td class=\"cellHeadTiny\"><img src=\"{$skinFolder}images/graph_ico.gif\" width=\"15\" height=\"15\" alt=\"Show In Graphs\" /></td> *}\r\n			</tr>\r\n			{foreach name=\"rankLoop\" from=$competition.team_data item=\"teamScore\" key=\"teamName\"}\r\n				{if $teamName ne \"Waiting to Join\"}\r\n					<tr>\r\n						<td class=\"thinCell\"><small>{$smarty.foreach.rankLoop.iteration}</small></td>\r\n						<td class=\"thinCell\"><small class=\"mini\">{$teamName|default:\"&nbsp;\"}</small></td>\r\n						<td class=\"thinCell\"><small>{$teamScore|number_format:2}</small></td>\r\n						<td class=\"thinCell\"><small>{$competition.teams.$teamName|@count|default:\"0\"}</small></td>\r\n						{* <td class=\"thinCell\"><input class=\"graphCheckbox\" name=\"graphCheckbox[]\" type=\"checkbox\" value=\"{foreach from=$teams.users item=teamUser}{$teamUser.id},{if $smarty.foreach.rankLoop.iteration lt 11}{append var=\"GUIDs\" value=\"`$teamUser.id`,\"}{/if}{/foreach}{$GUIDs}\"{if $smarty.foreach.rankLoop.iteration lt 11} checked=\"checked\"{/if} onclick=\"updateGUIDs();\" /></td> *}\r\n					</tr>\r\n				{/if}\r\n			{/foreach}\r\n		{else} \r\n			<tr>\r\n			<td class=\"thinCell\">#</td>\r\n			<td class=\"thinCell\" align=\"center\">Name</td>\r\n			<td class=\"thinCell\"><img src=\"{$skinFolder}images/trophy_ico.gif\" width=\"15\" height=\"15\" alt=\"{$smarty.capture.scoringMethod|strip_tags}\" /></td>\r\n			<td class=\"thinCell\">Update</td>\r\n			<td class=\"thinCell\" align=\"center\"><img src=\"{$skinFolder}images/graph_ico.gif\" width=\"15\" height=\"15\" alt=\"Show in Graphs\" /></td>\r\n			</tr>\r\n			{foreach from=$competition.data item=\"userData\" key=\"userId\" name=\"compData\"}\r\n			{assign var=\"curIteration\" value=$smarty.foreach.compData.iteration}\r\n			{if $curIteration eq 21}\r\n			</table>\r\n			</div>\r\n			<br />\r\n			<h2 class=\"withBG\">\r\n				<div class=\"topRight hideShow\">\r\n					<a href=\"javascript:toggle(\'runnerUps\', \'\', \'showHide\');\"><img id=\"runnerUps_img\" src=\"./img/blank.gif\" class=\"showHide_off\" alt=\"show/hide\" border=\"0\" /></a>\r\n				</div>\r\n				Runner Ups\r\n			</h2>\r\n			<div id=\"runnerUps\" style=\"display:none;\">\r\n			<table cellpadding=\"0\" cellspacing=\"0\">\r\n			{/if}\r\n			<tr>\r\n			<td class=\"thinCell\"><small>{$curIteration}</small></td>\r\n			<td class=\"thinCell\"><small class=\"mini\">{$competition.users[$userId]}</small></td>\r\n			<td class=\"thinCell\"><small>{$userData.val|number_format:$competition.current_parameter.decimalPlaces}</small></td>\r\n			<td class=\"thinCell\"><small>{if $userData.doe}{$userData.doe|date_format2:\"n/j/y\"}{else}-Never-{/if}</small></td>\r\n			<td class=\"thinCell\"><input class=\"graphCheckbox\" name=\"graphCheckbox[]\" type=\"checkbox\" value=\"{$userId}{if $curIteration lt 11}{append var=\"GUIDs\" value=\"`$userId`,\"}{/if}\"{if $curIteration lt 11} checked=\"checked\"{/if} onclick=\"updateGUIDs();\" /></td>\r\n			</tr>\r\n			{/foreach}\r\n		{/if}\r\n		</form>\r\n		<script type=\"text/javascript\">GUIDs = \'{$GUIDs}\';</script>\r\n		</table>\r\n		</div> \r\n		<div align=\"right\"><small><i><a href=\"?pg=faq#comp\">How is the competition scored?</a></i></small></div>\r\n		<img src=\"./img/blank.gif\" width=\"168\" height=\"1\" alt=\"\" />\r\n		{if $isManager and $competition.style neq \'Company-vs-Company\'}\r\n		<h2 class=\"withBG\">\r\n			<div class=\"topRight hideShow\">\r\n				<a href=\"javascript:toggle(\'managePlayers\', \'\', \'showHide\');\"><img id=\"managePlayers_img\" src=\"./img/blank.gif\" class=\"showHide_off\" alt=\"show/hide\" border=\"0\" /></a>\r\n			</div> \r\n			Manage\r\n		</h2>\r\n		<div id=\"managePlayers\" style=\"display:none;\">\r\n					<form name=\"managePlayers[]\" action=\"index.php\" method=\"POST\" style=\"margin:0px;\">\r\n					<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\">\r\n					<input type=\"hidden\" name=\"cid\" value=\"{$competition.id}\">\r\n					<input type=\"hidden\" name=\"no_expire\" value=\"true\">\r\n					<input type=\"hidden\" name=\"no_expire_keep_alive\" value=\"cid\">\r\n					<input type=\"hidden\" name=\"style\" value=\"{$competition.style}\">\r\n					<span class=\"cellHeadTiny\" style=\"clear:left;\">Del</span>\r\n					<span class=\"cellHead\">View Stats</span>\r\n					{* <span class=\"cellHeadSmall\">-</span> *}\r\n					<br />\r\n					{foreach from=$competition.users item=\"username\" key=\"userId\" name=\"dateUpdated\"}\r\n						<span class=\"cellTiny\" style=\"clear:left;\"><small><input type=\"checkbox\" name=\"managePlayers[delete][]\" value=\"{$username}\" style=\"width:14px;height:14px;margin:0px 2px;\"></small></span>\r\n						<span class=\"cell\"><small><a href=\"?pg=my_home&cid={$competition.id}&userId={$userId}&hideComps=1\">{$username}</a></small></span>\r\n						{* <span class=\"cellSmall\"><small><a href=\"mailto:{$compUser.email}\">email</a></small></span> *}\r\n						<br />\r\n					{/foreach}\r\n					<div style=\"text-align:center;\">\r\n                                                <br />\r\n						<input type=\"submit\" class=\"button\" value=\"Remove Selected\">\r\n					</div>\r\n					</form>\r\n		</div><br/>\r\n		{/if}\r\n		{* End new section for Player management. *}\r\n		\r\n		{* Begin new section for Team management.  This can be moved where ever. *}\r\n		{* ******************************** TEAM MANAGEMENT ***************************************** *}\r\n		{if $canCreateTeams and $competition.style eq \'Group-vs-Group\'}\r\n		<h2 class=\"withBG\">\r\n			<div class=\"topRight hideShow\">\r\n				<a href=\"javascript:toggle(\'teamManagement\', \'\', \'showHide\');\"><img id=\"teamManagement_img\" src=\"./img/blank.gif\" class=\"showHide_{if $smarty.request.showTeamManagement}on{else}off{/if}\" alt=\"show/hide\" border=\"0\" /></a>\r\n			</div>\r\n			Teams</h2>\r\n		<div id=\"teamManagement\" style=\"display:{if $smarty.request.showTeamManagement}block{else}none{/if};\">\r\n			<form name=\"manageTeam[]\" action=\"index.php\" method=\"POST\" style=\"margin:0px;\">\r\n			<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\">\r\n			<input type=\"hidden\" name=\"cid\" value=\"{$competition.id}\">\r\n			<input type=\"hidden\" name=\"no_expire\" value=\"true\">\r\n			<input type=\"hidden\" name=\"no_expire_keep_alive\" value=\"cid\">\r\n			<div id=\"playersList{counter}\">\r\n				{if $isManager}<span class=\"cellHeadTiny\">Del</span>{/if}\r\n				<span class=\"cellHeadLarge\" style=\"width:134px;\">Team Name</span><br />\r\n				{foreach from=$competition.teams item=\"team\" key=\"teamName\"}\r\n					{counter name=\"counterI\" start=\"0\" print=0}\r\n					{if $teamName ne \"Waiting to Join\"}\r\n						{if $isManager}<span class=\"cellTiny\" style=\"clear:left;\"><small><input type=\"checkbox\" name=\"manageTeam[delete][]\" value=\"{$teamName|htmlspecialchars}\"></small></span>{/if}\r\n						<span class=\"cellLarge\" style=\"width:134px;\"><small>\r\n							{if $isManager or $team|@in_array:$user->id}<input id=\"renameTeam\" type=\"text\" value=\"{$teamName|htmlspecialchars}\" name=\"manageTeam[rename][{$teamName|htmlspecialchars}]\" size=\"10\" style=\"width:124px;height:12px\">\r\n							{else}<span>{$teamName}</span>\r\n							{/if}\r\n						</small></span><br />\r\n					{/if}\r\n				{/foreach}\r\n			</div>\r\n                        <br />\r\n			<div style=\"text-align:center;\">New Team: <input id=\"addTeam\" type=\"text\" name=\"manageTeam[addTeam]\" size=\"10\"><br />\r\n			<br />\r\n                        <input type=\"submit\" class=\"button\" value=\"Submit Changes\"></div>\r\n			</form>\r\n		</div><br />\r\n		{/if}\r\n		{* End new section for Team management. *}\r\n\r\n		\r\n		{* if !$isManager AND $competition.users|@count lt 45}{include file=\"layouts/ads.tpl\"}{assign var=\"adsShown\" value=\"1\"}{/if *}\r\n\r\n		{*\r\n			<h2 class=\"withBG\">Competition Stats</h2>\r\n			<span class=\"cellHeadLarge\">Category</span><span class=\"cellHeadSmall\">Result</span><br />\r\n			<span class=\"cellLarge\"><small>start weight</small></span>\r\n			<span class=\"cellSmall\"><small>{$competition.groupStartWeight|default:0} lbs</small></span><br />\r\n			<span class=\"cellLarge\"><small>weight lost</small></span>\r\n			<span class=\"cellSmall\"><small>{$competition.groupWeightLost|default:0} lbs</small></span><br />\r\n			{if $competition.groupPercentageWeightLost gt 0}<span class=\"cellLarge\"><small>% lost</small></span>\r\n			<span class=\"cellSmall\"><small>{$competition.groupPercentageWeightLost|default:0|number_format:\"2\"}</small></span><br />{/if}\r\n			<span class=\"cellLarge\"><small>fat intake</small></span>\r\n			<span class=\"cellSmall\"><small>{$competition.groupFat|default:0}</small></span><br />\r\n			<span class=\"cellLarge\"><small>calorie intake</small></span>\r\n			<span class=\"cellSmall\"><small>{$competition.groupCalories|default:0}</small></span><br />\r\n			<span class=\"cellLarge\"><small>minutes exercised</small></span>\r\n			<span class=\"cellSmall\"><small>{$competition.groupExercise|default:0}</small></span><br />\r\n			<span class=\"cellLarge\"><small>distance exercised</small></span>\r\n			<span class=\"cellSmall\"><small>{$competition.groupDistanceExercised|default:0}</small></span><br />\r\n			<img src=\"./img/blank.gif\" width=\"165\" height=\"1\" alt=\"\" />\r\n		*}\r\n		</td>\r\n		<td width=\"100%\" valign=\"top\">\r\n			<div id=\"contentBox\" class=\"centerBox\" style=\"margin-left:10px;\"><div class=\"topRightTreasure\">\r\n<div id=\"jackpot\">{if $competition.potAmount gt 0}${$competition.potAmount|number_format:2}{/if}</div>\r\n<h1 class=\"underline\">{$competition.title|default:\"Competition Title\"}</h1>\r\n\r\n{* ******************************** COMPETITION END *********************************** *}\r\n{if $competition.endDate lt $smarty.now}   {* COMPETITION IS OVER *}\r\n	{if $competition.results.winners|@count eq 1}\r\n		{* There was one winner, either by scoringMethod or tieBreakerMethod *}\r\n\r\n		{math assign=\"daysOfCompetition\" equation=\"(x - y) / z\" x=$competition.endDate|default:\"0\" y=$competition.startDate|default:\"0\" z=\"86400\"}\r\n		{math assign=\"marginOfVictory\" equation=\"x - y\" x=$competition.results.winningStat|default:\"0\" y=$competition.results.secondPlaceStat|default:\"0\"}\r\n\r\n		{foreach from=$competition.results.winners item=\"winnerName\"}    {*key=\"winnerName\"*}\r\n			{assign var=\"winnerData\" value=$competitions.users.$winnerName}\r\n			\r\n			{if $competition.style eq \"Group-vs-Group\"}\r\n				{assign var=\"description\" value=\"Winning Team\"}\r\n				{assign var=\"avg\" value=\"average\"}\r\n			{else}\r\n				{assign var=\"description\" value=\"Winner\"}\r\n			{/if}\r\n\r\n			<h2><br /><b>{$winnerName}</b> is the {$description}{if $competition.potAmount}, taking home <b>$<i>{$competition.potAmount|number_format:2}</i></b>{/if}!</h2>\r\n			<br />\r\n			{strip}\r\n			{if not $competition.results.isTie}   {* Not a Tie *}\r\n				After a difficult <b>{$daysOfCompetition|number_format:0}</b> days of \r\n				fierce competition, <b>{$winnerName}</b> is the \r\n				{$description}!	Based on \r\n				<b>{$competition.results.winningMethod}</b>, <b>{$winnerName}</b> \r\n				won with <b>{$competition.results.winningStat|number_format:2} \r\n				{if $competition.results.winningMethod eq \"Weight Lost\"}{$avg} pounds lost\r\n				{elseif $competition.results.winningMethod eq \"Percentage Weight Lost\"}{$avg} % body weight lost\r\n				{elseif $competition.results.winningMethod eq \"Minutes Exercise\"}{$avg} minutes exercised\r\n				{elseif $competition.results.winningMethod eq \"Distance Exercised\"}{$avg} miles exercised\r\n				{elseif $competition.results.winningMethod eq \"Weight Gained\"}{$avg} pounds gained\r\n				{/if}</b>.\r\n			{else}                                {* A Tie! *}\r\n				{assign var=\"weightLost\" value=\"Weight Lost\"}\r\n				{assign var=\"percentLost\" value=\"Percentage Weight Lost\"}\r\n\r\n				After a difficult <b>{$daysOfCompetition|number_format:0}</b> \r\n				days of fierce competition, there was a tie in the judging \r\n				method, <b>{$competition.scoringMethod}</b>. To break this \r\n				tie, the selected tie breaking method, \r\n				<b>{$competition.tieBreakerMethod}</b>, was used to determine \r\n				<b>{$winnerName}</b> as the {$description}. <b>{$winnerName}</b> \r\n				won with <b>{$competition.results.winningStat|number_format:2}\r\n				{if $competition.results.winningMethod eq \"Weight Lost\"}{$avg} pounds lost\r\n				{elseif $competition.results.winningMethod eq \"Percentage Weight Lost\"}{$avg} % body weight lost\r\n				{elseif $competition.results.winningMethod eq \"Minutes Exercise\"}{$avg} minutes exercised\r\n				{elseif $competition.results.winningMethod eq \"Distance Exercised\"}{$avg} miles exercised\r\n				{elseif $competition.results.winningMethod eq \"Weight Gained\"}{$avg} pounds gained\r\n				{/if}</b>.\r\n				<!--\r\n				<b>{$winnerData.$weightLost|number_format:0} pounds</b>, which \r\n				was <b>{$winnerData.$percentLost|number_format:4}%</b> body weight.\r\n				-->\r\n			{/if}\r\n			{/strip}\r\n			<br />\r\n			<br />\r\n			<b>{$winnerName}</b> won with a <b>{$marginOfVictory|number_format:3}</b> margin over <b>{$competition.results.secondPlaceUser}</b>.\r\n			\r\n			<h2><br />Congratulations to you all!</h2>\r\n			<br />\r\n			<div class=\"underline\"></div>\r\n		{/foreach}\r\n\r\n	{elseif $competition.results.winners|@count gt 1}\r\n		{* There were multiple winners, even after tieBreakerMethod (should RARELY happen) *}\r\n	\r\n		<h2>There was a tie in this competition. The winners, by <b>{$competition.results.winningMethod}</b> having lost <b>{$competition.results.winningStat}</b>, are:<br /></h2>\r\n		<ul>\r\n		{foreach from=$competition.results.winners item=\"winnerData\" key=\"winnerName\"}\r\n			<li>{$winnerName}</li>\r\n		{/foreach}\r\n		</ul>\r\n		\r\n	{else}\r\n		{* For some reason, there were no winners *}\r\n\r\n		<h2><br />\r\n		Winner information is being calculated. <br />\r\n		Please check back soon.\r\n		<br /><br /></h2>\r\n	{/if}\r\n	This competition has ended and is no longer active.<br />\r\n{/if}\r\n{* ************************************************************************************ *}\r\n\r\n<div id=\"prizeDesc\">{$competition.potDescription}<br />\r\n{if $competition.potAmount}<small style=\"color:#FFF;\">(${$competition.individualPotAmount} from {$competition.potMethod})</small>{/if}</div>\r\n\r\n{if $competition.startDate lt $smarty.now}\r\n	Time remaining: <b>{$competition.timeLeft}</b><br />\r\n{else}\r\n	This competition has not yet started!<br />\r\n{/if}\r\n\r\nStart{if $competition.startDate lt $smarty.now}ed{else}s{/if}: <b>{$competition.startDate|date_format2:\"n/j/Y\"}</b> &nbsp; \r\nEnd{if $competition.endDate lt $smarty.now}ed{else}s{/if}: <b>{$competition.endDate|date_format2:\"n/j/Y\"}</b><br />\r\n{if $competition.calculationMode neq \"Real-Time\"}Competition stats/scoring updated as of {$competition.dateOfObject|date_format2:\"n/j/Y g:i A\"}{if $isManager} (<a href=\"?pg=competition&cid={$smarty.request.cid}&nocache=1\">Update Now!</a>){/if}<br />{/if}\r\n<div style=\"font-size:5px;clear:left;\">&nbsp;</div>\r\n{assign var=\"scoringMethod\" value=$competition.scoringMethod}\r\n{assign var=\"tieBreakerMethod\" value=$competition.tieBreakerMethod}\r\n{assign var=\"weeklyWinnersMethod1\" value=$competition.weeklyWinnersMethod1}\r\n{assign var=\"weeklyWinnersMethod2\" value=$competition.weeklyWinnersMethod2}\r\n\r\n{* ******************** WEEKLY WINNERS ********************* *}\r\n{if $competition.weeklyWinners}\r\n	{if $weeklyWinnersMethod1}             {* DON\'T FORGET TO REMOVE THE ACM CHECK WHEN READY!!! *}\r\n		<h2 class=\"withBG\">\r\n			<div class=\"topRight hideShow\">\r\n			<a href=\"javascript:toggle(\'weeklyWinners\', \'\', \'showHide\');\"><img id=\"weeklyWinners_img\" src=\"./img/blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a></div>\r\n			Last Week\'s Winners<i>!</i> <small style=\"color:#000; font-size:11px;\">(<i><b>{$competition.weeklyWinners.startDate|date_format2:\"D n/j\"}</b> through <b>{$competition.weeklyWinners.endDate|date_format2:\"D n/j\"}</b></i>)</small></h2> \r\n		<div id=\"weeklyWinners\">\r\n		<table width=\"100%\" cellpadding=\"3\" cellspacing=\"0\"><tr>\r\n		<td valign=\"top\" width=\"50%\">\r\n		<div class=\"cellHeadLarge\" style=\"width:auto;float:none;\">{$weeklyWinnersMethod1}</div>\r\n		<img src=\"{$skinFolder}images/winner_1.gif\" style=\"float:left;\" />\r\n		{strip}\r\n		{foreach name=\"method1\" from=$competition.weeklyWinners.$weeklyWinnersMethod1 item=\"username\"}\r\n			{assign var=\"userValue\" value=$competition.weeklyWinners.users.$username.$weeklyWinnersMethod1}\r\n			{if $smarty.foreach.method1.iteration gt 3 OR $userValue lte 0}{if $smarty.foreach.method1.iteration eq 1}Don\'t forget to update your progress so there will be winners next week{/if}<i>!</i>{php}break;{/php}\r\n			{elseif $smarty.foreach.method1.iteration eq 1}\r\n				<b>{$username|default:\"[ ?? ]\"|ucfirst}</b> led the way last week by \r\n				{if $weeklyWinnersMethod1 eq \'Weight Lost\'}losing <b>{$userValue}</b> pounds{elseif $weeklyWinnersMethod1 eq \'Percentage Weight Lost\'}losing <b>{$userValue|number_format:\"2\"}%</b> body weight{elseif $weeklyWinnersMethod1 eq \'Minutes Exercise\'}exercising <b>{$userValue}</b> minutes{elseif $weeklyWinnersMethod1 eq \'Distance Exercised\'}exercising a distance of <b>{$userValue}</b> {elseif $weeklyWinnersMethod1 eq \'Weight Gained\'}gaining <b>{$userValue}</b> pounds{else}<b>default</b>{/if}\r\n			{else}\r\n				{if $smarty.foreach.method1.iteration eq 2}, followed by <b>{$username|default:\"[ ?? ]\"|ucfirst}</b> with \r\n				{else} and <b>{$username|default:\"[ ?? ]\"|ucfirst}</b> with \r\n				{/if}\r\n				{if $weeklyWinnersMethod1 eq \'Weight Lost\'}<b>{$userValue}</b> pounds{elseif $weeklyWinnersMethod1 eq \'Percentage Weight Lost\'}<b>{$userValue|number_format:\"2\"}%</b>{elseif $weeklyWinnersMethod1 eq \'Minutes Exercise\'}<b>{$userValue}</b> minutes{elseif $weeklyWinnersMethod1 eq \'Distance Exercised\'}a distance of <b>{$userValue}</b>{elseif $weeklyWinnersMethod1 eq \'Weight Gained\'}<b>{$userValue}</b> pounds{/if}\r\n			{/if}\r\n		{/foreach}\r\n		{/strip}\r\n		</td>\r\n	{/if}\r\n	{if $weeklyWinnersMethod2} \r\n		<td valign=\"top\" width=\"50%\">\r\n		<div class=\"cellHeadLarge\" style=\"width:auto;float:none;\">{$weeklyWinnersMethod2}</div>\r\n		<img src=\"{$skinFolder}images/winner_2.gif\" style=\"float:left;\" />\r\n		{* display var=$competition.weeklyWinners.users *}\r\n		{strip}\r\n		{foreach name=\"method2\" from=$competition.weeklyWinners.$weeklyWinnersMethod2 item=\"username\"}\r\n			{assign var=\"userValue\" value=$competition.weeklyWinners.users.$username.$weeklyWinnersMethod2}\r\n			\r\n			{if $smarty.foreach.method2.iteration gt 3 OR $userValue lte 0}{if $smarty.foreach.method2.iteration eq 1}Don\'t forget to update your progress so there will be winners next week{/if}<i>!</i>{php}break;{/php}\r\n			{elseif $smarty.foreach.method2.iteration eq 1}\r\n				<b>{$username|default:\"[ ?? ]\"|ucfirst}</b> won by \r\n				{if $weeklyWinnersMethod2 eq \'Weight Lost\'}losing <b>{$userValue}</b> pounds{elseif $weeklyWinnersMethod2 eq \'Percentage Weight Lost\'}losing <b>{$userValue|number_format:\"2\"}%</b> body weight{elseif $weeklyWinnersMethod2 eq \'Minutes Exercise\'}exercising <b>{$userValue}</b> minutes{elseif $weeklyWinnersMethod2 eq \'Distance Exercised\'}exercising a distance of <b>{$userValue}</b>{elseif $weeklyWinnersMethod2 eq \'Weight Gained\'}gaining <b>{$userValue}</b> pounds{/if}\r\n			{else}\r\n				{if $smarty.foreach.method2.iteration eq 2}, followed by <b>{$username|default:\"[ ?? ]\"|ucfirst}</b> with \r\n				{else} and <b>{$username|default:\"[ ?? ]\"|ucfirst}</b> with \r\n				{/if}\r\n				{if $weeklyWinnersMethod2 eq \'Weight Lost\'}<b>{$userValue}</b> pounds{elseif $weeklyWinnersMethod2 eq \'Percentage Weight Lost\'}<b>{$userValue|number_format:\"2\"}%</b>{elseif $weeklyWinnersMethod2 eq \'Minutes Exercise\'}<b>{$userValue}</b> minutes{elseif $weeklyWinnersMethod2 eq \'Distance Exercised\'}a distance of <b>{$userValue}</b>{elseif $weeklyWinnersMethod2 eq \'Weight Gained\'}<b>{$userValue}</b> pounds{/if}\r\n			{/if}\r\n		{/foreach}\r\n		{/strip}\r\n		</td>\r\n	{/if}\r\n	{if $weeklyWinnersMethod1}\r\n	</tr></table></div>{/if}\r\n{/if}\r\n{* ********************************************************* *}\r\n\r\n{if $acm->isDomainAdmin() and $smarty.request.debug}\r\n	{display var=$competition}\r\n{/if} \r\n\r\n{* ******************************** COMPARISON GRAPHS ***************************************** *}\r\n{if $competition.graphParameters|@count}\r\n<script type=\"text/javascript\">{literal}\r\n	function rewriteGraphLinks() {\r\n		var gLinksDiv = document.getElementById(\'graphLinksDiv\');\r\n		gLinksDiv.innerHTML = \'\';\r\n		{/literal}{foreach name=\"graphTypes\" from=$competition.graphParameters item=\"cgp\"}\r\n		gLinksDiv.innerHTML += \'<a href=\"?pg=flashgraph-frame&compId={$competition.id}&type={$cgp.name|niceText|replace:\" \":\"+\"}&esId={$cgp.estatId}&basedOn={$cgp.basedOn|replace:\" \":\"+\"}&fillPrevious={if $cgp.assumeConstantValues eq \"yes\"}1{else}0{/if}&precision={$cgp.decimalPlaces}&format=wide&userIds=\'+GUIDs+\'\" target=\"graphwindow\"><small>{$cgp.name|niceText|replace:\" \":\"&nbsp;\"}&nbsp;-&nbsp;{$cgp.basedOn|niceText|replace:\" \":\"&nbsp;\"}</small></a>{if !$smarty.foreach.graphTypes.last} | {/if}\';\r\n		{/foreach}\r\n	{literal}\r\n	}\r\n{/literal}</script>\r\n<h2 class=\"withBG\"><a name=\"graph\"></a>\r\n	<div class=\"topRight hideShow\">\r\n		<a href=\"javascript:toggle(\'graphs\', \'\', \'showHide\');\"><img id=\"graphs_img\" src=\"./img/blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a></div> \r\n	Comparison Graphs &nbsp; <small><i>No graph? <a href=\"http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash\" target=\"_blank\">click here</a> to download the free Flash Player plug-in.</i></small></h2>\r\n<div id=\"graphs\" style=\"display:block;\">\r\n	<table border=\"0\" cellpadding=\"0\" width=\"100%\">\r\n		{assign var=\"graphURL\" value=\"?pg=flashgraph-frame&format=wide\"}\r\n	<tr>\r\n		<td><div style=\"border:#999 1px solid;background-color:#FFF;padding:5px;\"><iframe \"iframe_graphwindow\" name=\"graphwindow\" src=\"{$graphURL}\" frameborder=\"0\" width=\"625\" height=\"230\" scrollbars=\"no\"></iframe></div></td>\r\n	</tr>\r\n	<tr>\r\n		<td valign=\"top\" align=\"center\" width=\"100%\">\r\n		<div id=\"graphLinksDiv\">\r\n		<small>\r\n		{foreach name=\"graphTypes\" from=$competition.availableGraphs key=\"graphType\" item=\"graphParams\"}\r\n		<a href=\"?pg=flashgraph-frame&compId={$competition.id}&{$graphParams}\');\" target=\"graphwindow\">{$graphType}</a>{if $smarty.foreach.graphTypes.iteration neq $competition.availableGraphs|@count} | {/if}\r\n		{/foreach}\r\n		</small></div></td>\r\n	</tr>\r\n	</table>\r\n	<script type=\"text/javascript\">\r\n		rewriteGraphLinks();\r\n	</script>\r\n<br />\r\n</div>\r\n{/if}\r\n\r\n{* ******************************** GROUP TEAMS/PLAYERS SUMMARY W/MOVING ***************************************** *}\r\n{if $competition.style eq \'Group-vs-Group\' or $competition.style eq \'Company-vs-Company\'}\r\n<h2 class=\"withBG\">\r\n	<div class=\"topRight hideShow\">\r\n		<a href=\"javascript:toggle(\'teams\', \'\', \'showHide\');\"><img id=\"teams_img\" src=\"./img/blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a></div> \r\n	The Teams &nbsp; <small><i>Assignments and statistics</i></small></h2>\r\n<div id=\"teams\" style=\"display:block;\">\r\n<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" border=\"0\"><tr><td>\r\n	<div align=\"right\" style=\"border-bottom:1px solid black; margin:2px; padding:2px;\">All stats based on: {$smarty.capture.scoringMethod}</div>\r\n	{if $canAssignToTeams}\r\n		<form name=\"changeTeam\" action=\"index.php\" method=\"POST\" style=\"margin:0px;\">\r\n			<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\">\r\n			<input type=\"hidden\" name=\"cid\" value=\"{$competition.id}\">\r\n			<input type=\"hidden\" name=\"no_expire\" value=\"true\">\r\n			<input type=\"hidden\" name=\"no_expire_keep_alive\" value=\"cid\">\r\n	{/if}\r\n		{assign var=\"minEx\" value=\"Minutes Exercise\"}\r\n		{assign var=\"distEx\" value=\"Distance Exercised\"}\r\n		{assign var=\"pctLst\" value=\"Percentage Weight Lost\"}\r\n		{assign var=\"wtLst\" value=\"Percentage Weight Lost\"}\r\n		{foreach from=$competition.team_data name=\"teamsLoop\" item=\"teamScore\" key=\"teamName\"}\r\n			<div id=\"playersList{$smarty.foreach.teamsLoop.iteration}\" style=\"float:left;width:310px;overflow:hidden;word-wrap:nowrap; margin:0px 5px 5px 0px;\">\r\n			{if $teamName eq \"Waiting to Join\"}<h2>Not assigned to a team</h2>{else}<h4><span style=\"font-weight:normal;\">#{$smarty.foreach.teamsLoop.iteration}) </span>{$teamName|default:\"&nbsp;\"}{/if}</h4>\r\n			<table cellpadding=\"0\" cellspacing=\"0\" style=\"width:250px; background-color:#FFC;\">\r\n			<tr>\r\n				<td class=\"thinCell\" width=\"55%\">Name</td>\r\n				<td class=\"thinCell\" width=\"25%\"><img src=\"{$skinFolder}images/trophy_ico.gif\" width=\"15\" height=\"15\" alt=\"\" /></td>\r\n				<td class=\"thinCell\" width=\"20%\">Update</span>\r\n			</tr>\r\n			{foreach from=$competition.teams.$teamName item=\"userId\"}\r\n			<tr>\r\n				<td class=\"thinCell\" style=\"text-align:left;\"><small>{if $isManager or $userId eq $user->id}<input type=\"checkbox\" name=\"changeTeam[players][{$competition.users.$userId}]\" />{/if}{$competition.users.$userId}</small>{if $competition.team_captains.$teamName eq $userId OR $userId|@in_array:$competition.teams.$teamName} <img src=\"/systems/v2_ehc/images/ehc/ico/ico_captain.gif\" />{/if}</td>\r\n				{* <span class=\"cellTiny\"><small>{if $users.hideInitialWeight neq \"Yes\"}{$users.$pctLst|number_format:\"2\"|replace:\".00\":\"\"}{else}-{/if}</small></span> *}\r\n				<td class=\"thinCell\"><small>{$competition.data.$userId.val|number_format:$competition.current_parameter.decimalPlaces}</small></td>\r\n				<td class=\"thinCell\"><small>{if $competition.data.$userId.doe}{$competition.data.$userId.doe|date_format2:\"n/j/y\"}{else}Never{/if}</small></td>\r\n			</tr>\r\n			{foreachelse}\r\n			{* No players assigned to this team. *}\r\n			<tr>\r\n				<td class=\"thinCell\">No players yet.</td>\r\n			</tr>\r\n			{/foreach}\r\n\r\n			</table>\r\n			{if $smarty.server.REMOTE_ADDR eq \'206.71.78.158\' and $competition.team_captains.$teamName eq $user->id}\r\n				<div style=\"border:1px solid #BBBBBB; padding:5px; margin:5px;\">\r\n					E-Mail your team:<br />\r\n					<textarea name=\"email_team[{$teamName}][body]\" rows=\"10\" cols=\"30\"></textarea><br />\r\n					<input type=\"submit\" name=\"email_team_submit\" value=\"Send Message\" />\r\n				</div>\r\n			{/if}\r\n			</div>\r\n		{/foreach}\r\n	{if $canAssignToTeams and $competition.style neq \'Company-vs-Company\'}\r\n		<br />\r\n		<select name=\"changeTeam[team]\">\r\n			<option value=\"\">Move selected players to...</option>\r\n			{foreach from=$competition.teams item=\"newTeams\" key=\"newTeamName\"}\r\n				{*if $newTeamName ne $teamName and $newTeamName ne \"Waiting to Join\"*}\r\n				{if $newTeamName ne \"Waiting to Join\"}\r\n					<option value=\"{$newTeamName}\">{$newTeamName}</option>\r\n				{/if}\r\n			{/foreach}\r\n		</select><br />\r\n		<input id=\"assign_captains_checkbox\" type=\"checkbox\" name=\"assignCaptains\" value=\"1\"><label for=\"assign_captains_checkbox\"> Assign selected player(s) as captain(s)</label><br />\r\n		<input type=\"submit\" class=\"button\" value=\"Submit Changes\">\r\n		</form>\r\n		<img src=\"/systems/v2_ehc/images/ehc/ico/ico_captain.gif\" /> = Team Captain\r\n	{/if}\r\n</td></tr></table>\r\n</div>\r\n{/if}\r\n</div>\r\n	{* ******************************** DISCUSSION BOARD ***************************************** *}\r\n<br />\r\n<h2 class=\"withBG\">\r\n	<div class=\"topRight hideShow\">\r\n		<a href=\"javascript:toggle(\'discuss\', \'\', \'showHide\');\"><img id=\"discuss_img\" src=\"./img/blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a></div> \r\n	Discussion Board</h2>\r\n<div id=\"discuss\" style=\"display:block;\">\r\n	<table cellpadding=\"0\" width=\"100%\" border=\"0\"><tr><td><iframe src=\"?pg=competition/forum\" id=\"discussionBoard\" frameborder=\"0\" scrolling=\"yes\" style=\"width:100%;\"></iframe></td></tr></table>\r\n</div>\r\n\r\n</div></td>\r\n</tr></table>\r\n\r\n{*\r\n<script type=\"text/javascript\">{literal}\r\n	if ( window.frames != null ) {\r\n	    for ( i = 0; i< window.frames.length; i++ )\r\n	        window.alert (\"Child window \" +i+ \" is named \"+window.frames(i).name);\r\n	}\r\n{/literal}</script>\r\n*}'),(4173,258,0.16,'php','0','Copied from Demo again for Competition stuff.',1124349921,2,'66.182.95.52','<h1><a href=\"?pg=<?php echo $SPADE[\'page\'][\'name\']; ?>\">Version 2 (V2) Conversion: Overall Step 4</a></h1>\r\n<br />\r\n\r\n<?php\r\n\r\nif (FALSE == isset($_REQUEST[\'confirm\'])) {\r\n\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=1\">Click here to proceed with the PHP conversion (step 1).</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=2\">Execute step 2.</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=3\">Execute step 3.</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=4\">Execute step 4.</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=5\">Execute step 5.</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=6\">Execute step 6 (rebuild estats from surveys taken).</a><br />\';\r\n	echo \'<br />\';\r\n	echo \'Make sure that you have executed steps 1 through 3 of the conversion process on a FRESH copy of of the old V1 EHC database.<br />\';\r\n\r\n	return;\r\n}\r\n\r\ndefine (\'LAST_STEP_NUMBER\', 6);\r\n\r\n/**\r\n * NOTES:\r\n \r\n*** Current eStats\r\n*\r\n\r\n1  weight  Your current weight  1  lifestyle  yes  2  1119738180  \r\n2  water  amount of water consumed  4  nutrition  yes  16  1119740160  \r\n3  time exercised  amount of time exercised  7  fitness  yes  16  1119740340  \r\n4  distance exercised  amount of distance exercised  9  fitness  yes  16  1119740400  \r\n5  fruits and vegetables  fruit and vegetables eaten  12  nutrition  yes  16  1119740460  \r\n6  sleep  amount of time slept at night  8  lifestyle  yes  16  1119740640  \r\n7  calorie intake  Calories eaten  18  nutrition  yes  2  1122444781  \r\n8  fat intake  Fat in all food eaten  17  nutrition  yes  2  1122444781  \r\n9  carb intake  Carbohydrates in all food eaten  17  nutrition  yes  2  1122444781  \r\n\r\n*** Current units\r\n*\r\n\r\n1  pounds  1  2  1119738422  \r\n2  kilograms  1  2  1119738444  \r\n4  glasses  1  16  1119742425  \r\n5  ounces  0  16  1119742425  \r\n7  minutes  0  16  1119742490  \r\n8  hours  2  16  1119742490  \r\n9  miles  2  16  1119742515  \r\n10  kilometers  2  16  1119742515  \r\n11  laps  1  16  1119742546  \r\n12  cups  1  16  1119742939  \r\n13  pieces  1  16  1119742953  \r\n16  steps  0  16  1119743102  \r\n17  grams  1  2  1122444589  \r\n18  calories  0  2  1122444589  \r\n\r\n */\r\n\r\necho \'<h2>PHP Conversion Step \' . (int)$_REQUEST[\'confirm\'] . \'</h2>\';\r\n\r\nswitch ((int)$_REQUEST[\'confirm\']) {\r\n// -------------------------------- USER ESTATS ---------------------------------------------\r\ncase \'1\':\r\n\r\n	echo \"Creating User eStats (determining which eStats to track) for all users.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	// Clear out table first (just in case)\r\n	$Q = \"DELETE FROM user_estats\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up all users to track weight with \'pounds\' as units\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT u.id AS \'userId\', 1 as \'estatId\', 1 AS \'unitId\', \'daily\' as \'frequency\'\r\n		FROM _users u\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up all users to track time exercised with \'minutes\' as units\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT u.id AS \'userId\', 3 as \'estatId\', 7 AS \'unitId\', \'daily\' as \'frequency\'\r\n		FROM _users u\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'distance exercised\' for users who had entries (estat 4, \'steps\' unit 16, \'miles\' unit 9)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT us.userId AS \'userId\', 4 AS \'estatId\', IF(avg(distanceExercised)>100,16,9) AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.distanceExercised > 0\r\n		GROUP BY us.userId\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'water\' for users who had entries (estat 2, \'ounces\' unit 5, \'glasses\' unit 4)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT us.userId AS \'userId\', 2 AS \'estatId\', IF(avg(water)>7,5,4) AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.water > 0\r\n		GROUP BY us.userId\";\r\n		\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'calories\' for users who had entries (estat 7, \'calories\' unit 18)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT us.userId AS \'userId\', 7 AS \'estatId\', 18 AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.calories > 0\r\n		GROUP BY us.userId\";\r\n	\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'fat\' for users who had entries (estat 8, \'grams\' unit 17)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)		\r\n		SELECT us.userId AS \'userId\', 8 AS \'estatId\', 17 AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.fat > 0\r\n		GROUP BY us.userId\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'carbs\' for users who had entries (estat 9, \'grams\' unit 17)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)		\r\n		SELECT us.userId AS \'userId\', 9 AS \'estatId\', 17 AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.carbs > 0\r\n		GROUP BY us.userId\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	break;\r\n\r\n// -------------------------------- ESTAT ENTRIES ---------------------------------------------\r\ncase \'2\':\r\n\r\n	echo \"Creating eStat Entries for all users.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	// Clear out table first (just in case)\r\n	$Q = \"DELETE FROM estat_entries\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'weight\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 1 AS \'estatId\', us.weight AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.weight > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'water\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 2 AS \'estatId\', us.water AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.water > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'time exercised\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 3 AS \'estatId\', us.minutesExercise AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.minutesExercise > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'distance exercised\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 4 AS \'estatId\', us.distanceExercised AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.distanceExercised > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'calories\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 7 AS \'estatId\', us.calories AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.calories > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'fat\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 8 AS \'estatId\', us.fat AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.fat > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'carb\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 9 AS \'estatId\', us.carbs AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.carbs > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	break;\r\n\r\n// -------------------------------- COMPANY / GROUPS ---------------------------------------------\r\ncase \'3\':\r\n\r\n	echo \"Creating groups for all companies and group memberships for all users.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	// Create groups for companies\r\n	$Q = \"SELECT id, companyName, companyVanity, userId\r\n		FROM companies\";\r\n\r\n	$companies = $SPADE[\'db\']->query($Q);\r\n\r\n	foreach ($companies as $company) {\r\n		$Q = \"INSERT INTO _groups (name, description, about, ownerId)\r\n			VALUES (\'\" . $company[\'companyVanity\'] . \"\', \r\n				\'\" . $company[\'companyName\'] . \"\', \r\n				\'Company Group Account\', \r\n				\" . (int)$company[\'userId\'] . \")\";\r\n\r\n		$companyGroupId = $SPADE[\'db\']->query($Q);\r\n\r\n		if (FALSE == $companyGroupId) {\r\n			logError (\'An error occurred while attempting to create a group for company \"\' . $company[\'companyName\'] . \'\".\');\r\n			continue;\r\n		}\r\n\r\n		// Update companies with group IDs\r\n		$Q = \"UPDATE companies \r\n			SET groupId = \" . (int)$companyGroupId . \"\r\n			WHERE id = \" . (int)$company[\'id\'];\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'An error occurred while attempting to update the company \"\' . $company[\'companyName\'] . \'\" with its new group id (\' . $companyGroupId . \').\');\r\n			continue;\r\n		}\r\n\r\n		// Create group memberships for all users\r\n		$Q = \"INSERT INTO _group_users (groupId, userId, title)\r\n			SELECT \" . (int)$companyGroupId . \" AS \'groupId\', u.id AS \'userId\', \'Employee: \" . addslashes($company[\'companyName\']) . \"\' AS \'title\'\r\n			FROM _users u\r\n			WHERE u.companyId = \" . (int)$company[\'id\'];\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'An error occurred while attempting to create group memberships for employees of \"\' . $company[\'companyName\'] . \'\". It is possible this company has no registered employees.\');\r\n			//continue;\r\n		}\r\n\r\n		// Update group_forums table with now corresponding group ID\r\n		$Q = \"UPDATE group_forums\r\n			SET groupId = \" . (int)$companyGroupId . \"\r\n			WHERE groupId = \" . (int)$company[\'id\'];\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'An error occurred while attempting to update the company forums for \"\' . $company[\'companyName\'] . \'\". It is possible this company had no registered forums.\');\r\n			//continue;\r\n		}\r\n	\r\n		echo \'SUCCESS: \' . $company[\'id\'] . \'.) \' . $company[\'companyName\'] . \' -- \' . $company[\'companyVanity\'] . \'.ehealthcompete.com<br />\';\r\n	}\r\n\r\n\r\n	break;\r\n\r\n// -------------------------------- COMPETITIONS ---------------------------------------------\r\ncase \'4\':\r\n\r\n	echo \"Converting competition data.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	$scoringMethods = array(\r\n		\'Weight Lost\' => array( \'estatId\' => 1, \'basedOn\' => \'actual change\', \'polarity\' => \'negative\' ),\r\n		\'Percentage Weight Lost\' => array( \'estatId\' => 1, \'basedOn\' => \'percent change\', \'polarity\' => \'negative\' ),\r\n		\'Minutes Exercise\' => array( \'estatId\' => 3, \'basedOn\' => \'total\', \'polarity\' => \'positive\' ),\r\n		\'Distance Exercised\' => array( \'estatId\' => 4, \'basedOn\' => \'total\', \'polarity\' => \'positive\' ),\r\n		\'Weight Gained\' => array( \'estatId\' => 1, \'basedOn\' => \'actual change\', \'polarity\' => \'positive\')\r\n	);\r\n\r\n	/**		\r\n	1  weight  Your current weight  1  lifestyle  yes  2  1119738180  \r\n	2  water  amount of water consumed  4  nutrition  yes  16  1119740160  \r\n	3  time exercised  amount of time exercised  7  fitness  yes  16  1119740340  \r\n	4  distance exercised  amount of distance exercised  9  fitness  yes  16  1119740400  \r\n	5  fruits and vegetables  fruit and vegetables eaten  12  nutrition  yes  16  1119740460  \r\n	6  sleep  amount of time slept at night  8  lifestyle  yes  16  1119740640  \r\n	7  calorie intake  Calories eaten  18  nutrition  yes  2  1122444781  \r\n	8  fat intake  Fat in all food eaten  17  nutrition  yes  2  1122444781  \r\n	9  carb intake  Carbohydrates in all food eaten  17  nutrition  yes  2  1122444781  \r\n	**/\r\n\r\n\r\n	$Q = \"SELECT * FROM competitions_old\";\r\n\r\n	$competitions = $SPADE[\'db\']->query($Q);\r\n\r\n	// Copy main competition data over...\r\n	// Done in SQL step 1.\r\n\r\n	foreach ($competitions as $comp) {\r\n		// ----- CREATE COMPETITION PARAMETERS ----- //\r\n		$currentParameters = array();\r\n		$currentParameters[] = $comp[\'scoringMethod\'];		\r\n\r\n		// Create competition parameters\r\n		$Q = \"INSERT INTO competition_parameters (competitionId, estatId, basedOn, polarity, displayOrder)\r\n			VALUES (\" . (int)$comp[\'id\'] . \",\r\n				\" . (int)$scoringMethods[$comp[\'scoringMethod\']][\'estatId\'] . \",\r\n				\'\" . $scoringMethods[$comp[\'scoringMethod\']][\'basedOn\'] . \"\',\r\n				\'\" . $scoringMethods[$comp[\'scoringMethod\']][\'polarity\'] . \"\',\r\n				0)\";\r\n\r\n		if (FALSE == ($parameterId = $SPADE[\'db\']->query($Q))) {\r\n			logError (\'Unable to create (primary) competition parameter for competition ID \' . $comp[\'id\'] . \'.\');\r\n			continue;\r\n		}\r\n\r\n		// Add parameter \r\n		if ($comp[\'tieBreakerMethod\'] && !in_array($comp[\'tieBreakerMethod\'], $currentParameters)) {\r\n			$currentParameters[] = $comp[\'tieBreakerMethod\'];\r\n\r\n			$Q = \"INSERT INTO competition_parameters (competitionId, estatId, basedOn, polarity, displayOrder)\r\n				VALUES (\" . (int)$comp[\'id\'] . \",\r\n					\" . (int)$scoringMethods[$comp[\'tieBreakerMethod\']][\'estatId\'] . \",\r\n					\'\" . $scoringMethods[$comp[\'tieBreakerMethod\']][\'basedOn\'] . \"\',\r\n					\'\" . $scoringMethods[$comp[\'tieBreakerMethod\']][\'polarity\'] . \"\',\r\n					1)\";\r\n	\r\n			if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n				logError (\'Unable to create (primary) competition parameter for competition ID \' . $comp[\'id\'] . \'.\');\r\n				continue;\r\n			}\r\n		}\r\n\r\n		if ($comp[\'weeklyWinnersMethod1\'] && !in_array($comp[\'weeklyWinnersMethod1\'], $currentParameters)) {\r\n			$currentParameters[] = $comp[\'weeklyWinnersMethod1\'];\r\n\r\n			$Q = \"INSERT INTO competition_parameters (competitionId, estatId, basedOn, polarity, displayOrder)\r\n				VALUES (\" . (int)$comp[\'id\'] . \",\r\n					\" . (int)$scoringMethods[$comp[\'weeklyWinnersMethod1\']][\'estatId\'] . \",\r\n					\'\" . $scoringMethods[$comp[\'weeklyWinnersMethod1\']][\'basedOn\'] . \"\',\r\n					\'\" . $scoringMethods[$comp[\'weeklyWinnersMethod1\']][\'polarity\'] . \"\',\r\n					2)\";\r\n	\r\n			if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n				logError (\'Unable to create (primary) competition parameter for competition ID \' . $comp[\'id\'] . \'.\');\r\n				continue;\r\n			}\r\n		}\r\n\r\n		if ($comp[\'weeklyWinnersMethod2\'] && !in_array($comp[\'weeklyWinnersMethod2\'], $currentParameters)) {\r\n			$currentParameters[] = $comp[\'weeklyWinnersMethod2\'];\r\n\r\n			$Q = \"INSERT INTO competition_parameters (competitionId, estatId, basedOn, polarity, displayOrder)\r\n				VALUES (\" . (int)$comp[\'id\'] . \",\r\n					\" . (int)$scoringMethods[$comp[\'weeklyWinnersMethod2\']][\'estatId\'] . \",\r\n					\'\" . $scoringMethods[$comp[\'weeklyWinnersMethod2\']][\'basedOn\'] . \"\',\r\n					\'\" . $scoringMethods[$comp[\'weeklyWinnersMethod2\']][\'polarity\'] . \"\',\r\n					3)\";\r\n	\r\n			if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n				logError (\'Unable to create (primary) competition parameter for competition ID \' . $comp[\'id\'] . \'.\');\r\n				continue;\r\n			}\r\n		}\r\n\r\n\r\n		// ----- CREATE COMPETITION PRIZES ----- //\r\n		$Q = \"INSERT INTO competition_prizes (\r\n				competitionId, title, description, maxWinners, \r\n				frequency, andOr, dateStart, dateEnd )\r\n			VALUES (\" . (int)$comp[\'id\'] . \",\r\n				\'Competition Prize\',\r\n				\'\" . addslashes($comp[\'potDescription\']) . \"\',\r\n				1,\r\n				\'once\',\r\n				\'and\',\r\n				\" . (int)$comp[\'startDate\'] . \",\r\n				\" . (int)$comp[\'endDate\'] . \")\";\r\n\r\n		if (FALSE == ($prizeId = $SPADE[\'db\']->query($Q))) {\r\n			logError (\'Unable to create a competition prize for competition ID \' . (int)$comp[\'id\'] . \'.\');\r\n			continue;\r\n		}\r\n\r\n		\r\n		// ----- CREATE COMPETITION PRIZE PARAMETERS ----- //\r\n		$Q = \"INSERT INTO competition_prize_parameters (\r\n				competitionPrizeId, competitionParameterId)\r\n			VALUES (\" . (int)$prizeId . \",\r\n				\" . (int)$parameterId . \")\";\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'Unable to create a competition prize parameter for competition ID \' . (int)$comp[\'id\'] . \'.\');\r\n			continue;\r\n		}\r\n	}\r\n\r\n	// ----- CREATE INVOICES ----- //\r\n	$Q = \"SELECT cp.userId, u.firstName, u.lastName, c.companyName, u.address1, u.address2,\r\n			u.city, u.state, u.country, u.zip, u.phone1, u.email,\r\n			cp.amount, cp.dateDonated, cp.paymentMethod, cp.entryFee,\r\n			cp.compId, comp.title\r\n		FROM competition_pot cp\r\n		INNER JOIN _users u ON (cp.userId = u.id)\r\n		LEFT JOIN competitions comp ON (cp.compId = comp.id)\r\n		LEFT JOIN companies c ON (u.companyId = c.id)\";\r\n\r\n	$paymentDetails = $SPADE[\'db\']->query($Q);\r\n\r\n	// Continue if no entry fees were paid\r\n	if (FALSE == is_array($paymentDetails) || 0 == sizeof($paymentDetails)) {\r\n		continue;\r\n	}\r\n\r\n	foreach ($paymentDetails as $payment) {\r\n		$Q = \"INSERT INTO invoices (\r\n				userId, firstName, lastName, company,\r\n				address1, address2, city, state, country, zip, phone, email,\r\n				dateDue, amountDue)\r\n			VALUES (\r\n				\" . (int)$payment[\'userId\'] . \",\r\n				\'\" . addslashes($payment[\'firstName\']) . \"\',\r\n				\'\" . addslashes($payment[\'lastName\']) . \"\',\r\n				\'\" . addslashes($payment[\'companyName\']) . \"\',\r\n				\'\" . addslashes($payment[\'address1\']) . \"\',\r\n				\'\" . addslashes($payment[\'address2\']) . \"\',\r\n				\'\" . addslashes($payment[\'city\']) . \"\',\r\n				\'\" . addslashes($payment[\'state\']) . \"\',\r\n				\'\" . addslashes($payment[\'country\']) . \"\', \r\n				\'\" . $payment[\'zip\'] . \"\',\r\n				\'\" . $payment[\'phone1\'] . \"\',\r\n				\'\" . addslashes($payment[\'email\']) . \"\',\r\n				\" . (int)$payment[\'dateDonated\'] . \",\r\n				\'\" . $payment[\'entryFee\'] . \"\')\";\r\n\r\n		if (FALSE == ($invoiceId = $SPADE[\'db\']->query($Q))) {\r\n			logError (\'Could not create an invoice for competition payment for comp ID \' . $payment[\'compId\'] . \' for \' . $payment[\'firstName\'] . \' \' . $payment[\'lastName\'] . \'.\');\r\n			continue;\r\n		}\r\n\r\n		$Q = \"INSERT INTO competition_entry_fees (\r\n				competitionId, userId, amount, invoiceId)\r\n			VALUES (\r\n				\'\" . $payment[\'compId\'] . \"\',\r\n				\" . (int)$payment[\'userId\'] . \",\r\n				\'\" . $payment[\'amount\'] . \"\',\r\n				\" . (int)$invoiceId . \")\";\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'Unable to save the competition entry fee for comp ID \' . $payment[\'compId\'] . \' for \' . $payment[\'firstName\'] . \' \' . $payment[\'lastName\'] . \'.\');\r\n			continue;\r\n		}\r\n\r\n		$Q = \"INSERT INTO invoice_line_items (\r\n				invoiceNumber, description, price, quantity)\r\n			VALUES (\r\n				\" . (int)$invoiceId . \",\r\n				\'Competition entry fee, competition #\" . $payment[\'compId\'] . \"\',\r\n				\'\" . $payment[\'entryFee\'] . \"\', \r\n				1)\";\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'Could not create an invoice line item for comp ID \' . $payment[\'compId\'] . \' for \' . $payment[\'firstName\'] . \' \' . $payment[\'lastName\'] . \'.\');\r\n		}\r\n\r\n		$Q = \"INSERT INTO invoice_payments (\r\n				invoiceNumber, dateOfPayment, amountPaid, paymentMethod)\r\n			VALUES (\r\n				\" . (int)$invoiceId . \",\r\n				\" . (int)$payment[\'dateDonated\'] . \",\r\n				\'\" . $payment[\'amount\'] . \"\',\r\n				\'\" . $payment[\'paymentMethod\'] . \"\')\";\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'Could not create an invoice payment for comp ID \' . $payment[\'compId\'] . \' for \' . $payment[\'firstName\' ] . \' \' . $payment[\'lastName\'] . \'.\');\r\n			continue;\r\n		}\r\n	}\r\n\r\n	break;\r\n\r\n// -------------------------------- FIX ESTAT ENTRIES FOR NON-STANDARD UNITS ---------------------------------------------\r\ncase \'5\':\r\n\r\n	echo \"Converting eStats for non-standard units.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	// Get userId\'s of users who have non-standard units (ounces = unitId 5) for water entries.\r\n	$Q = \"SELECT u.id\r\n		FROM user_estats ue\r\n		INNER JOIN _users u ON (ue.userId = u.id)\r\n		WHERE ue.estatId = 2\r\n		AND ue.unitId = 5\";\r\n\r\n	$userIds = $SPADE[\'db\']->query($Q, DB_LIST);\r\n	$userIds = implode(\',\', $userIds);\r\n\r\n	$Q = \"UPDATE estat_entries \r\n		SET value = (value * 0.125)\r\n		WHERE estatId = 2\r\n		AND userId IN (\" . $userIds . \")\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError (\'An error occurred while attempting to update and convert water entries from ounces to glasses.\');\r\n		break;\r\n	}\r\n\r\n	// Get userId\'s of users who have non-standard units (steps = unitId 16) for distance exercised entries.\r\n	$Q = \"SELECT u.id\r\n		FROM user_estats ue\r\n		INNER JOIN _users u ON (ue.userId = u.id)\r\n		WHERE ue.estatId = 4\r\n		AND ue.unitId = 16\";\r\n\r\n	$userIds = $SPADE[\'db\']->query($Q, DB_LIST);\r\n	$userIds = implode(\',\', $userIds);\r\n\r\n	$Q = \"UPDATE estat_entries \r\n		SET value = (value * 0.0005)\r\n		WHERE estatId = 4\r\n		AND userId IN (\" . $userIds . \")\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError (\'An error occurred while attempting to update and convert distance exercised entries from steps to miles.\');\r\n		break;\r\n	}\r\n\r\n\r\n	break;\r\n\r\n// -------------------------------- CORRECT / REBUILD estat_entries FROM company_survey_estats ---------------------------------------------\r\ncase \'6\':\r\n\r\n	echo \"Rebuilding estat_entries from company_survey_estats<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	$Q = \"SELECT *\r\n		FROM company_survey_estats\";\r\n\r\n	$companySurveyEstats = $SPADE[\'db\']->query($Q);\r\n\r\n	foreach ($companySurveyEstats as $cse) {\r\n\r\n		$whereAddition = \'\';\r\n\r\n		if ($cse[\'dateStart\']) {\r\n			$whereAddition .= \' AND st.dateTaken > \' . $cse[\'dateStart\'];\r\n		}\r\n\r\n		if ($cse[\'dateEnd\']) {\r\n			$whereAddition .= \' AND st.dateTaken < \' . $cse[\'dateEnd\'];\r\n		}\r\n\r\n		$Q = \"SELECT ee.id\r\n			FROM surveys_taken st\r\n			INNER JOIN surveys s ON (st.surveyId = s.id)\r\n			INNER JOIN estat_entries ee ON (ee.userId = st.userId AND ee.estatId = \" . $cse[\'estatId\'] . \" AND ee.dateOfEntry = st.dateTaken)\r\n			WHERE s.id = \" . $cse[\'surveyId\'] . \"\r\n			AND s.companyId = \" . $cse[\'companyId\'] . $whereAddition;\r\n		\r\n		display($Q);\r\n\r\n		$entryIds = trim(implode(\',\', $SPADE[\'db\']->query($Q, DB_LIST)));\r\n\r\n		if ($entryIds) {\r\n			$Q = \"DELETE FROM estat_entries WHERE id IN (\" . $entryIds . \")\";\r\n	\r\n			display($Q);\r\n	\r\n			$SPADE[\'db\']->query($Q);\r\n		}\r\n\r\n		//$Q = \"SELECT st.*\r\n		$Q = \"SELECT st.surveyId, count(*)\r\n			FROM surveys_taken st\r\n			LEFT JOIN surveys s ON (st.surveyId = s.id)\r\n			WHERE s.id = \" . $cse[\'surveyId\'] . \"\r\n			AND s.companyId = \" . $cse[\'companyId\'] . $whereAddition;\r\n\r\n		$surveysTaken = $SPADE[\'db\']->query($Q);\r\n\r\n		display($surveysTaken);\r\n		continue;\r\n\r\n		if (is_array($surveysTaken) AND 0 < sizeof($surveysTaken)) {\r\n			foreach ($surveysTaken as $st) {\r\n				$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n					VALUES (\r\n						\" . $st[\'userId\'] . \",\r\n						\" . $cse[\'estatId\'] . \",\r\n						\" . $st[\'pointsEarned\'] . \",\r\n						\" . $st[\'dateTaken\'] . \",\r\n						\" . $SPADE[\'user\']->id . \",\r\n						\" . time() . \")\";\r\n\r\n				display($Q);\r\n\r\n				$SPADE[\'db\']->query($Q);\r\n			}\r\n		}\r\n	}\r\n\r\n\r\n\r\n	break;\r\n\r\ndefault:\r\n	logError( \'Unknown confirm step number: \' . $_REQUEST[\'confirm\'] );\r\n	return;\r\n}\r\n\r\n\r\nif ($_REQUEST[\'confirm\'] <= LAST_STEP_NUMBER) {\r\n	echo \'<br /><br /><a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=\' . ((int)$_REQUEST[\'confirm\'] + 1) . \'\">Execute the next step of the PHP conversion process.</a>\';\r\n}\r\n\r\n\r\n?>'),(4174,258,0.17,'php','0','Copied from Demo again for Competition stuff.',1124349975,2,'66.182.95.52','<h1><a href=\"?pg=<?php echo $SPADE[\'page\'][\'name\']; ?>\">Version 2 (V2) Conversion: Overall Step 4</a></h1>\r\n<br />\r\n\r\n<?php\r\n\r\nif (FALSE == isset($_REQUEST[\'confirm\'])) {\r\n\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=1\">Click here to proceed with the PHP conversion (step 1).</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=2\">Execute step 2.</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=3\">Execute step 3.</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=4\">Execute step 4.</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=5\">Execute step 5.</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=6\">Execute step 6 (rebuild estats from surveys taken).</a><br />\';\r\n	echo \'<br />\';\r\n	echo \'Make sure that you have executed steps 1 through 3 of the conversion process on a FRESH copy of of the old V1 EHC database.<br />\';\r\n\r\n	return;\r\n}\r\n\r\ndefine (\'LAST_STEP_NUMBER\', 6);\r\n\r\n/**\r\n * NOTES:\r\n \r\n*** Current eStats\r\n*\r\n\r\n1  weight  Your current weight  1  lifestyle  yes  2  1119738180  \r\n2  water  amount of water consumed  4  nutrition  yes  16  1119740160  \r\n3  time exercised  amount of time exercised  7  fitness  yes  16  1119740340  \r\n4  distance exercised  amount of distance exercised  9  fitness  yes  16  1119740400  \r\n5  fruits and vegetables  fruit and vegetables eaten  12  nutrition  yes  16  1119740460  \r\n6  sleep  amount of time slept at night  8  lifestyle  yes  16  1119740640  \r\n7  calorie intake  Calories eaten  18  nutrition  yes  2  1122444781  \r\n8  fat intake  Fat in all food eaten  17  nutrition  yes  2  1122444781  \r\n9  carb intake  Carbohydrates in all food eaten  17  nutrition  yes  2  1122444781  \r\n\r\n*** Current units\r\n*\r\n\r\n1  pounds  1  2  1119738422  \r\n2  kilograms  1  2  1119738444  \r\n4  glasses  1  16  1119742425  \r\n5  ounces  0  16  1119742425  \r\n7  minutes  0  16  1119742490  \r\n8  hours  2  16  1119742490  \r\n9  miles  2  16  1119742515  \r\n10  kilometers  2  16  1119742515  \r\n11  laps  1  16  1119742546  \r\n12  cups  1  16  1119742939  \r\n13  pieces  1  16  1119742953  \r\n16  steps  0  16  1119743102  \r\n17  grams  1  2  1122444589  \r\n18  calories  0  2  1122444589  \r\n\r\n */\r\n\r\necho \'<h2>PHP Conversion Step \' . (int)$_REQUEST[\'confirm\'] . \'</h2>\';\r\n\r\nswitch ((int)$_REQUEST[\'confirm\']) {\r\n// -------------------------------- USER ESTATS ---------------------------------------------\r\ncase \'1\':\r\n\r\n	echo \"Creating User eStats (determining which eStats to track) for all users.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	// Clear out table first (just in case)\r\n	$Q = \"DELETE FROM user_estats\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up all users to track weight with \'pounds\' as units\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT u.id AS \'userId\', 1 as \'estatId\', 1 AS \'unitId\', \'daily\' as \'frequency\'\r\n		FROM _users u\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up all users to track time exercised with \'minutes\' as units\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT u.id AS \'userId\', 3 as \'estatId\', 7 AS \'unitId\', \'daily\' as \'frequency\'\r\n		FROM _users u\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'distance exercised\' for users who had entries (estat 4, \'steps\' unit 16, \'miles\' unit 9)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT us.userId AS \'userId\', 4 AS \'estatId\', IF(avg(distanceExercised)>100,16,9) AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.distanceExercised > 0\r\n		GROUP BY us.userId\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'water\' for users who had entries (estat 2, \'ounces\' unit 5, \'glasses\' unit 4)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT us.userId AS \'userId\', 2 AS \'estatId\', IF(avg(water)>7,5,4) AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.water > 0\r\n		GROUP BY us.userId\";\r\n		\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'calories\' for users who had entries (estat 7, \'calories\' unit 18)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT us.userId AS \'userId\', 7 AS \'estatId\', 18 AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.calories > 0\r\n		GROUP BY us.userId\";\r\n	\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'fat\' for users who had entries (estat 8, \'grams\' unit 17)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)		\r\n		SELECT us.userId AS \'userId\', 8 AS \'estatId\', 17 AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.fat > 0\r\n		GROUP BY us.userId\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'carbs\' for users who had entries (estat 9, \'grams\' unit 17)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)		\r\n		SELECT us.userId AS \'userId\', 9 AS \'estatId\', 17 AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.carbs > 0\r\n		GROUP BY us.userId\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	break;\r\n\r\n// -------------------------------- ESTAT ENTRIES ---------------------------------------------\r\ncase \'2\':\r\n\r\n	echo \"Creating eStat Entries for all users.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	// Clear out table first (just in case)\r\n	$Q = \"DELETE FROM estat_entries\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'weight\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 1 AS \'estatId\', us.weight AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.weight > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'water\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 2 AS \'estatId\', us.water AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.water > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'time exercised\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 3 AS \'estatId\', us.minutesExercise AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.minutesExercise > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'distance exercised\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 4 AS \'estatId\', us.distanceExercised AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.distanceExercised > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'calories\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 7 AS \'estatId\', us.calories AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.calories > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'fat\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 8 AS \'estatId\', us.fat AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.fat > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'carb\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 9 AS \'estatId\', us.carbs AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.carbs > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	break;\r\n\r\n// -------------------------------- COMPANY / GROUPS ---------------------------------------------\r\ncase \'3\':\r\n\r\n	echo \"Creating groups for all companies and group memberships for all users.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	// Create groups for companies\r\n	$Q = \"SELECT id, companyName, companyVanity, userId\r\n		FROM companies\";\r\n\r\n	$companies = $SPADE[\'db\']->query($Q);\r\n\r\n	foreach ($companies as $company) {\r\n		$Q = \"INSERT INTO _groups (name, description, about, ownerId)\r\n			VALUES (\'\" . $company[\'companyVanity\'] . \"\', \r\n				\'\" . $company[\'companyName\'] . \"\', \r\n				\'Company Group Account\', \r\n				\" . (int)$company[\'userId\'] . \")\";\r\n\r\n		$companyGroupId = $SPADE[\'db\']->query($Q);\r\n\r\n		if (FALSE == $companyGroupId) {\r\n			logError (\'An error occurred while attempting to create a group for company \"\' . $company[\'companyName\'] . \'\".\');\r\n			continue;\r\n		}\r\n\r\n		// Update companies with group IDs\r\n		$Q = \"UPDATE companies \r\n			SET groupId = \" . (int)$companyGroupId . \"\r\n			WHERE id = \" . (int)$company[\'id\'];\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'An error occurred while attempting to update the company \"\' . $company[\'companyName\'] . \'\" with its new group id (\' . $companyGroupId . \').\');\r\n			continue;\r\n		}\r\n\r\n		// Create group memberships for all users\r\n		$Q = \"INSERT INTO _group_users (groupId, userId, title)\r\n			SELECT \" . (int)$companyGroupId . \" AS \'groupId\', u.id AS \'userId\', \'Employee: \" . addslashes($company[\'companyName\']) . \"\' AS \'title\'\r\n			FROM _users u\r\n			WHERE u.companyId = \" . (int)$company[\'id\'];\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'An error occurred while attempting to create group memberships for employees of \"\' . $company[\'companyName\'] . \'\". It is possible this company has no registered employees.\');\r\n			//continue;\r\n		}\r\n\r\n		// Update group_forums table with now corresponding group ID\r\n		$Q = \"UPDATE group_forums\r\n			SET groupId = \" . (int)$companyGroupId . \"\r\n			WHERE groupId = \" . (int)$company[\'id\'];\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'An error occurred while attempting to update the company forums for \"\' . $company[\'companyName\'] . \'\". It is possible this company had no registered forums.\');\r\n			//continue;\r\n		}\r\n	\r\n		echo \'SUCCESS: \' . $company[\'id\'] . \'.) \' . $company[\'companyName\'] . \' -- \' . $company[\'companyVanity\'] . \'.ehealthcompete.com<br />\';\r\n	}\r\n\r\n\r\n	break;\r\n\r\n// -------------------------------- COMPETITIONS ---------------------------------------------\r\ncase \'4\':\r\n\r\n	echo \"Converting competition data.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	$scoringMethods = array(\r\n		\'Weight Lost\' => array( \'estatId\' => 1, \'basedOn\' => \'actual change\', \'polarity\' => \'negative\' ),\r\n		\'Percentage Weight Lost\' => array( \'estatId\' => 1, \'basedOn\' => \'percent change\', \'polarity\' => \'negative\' ),\r\n		\'Minutes Exercise\' => array( \'estatId\' => 3, \'basedOn\' => \'total\', \'polarity\' => \'positive\' ),\r\n		\'Distance Exercised\' => array( \'estatId\' => 4, \'basedOn\' => \'total\', \'polarity\' => \'positive\' ),\r\n		\'Weight Gained\' => array( \'estatId\' => 1, \'basedOn\' => \'actual change\', \'polarity\' => \'positive\')\r\n	);\r\n\r\n	/**		\r\n	1  weight  Your current weight  1  lifestyle  yes  2  1119738180  \r\n	2  water  amount of water consumed  4  nutrition  yes  16  1119740160  \r\n	3  time exercised  amount of time exercised  7  fitness  yes  16  1119740340  \r\n	4  distance exercised  amount of distance exercised  9  fitness  yes  16  1119740400  \r\n	5  fruits and vegetables  fruit and vegetables eaten  12  nutrition  yes  16  1119740460  \r\n	6  sleep  amount of time slept at night  8  lifestyle  yes  16  1119740640  \r\n	7  calorie intake  Calories eaten  18  nutrition  yes  2  1122444781  \r\n	8  fat intake  Fat in all food eaten  17  nutrition  yes  2  1122444781  \r\n	9  carb intake  Carbohydrates in all food eaten  17  nutrition  yes  2  1122444781  \r\n	**/\r\n\r\n\r\n	$Q = \"SELECT * FROM competitions_old\";\r\n\r\n	$competitions = $SPADE[\'db\']->query($Q);\r\n\r\n	// Copy main competition data over...\r\n	// Done in SQL step 1.\r\n\r\n	foreach ($competitions as $comp) {\r\n		// ----- CREATE COMPETITION PARAMETERS ----- //\r\n		$currentParameters = array();\r\n		$currentParameters[] = $comp[\'scoringMethod\'];		\r\n\r\n		// Create competition parameters\r\n		$Q = \"INSERT INTO competition_parameters (competitionId, estatId, basedOn, polarity, displayOrder)\r\n			VALUES (\" . (int)$comp[\'id\'] . \",\r\n				\" . (int)$scoringMethods[$comp[\'scoringMethod\']][\'estatId\'] . \",\r\n				\'\" . $scoringMethods[$comp[\'scoringMethod\']][\'basedOn\'] . \"\',\r\n				\'\" . $scoringMethods[$comp[\'scoringMethod\']][\'polarity\'] . \"\',\r\n				0)\";\r\n\r\n		if (FALSE == ($parameterId = $SPADE[\'db\']->query($Q))) {\r\n			logError (\'Unable to create (primary) competition parameter for competition ID \' . $comp[\'id\'] . \'.\');\r\n			continue;\r\n		}\r\n\r\n		// Add parameter \r\n		if ($comp[\'tieBreakerMethod\'] && !in_array($comp[\'tieBreakerMethod\'], $currentParameters)) {\r\n			$currentParameters[] = $comp[\'tieBreakerMethod\'];\r\n\r\n			$Q = \"INSERT INTO competition_parameters (competitionId, estatId, basedOn, polarity, displayOrder)\r\n				VALUES (\" . (int)$comp[\'id\'] . \",\r\n					\" . (int)$scoringMethods[$comp[\'tieBreakerMethod\']][\'estatId\'] . \",\r\n					\'\" . $scoringMethods[$comp[\'tieBreakerMethod\']][\'basedOn\'] . \"\',\r\n					\'\" . $scoringMethods[$comp[\'tieBreakerMethod\']][\'polarity\'] . \"\',\r\n					1)\";\r\n	\r\n			if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n				logError (\'Unable to create (primary) competition parameter for competition ID \' . $comp[\'id\'] . \'.\');\r\n				continue;\r\n			}\r\n		}\r\n\r\n		if ($comp[\'weeklyWinnersMethod1\'] && !in_array($comp[\'weeklyWinnersMethod1\'], $currentParameters)) {\r\n			$currentParameters[] = $comp[\'weeklyWinnersMethod1\'];\r\n\r\n			$Q = \"INSERT INTO competition_parameters (competitionId, estatId, basedOn, polarity, displayOrder)\r\n				VALUES (\" . (int)$comp[\'id\'] . \",\r\n					\" . (int)$scoringMethods[$comp[\'weeklyWinnersMethod1\']][\'estatId\'] . \",\r\n					\'\" . $scoringMethods[$comp[\'weeklyWinnersMethod1\']][\'basedOn\'] . \"\',\r\n					\'\" . $scoringMethods[$comp[\'weeklyWinnersMethod1\']][\'polarity\'] . \"\',\r\n					2)\";\r\n	\r\n			if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n				logError (\'Unable to create (primary) competition parameter for competition ID \' . $comp[\'id\'] . \'.\');\r\n				continue;\r\n			}\r\n		}\r\n\r\n		if ($comp[\'weeklyWinnersMethod2\'] && !in_array($comp[\'weeklyWinnersMethod2\'], $currentParameters)) {\r\n			$currentParameters[] = $comp[\'weeklyWinnersMethod2\'];\r\n\r\n			$Q = \"INSERT INTO competition_parameters (competitionId, estatId, basedOn, polarity, displayOrder)\r\n				VALUES (\" . (int)$comp[\'id\'] . \",\r\n					\" . (int)$scoringMethods[$comp[\'weeklyWinnersMethod2\']][\'estatId\'] . \",\r\n					\'\" . $scoringMethods[$comp[\'weeklyWinnersMethod2\']][\'basedOn\'] . \"\',\r\n					\'\" . $scoringMethods[$comp[\'weeklyWinnersMethod2\']][\'polarity\'] . \"\',\r\n					3)\";\r\n	\r\n			if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n				logError (\'Unable to create (primary) competition parameter for competition ID \' . $comp[\'id\'] . \'.\');\r\n				continue;\r\n			}\r\n		}\r\n\r\n\r\n		// ----- CREATE COMPETITION PRIZES ----- //\r\n		$Q = \"INSERT INTO competition_prizes (\r\n				competitionId, title, description, maxWinners, \r\n				frequency, andOr, dateStart, dateEnd )\r\n			VALUES (\" . (int)$comp[\'id\'] . \",\r\n				\'Competition Prize\',\r\n				\'\" . addslashes($comp[\'potDescription\']) . \"\',\r\n				1,\r\n				\'once\',\r\n				\'and\',\r\n				\" . (int)$comp[\'startDate\'] . \",\r\n				\" . (int)$comp[\'endDate\'] . \")\";\r\n\r\n		if (FALSE == ($prizeId = $SPADE[\'db\']->query($Q))) {\r\n			logError (\'Unable to create a competition prize for competition ID \' . (int)$comp[\'id\'] . \'.\');\r\n			continue;\r\n		}\r\n\r\n		\r\n		// ----- CREATE COMPETITION PRIZE PARAMETERS ----- //\r\n		$Q = \"INSERT INTO competition_prize_parameters (\r\n				competitionPrizeId, competitionParameterId)\r\n			VALUES (\" . (int)$prizeId . \",\r\n				\" . (int)$parameterId . \")\";\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'Unable to create a competition prize parameter for competition ID \' . (int)$comp[\'id\'] . \'.\');\r\n			continue;\r\n		}\r\n	}\r\n\r\n	// ----- CREATE INVOICES ----- //\r\n	$Q = \"SELECT cp.userId, u.firstName, u.lastName, c.companyName, u.address1, u.address2,\r\n			u.city, u.state, u.country, u.zip, u.phone1, u.email,\r\n			cp.amount, cp.dateDonated, cp.paymentMethod, cp.entryFee,\r\n			cp.compId, comp.title\r\n		FROM competition_pot cp\r\n		INNER JOIN _users u ON (cp.userId = u.id)\r\n		LEFT JOIN competitions comp ON (cp.compId = comp.id)\r\n		LEFT JOIN companies c ON (u.companyId = c.id)\";\r\n\r\n	$paymentDetails = $SPADE[\'db\']->query($Q);\r\n\r\n	// Continue if no entry fees were paid\r\n	if (FALSE == is_array($paymentDetails) || 0 == sizeof($paymentDetails)) {\r\n		continue;\r\n	}\r\n\r\n	foreach ($paymentDetails as $payment) {\r\n		$Q = \"INSERT INTO invoices (\r\n				userId, firstName, lastName, company,\r\n				address1, address2, city, state, country, zip, phone, email,\r\n				dateDue, amountDue)\r\n			VALUES (\r\n				\" . (int)$payment[\'userId\'] . \",\r\n				\'\" . addslashes($payment[\'firstName\']) . \"\',\r\n				\'\" . addslashes($payment[\'lastName\']) . \"\',\r\n				\'\" . addslashes($payment[\'companyName\']) . \"\',\r\n				\'\" . addslashes($payment[\'address1\']) . \"\',\r\n				\'\" . addslashes($payment[\'address2\']) . \"\',\r\n				\'\" . addslashes($payment[\'city\']) . \"\',\r\n				\'\" . addslashes($payment[\'state\']) . \"\',\r\n				\'\" . addslashes($payment[\'country\']) . \"\', \r\n				\'\" . $payment[\'zip\'] . \"\',\r\n				\'\" . $payment[\'phone1\'] . \"\',\r\n				\'\" . addslashes($payment[\'email\']) . \"\',\r\n				\" . (int)$payment[\'dateDonated\'] . \",\r\n				\'\" . $payment[\'entryFee\'] . \"\')\";\r\n\r\n		if (FALSE == ($invoiceId = $SPADE[\'db\']->query($Q))) {\r\n			logError (\'Could not create an invoice for competition payment for comp ID \' . $payment[\'compId\'] . \' for \' . $payment[\'firstName\'] . \' \' . $payment[\'lastName\'] . \'.\');\r\n			continue;\r\n		}\r\n\r\n		$Q = \"INSERT INTO competition_entry_fees (\r\n				competitionId, userId, amount, invoiceId)\r\n			VALUES (\r\n				\'\" . $payment[\'compId\'] . \"\',\r\n				\" . (int)$payment[\'userId\'] . \",\r\n				\'\" . $payment[\'amount\'] . \"\',\r\n				\" . (int)$invoiceId . \")\";\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'Unable to save the competition entry fee for comp ID \' . $payment[\'compId\'] . \' for \' . $payment[\'firstName\'] . \' \' . $payment[\'lastName\'] . \'.\');\r\n			continue;\r\n		}\r\n\r\n		$Q = \"INSERT INTO invoice_line_items (\r\n				invoiceNumber, description, price, quantity)\r\n			VALUES (\r\n				\" . (int)$invoiceId . \",\r\n				\'Competition entry fee, competition #\" . $payment[\'compId\'] . \"\',\r\n				\'\" . $payment[\'entryFee\'] . \"\', \r\n				1)\";\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'Could not create an invoice line item for comp ID \' . $payment[\'compId\'] . \' for \' . $payment[\'firstName\'] . \' \' . $payment[\'lastName\'] . \'.\');\r\n		}\r\n\r\n		$Q = \"INSERT INTO invoice_payments (\r\n				invoiceNumber, dateOfPayment, amountPaid, paymentMethod)\r\n			VALUES (\r\n				\" . (int)$invoiceId . \",\r\n				\" . (int)$payment[\'dateDonated\'] . \",\r\n				\'\" . $payment[\'amount\'] . \"\',\r\n				\'\" . $payment[\'paymentMethod\'] . \"\')\";\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'Could not create an invoice payment for comp ID \' . $payment[\'compId\'] . \' for \' . $payment[\'firstName\' ] . \' \' . $payment[\'lastName\'] . \'.\');\r\n			continue;\r\n		}\r\n	}\r\n\r\n	break;\r\n\r\n// -------------------------------- FIX ESTAT ENTRIES FOR NON-STANDARD UNITS ---------------------------------------------\r\ncase \'5\':\r\n\r\n	echo \"Converting eStats for non-standard units.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	// Get userId\'s of users who have non-standard units (ounces = unitId 5) for water entries.\r\n	$Q = \"SELECT u.id\r\n		FROM user_estats ue\r\n		INNER JOIN _users u ON (ue.userId = u.id)\r\n		WHERE ue.estatId = 2\r\n		AND ue.unitId = 5\";\r\n\r\n	$userIds = $SPADE[\'db\']->query($Q, DB_LIST);\r\n	$userIds = implode(\',\', $userIds);\r\n\r\n	$Q = \"UPDATE estat_entries \r\n		SET value = (value * 0.125)\r\n		WHERE estatId = 2\r\n		AND userId IN (\" . $userIds . \")\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError (\'An error occurred while attempting to update and convert water entries from ounces to glasses.\');\r\n		break;\r\n	}\r\n\r\n	// Get userId\'s of users who have non-standard units (steps = unitId 16) for distance exercised entries.\r\n	$Q = \"SELECT u.id\r\n		FROM user_estats ue\r\n		INNER JOIN _users u ON (ue.userId = u.id)\r\n		WHERE ue.estatId = 4\r\n		AND ue.unitId = 16\";\r\n\r\n	$userIds = $SPADE[\'db\']->query($Q, DB_LIST);\r\n	$userIds = implode(\',\', $userIds);\r\n\r\n	$Q = \"UPDATE estat_entries \r\n		SET value = (value * 0.0005)\r\n		WHERE estatId = 4\r\n		AND userId IN (\" . $userIds . \")\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError (\'An error occurred while attempting to update and convert distance exercised entries from steps to miles.\');\r\n		break;\r\n	}\r\n\r\n\r\n	break;\r\n\r\n// -------------------------------- CORRECT / REBUILD estat_entries FROM company_survey_estats ---------------------------------------------\r\ncase \'6\':\r\n\r\n	echo \"Rebuilding estat_entries from company_survey_estats<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	$Q = \"SELECT *\r\n		FROM company_survey_estats\";\r\n\r\n	$companySurveyEstats = $SPADE[\'db\']->query($Q);\r\n\r\n	foreach ($companySurveyEstats as $cse) {\r\n\r\n		$whereAddition = \'\';\r\n\r\n		if ($cse[\'dateStart\']) {\r\n			$whereAddition .= \' AND st.dateTaken > \' . $cse[\'dateStart\'];\r\n		}\r\n\r\n		if ($cse[\'dateEnd\']) {\r\n			$whereAddition .= \' AND st.dateTaken < \' . $cse[\'dateEnd\'];\r\n		}\r\n\r\n		$Q = \"SELECT ee.id\r\n			FROM surveys_taken st\r\n			INNER JOIN surveys s ON (st.surveyId = s.id)\r\n			INNER JOIN estat_entries ee ON (ee.userId = st.userId AND ee.estatId = \" . $cse[\'estatId\'] . \" AND ee.dateOfEntry = st.dateTaken)\r\n			WHERE s.id = \" . $cse[\'surveyId\'] . \"\r\n			AND s.companyId = \" . $cse[\'companyId\'] . $whereAddition;\r\n		\r\n		display($Q);\r\n\r\n		$entryIds = trim(implode(\',\', $SPADE[\'db\']->query($Q, DB_LIST)));\r\n\r\n		if ($entryIds) {\r\n			$Q = \"DELETE FROM estat_entries WHERE id IN (\" . $entryIds . \")\";\r\n	\r\n			display($Q);\r\n	\r\n			$SPADE[\'db\']->query($Q);\r\n		}\r\n\r\n		//$Q = \"SELECT st.*\r\n		$Q = \"SELECT st.surveyId\r\n			FROM surveys_taken st\r\n			LEFT JOIN surveys s ON (st.surveyId = s.id)\r\n			WHERE s.id = \" . $cse[\'surveyId\'] . \"\r\n			AND s.companyId = \" . $cse[\'companyId\'] . $whereAddition;\r\n\r\n		$surveysTaken = $SPADE[\'db\']->query($Q);\r\n\r\n		display($surveysTaken);\r\n		display(count($surveysTaken));\r\n		continue;\r\n\r\n		if (is_array($surveysTaken) AND 0 < sizeof($surveysTaken)) {\r\n			foreach ($surveysTaken as $st) {\r\n				$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n					VALUES (\r\n						\" . $st[\'userId\'] . \",\r\n						\" . $cse[\'estatId\'] . \",\r\n						\" . $st[\'pointsEarned\'] . \",\r\n						\" . $st[\'dateTaken\'] . \",\r\n						\" . $SPADE[\'user\']->id . \",\r\n						\" . time() . \")\";\r\n\r\n				display($Q);\r\n\r\n				$SPADE[\'db\']->query($Q);\r\n			}\r\n		}\r\n	}\r\n\r\n\r\n\r\n	break;\r\n\r\ndefault:\r\n	logError( \'Unknown confirm step number: \' . $_REQUEST[\'confirm\'] );\r\n	return;\r\n}\r\n\r\n\r\nif ($_REQUEST[\'confirm\'] <= LAST_STEP_NUMBER) {\r\n	echo \'<br /><br /><a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=\' . ((int)$_REQUEST[\'confirm\'] + 1) . \'\">Execute the next step of the PHP conversion process.</a>\';\r\n}\r\n\r\n\r\n?>'),(4175,258,0.18,'php','0','Copied from Demo again for Competition stuff.',1124350143,2,'66.182.95.52','<h1><a href=\"?pg=<?php echo $SPADE[\'page\'][\'name\']; ?>\">Version 2 (V2) Conversion: Overall Step 4</a></h1>\r\n<br />\r\n\r\n<?php\r\n\r\nif (FALSE == isset($_REQUEST[\'confirm\'])) {\r\n\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=1\">Click here to proceed with the PHP conversion (step 1).</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=2\">Execute step 2.</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=3\">Execute step 3.</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=4\">Execute step 4.</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=5\">Execute step 5.</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=6\">Execute step 6 (rebuild estats from surveys taken).</a><br />\';\r\n	echo \'<br />\';\r\n	echo \'Make sure that you have executed steps 1 through 3 of the conversion process on a FRESH copy of of the old V1 EHC database.<br />\';\r\n\r\n	return;\r\n}\r\n\r\ndefine (\'LAST_STEP_NUMBER\', 6);\r\n\r\n/**\r\n * NOTES:\r\n \r\n*** Current eStats\r\n*\r\n\r\n1  weight  Your current weight  1  lifestyle  yes  2  1119738180  \r\n2  water  amount of water consumed  4  nutrition  yes  16  1119740160  \r\n3  time exercised  amount of time exercised  7  fitness  yes  16  1119740340  \r\n4  distance exercised  amount of distance exercised  9  fitness  yes  16  1119740400  \r\n5  fruits and vegetables  fruit and vegetables eaten  12  nutrition  yes  16  1119740460  \r\n6  sleep  amount of time slept at night  8  lifestyle  yes  16  1119740640  \r\n7  calorie intake  Calories eaten  18  nutrition  yes  2  1122444781  \r\n8  fat intake  Fat in all food eaten  17  nutrition  yes  2  1122444781  \r\n9  carb intake  Carbohydrates in all food eaten  17  nutrition  yes  2  1122444781  \r\n\r\n*** Current units\r\n*\r\n\r\n1  pounds  1  2  1119738422  \r\n2  kilograms  1  2  1119738444  \r\n4  glasses  1  16  1119742425  \r\n5  ounces  0  16  1119742425  \r\n7  minutes  0  16  1119742490  \r\n8  hours  2  16  1119742490  \r\n9  miles  2  16  1119742515  \r\n10  kilometers  2  16  1119742515  \r\n11  laps  1  16  1119742546  \r\n12  cups  1  16  1119742939  \r\n13  pieces  1  16  1119742953  \r\n16  steps  0  16  1119743102  \r\n17  grams  1  2  1122444589  \r\n18  calories  0  2  1122444589  \r\n\r\n */\r\n\r\necho \'<h2>PHP Conversion Step \' . (int)$_REQUEST[\'confirm\'] . \'</h2>\';\r\n\r\nswitch ((int)$_REQUEST[\'confirm\']) {\r\n// -------------------------------- USER ESTATS ---------------------------------------------\r\ncase \'1\':\r\n\r\n	echo \"Creating User eStats (determining which eStats to track) for all users.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	// Clear out table first (just in case)\r\n	$Q = \"DELETE FROM user_estats\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up all users to track weight with \'pounds\' as units\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT u.id AS \'userId\', 1 as \'estatId\', 1 AS \'unitId\', \'daily\' as \'frequency\'\r\n		FROM _users u\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up all users to track time exercised with \'minutes\' as units\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT u.id AS \'userId\', 3 as \'estatId\', 7 AS \'unitId\', \'daily\' as \'frequency\'\r\n		FROM _users u\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'distance exercised\' for users who had entries (estat 4, \'steps\' unit 16, \'miles\' unit 9)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT us.userId AS \'userId\', 4 AS \'estatId\', IF(avg(distanceExercised)>100,16,9) AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.distanceExercised > 0\r\n		GROUP BY us.userId\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'water\' for users who had entries (estat 2, \'ounces\' unit 5, \'glasses\' unit 4)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT us.userId AS \'userId\', 2 AS \'estatId\', IF(avg(water)>7,5,4) AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.water > 0\r\n		GROUP BY us.userId\";\r\n		\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'calories\' for users who had entries (estat 7, \'calories\' unit 18)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT us.userId AS \'userId\', 7 AS \'estatId\', 18 AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.calories > 0\r\n		GROUP BY us.userId\";\r\n	\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'fat\' for users who had entries (estat 8, \'grams\' unit 17)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)		\r\n		SELECT us.userId AS \'userId\', 8 AS \'estatId\', 17 AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.fat > 0\r\n		GROUP BY us.userId\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'carbs\' for users who had entries (estat 9, \'grams\' unit 17)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)		\r\n		SELECT us.userId AS \'userId\', 9 AS \'estatId\', 17 AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.carbs > 0\r\n		GROUP BY us.userId\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	break;\r\n\r\n// -------------------------------- ESTAT ENTRIES ---------------------------------------------\r\ncase \'2\':\r\n\r\n	echo \"Creating eStat Entries for all users.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	// Clear out table first (just in case)\r\n	$Q = \"DELETE FROM estat_entries\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'weight\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 1 AS \'estatId\', us.weight AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.weight > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'water\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 2 AS \'estatId\', us.water AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.water > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'time exercised\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 3 AS \'estatId\', us.minutesExercise AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.minutesExercise > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'distance exercised\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 4 AS \'estatId\', us.distanceExercised AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.distanceExercised > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'calories\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 7 AS \'estatId\', us.calories AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.calories > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'fat\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 8 AS \'estatId\', us.fat AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.fat > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'carb\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 9 AS \'estatId\', us.carbs AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.carbs > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	break;\r\n\r\n// -------------------------------- COMPANY / GROUPS ---------------------------------------------\r\ncase \'3\':\r\n\r\n	echo \"Creating groups for all companies and group memberships for all users.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	// Create groups for companies\r\n	$Q = \"SELECT id, companyName, companyVanity, userId\r\n		FROM companies\";\r\n\r\n	$companies = $SPADE[\'db\']->query($Q);\r\n\r\n	foreach ($companies as $company) {\r\n		$Q = \"INSERT INTO _groups (name, description, about, ownerId)\r\n			VALUES (\'\" . $company[\'companyVanity\'] . \"\', \r\n				\'\" . $company[\'companyName\'] . \"\', \r\n				\'Company Group Account\', \r\n				\" . (int)$company[\'userId\'] . \")\";\r\n\r\n		$companyGroupId = $SPADE[\'db\']->query($Q);\r\n\r\n		if (FALSE == $companyGroupId) {\r\n			logError (\'An error occurred while attempting to create a group for company \"\' . $company[\'companyName\'] . \'\".\');\r\n			continue;\r\n		}\r\n\r\n		// Update companies with group IDs\r\n		$Q = \"UPDATE companies \r\n			SET groupId = \" . (int)$companyGroupId . \"\r\n			WHERE id = \" . (int)$company[\'id\'];\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'An error occurred while attempting to update the company \"\' . $company[\'companyName\'] . \'\" with its new group id (\' . $companyGroupId . \').\');\r\n			continue;\r\n		}\r\n\r\n		// Create group memberships for all users\r\n		$Q = \"INSERT INTO _group_users (groupId, userId, title)\r\n			SELECT \" . (int)$companyGroupId . \" AS \'groupId\', u.id AS \'userId\', \'Employee: \" . addslashes($company[\'companyName\']) . \"\' AS \'title\'\r\n			FROM _users u\r\n			WHERE u.companyId = \" . (int)$company[\'id\'];\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'An error occurred while attempting to create group memberships for employees of \"\' . $company[\'companyName\'] . \'\". It is possible this company has no registered employees.\');\r\n			//continue;\r\n		}\r\n\r\n		// Update group_forums table with now corresponding group ID\r\n		$Q = \"UPDATE group_forums\r\n			SET groupId = \" . (int)$companyGroupId . \"\r\n			WHERE groupId = \" . (int)$company[\'id\'];\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'An error occurred while attempting to update the company forums for \"\' . $company[\'companyName\'] . \'\". It is possible this company had no registered forums.\');\r\n			//continue;\r\n		}\r\n	\r\n		echo \'SUCCESS: \' . $company[\'id\'] . \'.) \' . $company[\'companyName\'] . \' -- \' . $company[\'companyVanity\'] . \'.ehealthcompete.com<br />\';\r\n	}\r\n\r\n\r\n	break;\r\n\r\n// -------------------------------- COMPETITIONS ---------------------------------------------\r\ncase \'4\':\r\n\r\n	echo \"Converting competition data.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	$scoringMethods = array(\r\n		\'Weight Lost\' => array( \'estatId\' => 1, \'basedOn\' => \'actual change\', \'polarity\' => \'negative\' ),\r\n		\'Percentage Weight Lost\' => array( \'estatId\' => 1, \'basedOn\' => \'percent change\', \'polarity\' => \'negative\' ),\r\n		\'Minutes Exercise\' => array( \'estatId\' => 3, \'basedOn\' => \'total\', \'polarity\' => \'positive\' ),\r\n		\'Distance Exercised\' => array( \'estatId\' => 4, \'basedOn\' => \'total\', \'polarity\' => \'positive\' ),\r\n		\'Weight Gained\' => array( \'estatId\' => 1, \'basedOn\' => \'actual change\', \'polarity\' => \'positive\')\r\n	);\r\n\r\n	/**		\r\n	1  weight  Your current weight  1  lifestyle  yes  2  1119738180  \r\n	2  water  amount of water consumed  4  nutrition  yes  16  1119740160  \r\n	3  time exercised  amount of time exercised  7  fitness  yes  16  1119740340  \r\n	4  distance exercised  amount of distance exercised  9  fitness  yes  16  1119740400  \r\n	5  fruits and vegetables  fruit and vegetables eaten  12  nutrition  yes  16  1119740460  \r\n	6  sleep  amount of time slept at night  8  lifestyle  yes  16  1119740640  \r\n	7  calorie intake  Calories eaten  18  nutrition  yes  2  1122444781  \r\n	8  fat intake  Fat in all food eaten  17  nutrition  yes  2  1122444781  \r\n	9  carb intake  Carbohydrates in all food eaten  17  nutrition  yes  2  1122444781  \r\n	**/\r\n\r\n\r\n	$Q = \"SELECT * FROM competitions_old\";\r\n\r\n	$competitions = $SPADE[\'db\']->query($Q);\r\n\r\n	// Copy main competition data over...\r\n	// Done in SQL step 1.\r\n\r\n	foreach ($competitions as $comp) {\r\n		// ----- CREATE COMPETITION PARAMETERS ----- //\r\n		$currentParameters = array();\r\n		$currentParameters[] = $comp[\'scoringMethod\'];		\r\n\r\n		// Create competition parameters\r\n		$Q = \"INSERT INTO competition_parameters (competitionId, estatId, basedOn, polarity, displayOrder)\r\n			VALUES (\" . (int)$comp[\'id\'] . \",\r\n				\" . (int)$scoringMethods[$comp[\'scoringMethod\']][\'estatId\'] . \",\r\n				\'\" . $scoringMethods[$comp[\'scoringMethod\']][\'basedOn\'] . \"\',\r\n				\'\" . $scoringMethods[$comp[\'scoringMethod\']][\'polarity\'] . \"\',\r\n				0)\";\r\n\r\n		if (FALSE == ($parameterId = $SPADE[\'db\']->query($Q))) {\r\n			logError (\'Unable to create (primary) competition parameter for competition ID \' . $comp[\'id\'] . \'.\');\r\n			continue;\r\n		}\r\n\r\n		// Add parameter \r\n		if ($comp[\'tieBreakerMethod\'] && !in_array($comp[\'tieBreakerMethod\'], $currentParameters)) {\r\n			$currentParameters[] = $comp[\'tieBreakerMethod\'];\r\n\r\n			$Q = \"INSERT INTO competition_parameters (competitionId, estatId, basedOn, polarity, displayOrder)\r\n				VALUES (\" . (int)$comp[\'id\'] . \",\r\n					\" . (int)$scoringMethods[$comp[\'tieBreakerMethod\']][\'estatId\'] . \",\r\n					\'\" . $scoringMethods[$comp[\'tieBreakerMethod\']][\'basedOn\'] . \"\',\r\n					\'\" . $scoringMethods[$comp[\'tieBreakerMethod\']][\'polarity\'] . \"\',\r\n					1)\";\r\n	\r\n			if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n				logError (\'Unable to create (primary) competition parameter for competition ID \' . $comp[\'id\'] . \'.\');\r\n				continue;\r\n			}\r\n		}\r\n\r\n		if ($comp[\'weeklyWinnersMethod1\'] && !in_array($comp[\'weeklyWinnersMethod1\'], $currentParameters)) {\r\n			$currentParameters[] = $comp[\'weeklyWinnersMethod1\'];\r\n\r\n			$Q = \"INSERT INTO competition_parameters (competitionId, estatId, basedOn, polarity, displayOrder)\r\n				VALUES (\" . (int)$comp[\'id\'] . \",\r\n					\" . (int)$scoringMethods[$comp[\'weeklyWinnersMethod1\']][\'estatId\'] . \",\r\n					\'\" . $scoringMethods[$comp[\'weeklyWinnersMethod1\']][\'basedOn\'] . \"\',\r\n					\'\" . $scoringMethods[$comp[\'weeklyWinnersMethod1\']][\'polarity\'] . \"\',\r\n					2)\";\r\n	\r\n			if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n				logError (\'Unable to create (primary) competition parameter for competition ID \' . $comp[\'id\'] . \'.\');\r\n				continue;\r\n			}\r\n		}\r\n\r\n		if ($comp[\'weeklyWinnersMethod2\'] && !in_array($comp[\'weeklyWinnersMethod2\'], $currentParameters)) {\r\n			$currentParameters[] = $comp[\'weeklyWinnersMethod2\'];\r\n\r\n			$Q = \"INSERT INTO competition_parameters (competitionId, estatId, basedOn, polarity, displayOrder)\r\n				VALUES (\" . (int)$comp[\'id\'] . \",\r\n					\" . (int)$scoringMethods[$comp[\'weeklyWinnersMethod2\']][\'estatId\'] . \",\r\n					\'\" . $scoringMethods[$comp[\'weeklyWinnersMethod2\']][\'basedOn\'] . \"\',\r\n					\'\" . $scoringMethods[$comp[\'weeklyWinnersMethod2\']][\'polarity\'] . \"\',\r\n					3)\";\r\n	\r\n			if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n				logError (\'Unable to create (primary) competition parameter for competition ID \' . $comp[\'id\'] . \'.\');\r\n				continue;\r\n			}\r\n		}\r\n\r\n\r\n		// ----- CREATE COMPETITION PRIZES ----- //\r\n		$Q = \"INSERT INTO competition_prizes (\r\n				competitionId, title, description, maxWinners, \r\n				frequency, andOr, dateStart, dateEnd )\r\n			VALUES (\" . (int)$comp[\'id\'] . \",\r\n				\'Competition Prize\',\r\n				\'\" . addslashes($comp[\'potDescription\']) . \"\',\r\n				1,\r\n				\'once\',\r\n				\'and\',\r\n				\" . (int)$comp[\'startDate\'] . \",\r\n				\" . (int)$comp[\'endDate\'] . \")\";\r\n\r\n		if (FALSE == ($prizeId = $SPADE[\'db\']->query($Q))) {\r\n			logError (\'Unable to create a competition prize for competition ID \' . (int)$comp[\'id\'] . \'.\');\r\n			continue;\r\n		}\r\n\r\n		\r\n		// ----- CREATE COMPETITION PRIZE PARAMETERS ----- //\r\n		$Q = \"INSERT INTO competition_prize_parameters (\r\n				competitionPrizeId, competitionParameterId)\r\n			VALUES (\" . (int)$prizeId . \",\r\n				\" . (int)$parameterId . \")\";\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'Unable to create a competition prize parameter for competition ID \' . (int)$comp[\'id\'] . \'.\');\r\n			continue;\r\n		}\r\n	}\r\n\r\n	// ----- CREATE INVOICES ----- //\r\n	$Q = \"SELECT cp.userId, u.firstName, u.lastName, c.companyName, u.address1, u.address2,\r\n			u.city, u.state, u.country, u.zip, u.phone1, u.email,\r\n			cp.amount, cp.dateDonated, cp.paymentMethod, cp.entryFee,\r\n			cp.compId, comp.title\r\n		FROM competition_pot cp\r\n		INNER JOIN _users u ON (cp.userId = u.id)\r\n		LEFT JOIN competitions comp ON (cp.compId = comp.id)\r\n		LEFT JOIN companies c ON (u.companyId = c.id)\";\r\n\r\n	$paymentDetails = $SPADE[\'db\']->query($Q);\r\n\r\n	// Continue if no entry fees were paid\r\n	if (FALSE == is_array($paymentDetails) || 0 == sizeof($paymentDetails)) {\r\n		continue;\r\n	}\r\n\r\n	foreach ($paymentDetails as $payment) {\r\n		$Q = \"INSERT INTO invoices (\r\n				userId, firstName, lastName, company,\r\n				address1, address2, city, state, country, zip, phone, email,\r\n				dateDue, amountDue)\r\n			VALUES (\r\n				\" . (int)$payment[\'userId\'] . \",\r\n				\'\" . addslashes($payment[\'firstName\']) . \"\',\r\n				\'\" . addslashes($payment[\'lastName\']) . \"\',\r\n				\'\" . addslashes($payment[\'companyName\']) . \"\',\r\n				\'\" . addslashes($payment[\'address1\']) . \"\',\r\n				\'\" . addslashes($payment[\'address2\']) . \"\',\r\n				\'\" . addslashes($payment[\'city\']) . \"\',\r\n				\'\" . addslashes($payment[\'state\']) . \"\',\r\n				\'\" . addslashes($payment[\'country\']) . \"\', \r\n				\'\" . $payment[\'zip\'] . \"\',\r\n				\'\" . $payment[\'phone1\'] . \"\',\r\n				\'\" . addslashes($payment[\'email\']) . \"\',\r\n				\" . (int)$payment[\'dateDonated\'] . \",\r\n				\'\" . $payment[\'entryFee\'] . \"\')\";\r\n\r\n		if (FALSE == ($invoiceId = $SPADE[\'db\']->query($Q))) {\r\n			logError (\'Could not create an invoice for competition payment for comp ID \' . $payment[\'compId\'] . \' for \' . $payment[\'firstName\'] . \' \' . $payment[\'lastName\'] . \'.\');\r\n			continue;\r\n		}\r\n\r\n		$Q = \"INSERT INTO competition_entry_fees (\r\n				competitionId, userId, amount, invoiceId)\r\n			VALUES (\r\n				\'\" . $payment[\'compId\'] . \"\',\r\n				\" . (int)$payment[\'userId\'] . \",\r\n				\'\" . $payment[\'amount\'] . \"\',\r\n				\" . (int)$invoiceId . \")\";\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'Unable to save the competition entry fee for comp ID \' . $payment[\'compId\'] . \' for \' . $payment[\'firstName\'] . \' \' . $payment[\'lastName\'] . \'.\');\r\n			continue;\r\n		}\r\n\r\n		$Q = \"INSERT INTO invoice_line_items (\r\n				invoiceNumber, description, price, quantity)\r\n			VALUES (\r\n				\" . (int)$invoiceId . \",\r\n				\'Competition entry fee, competition #\" . $payment[\'compId\'] . \"\',\r\n				\'\" . $payment[\'entryFee\'] . \"\', \r\n				1)\";\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'Could not create an invoice line item for comp ID \' . $payment[\'compId\'] . \' for \' . $payment[\'firstName\'] . \' \' . $payment[\'lastName\'] . \'.\');\r\n		}\r\n\r\n		$Q = \"INSERT INTO invoice_payments (\r\n				invoiceNumber, dateOfPayment, amountPaid, paymentMethod)\r\n			VALUES (\r\n				\" . (int)$invoiceId . \",\r\n				\" . (int)$payment[\'dateDonated\'] . \",\r\n				\'\" . $payment[\'amount\'] . \"\',\r\n				\'\" . $payment[\'paymentMethod\'] . \"\')\";\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'Could not create an invoice payment for comp ID \' . $payment[\'compId\'] . \' for \' . $payment[\'firstName\' ] . \' \' . $payment[\'lastName\'] . \'.\');\r\n			continue;\r\n		}\r\n	}\r\n\r\n	break;\r\n\r\n// -------------------------------- FIX ESTAT ENTRIES FOR NON-STANDARD UNITS ---------------------------------------------\r\ncase \'5\':\r\n\r\n	echo \"Converting eStats for non-standard units.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	// Get userId\'s of users who have non-standard units (ounces = unitId 5) for water entries.\r\n	$Q = \"SELECT u.id\r\n		FROM user_estats ue\r\n		INNER JOIN _users u ON (ue.userId = u.id)\r\n		WHERE ue.estatId = 2\r\n		AND ue.unitId = 5\";\r\n\r\n	$userIds = $SPADE[\'db\']->query($Q, DB_LIST);\r\n	$userIds = implode(\',\', $userIds);\r\n\r\n	$Q = \"UPDATE estat_entries \r\n		SET value = (value * 0.125)\r\n		WHERE estatId = 2\r\n		AND userId IN (\" . $userIds . \")\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError (\'An error occurred while attempting to update and convert water entries from ounces to glasses.\');\r\n		break;\r\n	}\r\n\r\n	// Get userId\'s of users who have non-standard units (steps = unitId 16) for distance exercised entries.\r\n	$Q = \"SELECT u.id\r\n		FROM user_estats ue\r\n		INNER JOIN _users u ON (ue.userId = u.id)\r\n		WHERE ue.estatId = 4\r\n		AND ue.unitId = 16\";\r\n\r\n	$userIds = $SPADE[\'db\']->query($Q, DB_LIST);\r\n	$userIds = implode(\',\', $userIds);\r\n\r\n	$Q = \"UPDATE estat_entries \r\n		SET value = (value * 0.0005)\r\n		WHERE estatId = 4\r\n		AND userId IN (\" . $userIds . \")\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError (\'An error occurred while attempting to update and convert distance exercised entries from steps to miles.\');\r\n		break;\r\n	}\r\n\r\n\r\n	break;\r\n\r\n// -------------------------------- CORRECT / REBUILD estat_entries FROM company_survey_estats ---------------------------------------------\r\ncase \'6\':\r\n\r\n	echo \"Rebuilding estat_entries from company_survey_estats<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	$Q = \"SELECT *\r\n		FROM company_survey_estats\";\r\n\r\n	$companySurveyEstats = $SPADE[\'db\']->query($Q);\r\n\r\n	foreach ($companySurveyEstats as $cse) {\r\n\r\n		$whereAddition = \'\';\r\n\r\n		if ($cse[\'dateStart\']) {\r\n			$whereAddition .= \' AND st.dateTaken > \' . $cse[\'dateStart\'];\r\n		}\r\n\r\n		if ($cse[\'dateEnd\']) {\r\n			$whereAddition .= \' AND st.dateTaken < \' . $cse[\'dateEnd\'];\r\n		}\r\n\r\n		$Q = \"SELECT ee.id\r\n			FROM surveys_taken st\r\n			INNER JOIN surveys s ON (st.surveyId = s.id)\r\n			INNER JOIN estat_entries ee ON (ee.userId = st.userId AND ee.estatId = \" . $cse[\'estatId\'] . \" AND ee.dateOfEntry = st.dateTaken)\r\n			WHERE s.id = \" . $cse[\'surveyId\'] . \"\r\n			AND (s.companyId = \" . $cse[\'companyId\'] . \" OR s.companyId = 0)\" . $whereAddition;\r\n		\r\n		display($Q);\r\n\r\n		$entryIds = trim(implode(\',\', $SPADE[\'db\']->query($Q, DB_LIST)));\r\n\r\n		if ($entryIds) {\r\n			$Q = \"DELETE FROM estat_entries WHERE id IN (\" . $entryIds . \")\";\r\n	\r\n			display($Q);\r\n	\r\n			$SPADE[\'db\']->query($Q);\r\n		}\r\n\r\n		//$Q = \"SELECT st.*\r\n		$Q = \"SELECT st.surveyId\r\n			FROM surveys_taken st\r\n			LEFT JOIN surveys s ON (st.surveyId = s.id)\r\n			WHERE s.id = \" . $cse[\'surveyId\'] . \"\r\n			AND (s.companyId = \" . $cse[\'companyId\'] . \" OR s.companyId = 0)\" . $whereAddition;\r\n\r\n		$surveysTaken = $SPADE[\'db\']->query($Q);\r\n\r\n		//display($surveysTaken);\r\n		display(count($surveysTaken));\r\n		continue;\r\n\r\n		if (is_array($surveysTaken) AND 0 < sizeof($surveysTaken)) {\r\n			foreach ($surveysTaken as $st) {\r\n				$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n					VALUES (\r\n						\" . $st[\'userId\'] . \",\r\n						\" . $cse[\'estatId\'] . \",\r\n						\" . $st[\'pointsEarned\'] . \",\r\n						\" . $st[\'dateTaken\'] . \",\r\n						\" . $SPADE[\'user\']->id . \",\r\n						\" . time() . \")\";\r\n\r\n				display($Q);\r\n\r\n				$SPADE[\'db\']->query($Q);\r\n			}\r\n		}\r\n	}\r\n\r\n\r\n\r\n	break;\r\n\r\ndefault:\r\n	logError( \'Unknown confirm step number: \' . $_REQUEST[\'confirm\'] );\r\n	return;\r\n}\r\n\r\n\r\nif ($_REQUEST[\'confirm\'] <= LAST_STEP_NUMBER) {\r\n	echo \'<br /><br /><a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=\' . ((int)$_REQUEST[\'confirm\'] + 1) . \'\">Execute the next step of the PHP conversion process.</a>\';\r\n}\r\n\r\n\r\n?>'),(4176,258,0.19,'php','0','Copied from Demo again for Competition stuff.',1124350205,2,'66.182.95.52','<h1><a href=\"?pg=<?php echo $SPADE[\'page\'][\'name\']; ?>\">Version 2 (V2) Conversion: Overall Step 4</a></h1>\r\n<br />\r\n\r\n<?php\r\n\r\nif (FALSE == isset($_REQUEST[\'confirm\'])) {\r\n\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=1\">Click here to proceed with the PHP conversion (step 1).</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=2\">Execute step 2.</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=3\">Execute step 3.</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=4\">Execute step 4.</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=5\">Execute step 5.</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=6\">Execute step 6 (rebuild estats from surveys taken).</a><br />\';\r\n	echo \'<br />\';\r\n	echo \'Make sure that you have executed steps 1 through 3 of the conversion process on a FRESH copy of of the old V1 EHC database.<br />\';\r\n\r\n	return;\r\n}\r\n\r\ndefine (\'LAST_STEP_NUMBER\', 6);\r\n\r\n/**\r\n * NOTES:\r\n \r\n*** Current eStats\r\n*\r\n\r\n1  weight  Your current weight  1  lifestyle  yes  2  1119738180  \r\n2  water  amount of water consumed  4  nutrition  yes  16  1119740160  \r\n3  time exercised  amount of time exercised  7  fitness  yes  16  1119740340  \r\n4  distance exercised  amount of distance exercised  9  fitness  yes  16  1119740400  \r\n5  fruits and vegetables  fruit and vegetables eaten  12  nutrition  yes  16  1119740460  \r\n6  sleep  amount of time slept at night  8  lifestyle  yes  16  1119740640  \r\n7  calorie intake  Calories eaten  18  nutrition  yes  2  1122444781  \r\n8  fat intake  Fat in all food eaten  17  nutrition  yes  2  1122444781  \r\n9  carb intake  Carbohydrates in all food eaten  17  nutrition  yes  2  1122444781  \r\n\r\n*** Current units\r\n*\r\n\r\n1  pounds  1  2  1119738422  \r\n2  kilograms  1  2  1119738444  \r\n4  glasses  1  16  1119742425  \r\n5  ounces  0  16  1119742425  \r\n7  minutes  0  16  1119742490  \r\n8  hours  2  16  1119742490  \r\n9  miles  2  16  1119742515  \r\n10  kilometers  2  16  1119742515  \r\n11  laps  1  16  1119742546  \r\n12  cups  1  16  1119742939  \r\n13  pieces  1  16  1119742953  \r\n16  steps  0  16  1119743102  \r\n17  grams  1  2  1122444589  \r\n18  calories  0  2  1122444589  \r\n\r\n */\r\n\r\necho \'<h2>PHP Conversion Step \' . (int)$_REQUEST[\'confirm\'] . \'</h2>\';\r\n\r\nswitch ((int)$_REQUEST[\'confirm\']) {\r\n// -------------------------------- USER ESTATS ---------------------------------------------\r\ncase \'1\':\r\n\r\n	echo \"Creating User eStats (determining which eStats to track) for all users.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	// Clear out table first (just in case)\r\n	$Q = \"DELETE FROM user_estats\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up all users to track weight with \'pounds\' as units\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT u.id AS \'userId\', 1 as \'estatId\', 1 AS \'unitId\', \'daily\' as \'frequency\'\r\n		FROM _users u\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up all users to track time exercised with \'minutes\' as units\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT u.id AS \'userId\', 3 as \'estatId\', 7 AS \'unitId\', \'daily\' as \'frequency\'\r\n		FROM _users u\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'distance exercised\' for users who had entries (estat 4, \'steps\' unit 16, \'miles\' unit 9)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT us.userId AS \'userId\', 4 AS \'estatId\', IF(avg(distanceExercised)>100,16,9) AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.distanceExercised > 0\r\n		GROUP BY us.userId\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'water\' for users who had entries (estat 2, \'ounces\' unit 5, \'glasses\' unit 4)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT us.userId AS \'userId\', 2 AS \'estatId\', IF(avg(water)>7,5,4) AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.water > 0\r\n		GROUP BY us.userId\";\r\n		\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'calories\' for users who had entries (estat 7, \'calories\' unit 18)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT us.userId AS \'userId\', 7 AS \'estatId\', 18 AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.calories > 0\r\n		GROUP BY us.userId\";\r\n	\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'fat\' for users who had entries (estat 8, \'grams\' unit 17)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)		\r\n		SELECT us.userId AS \'userId\', 8 AS \'estatId\', 17 AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.fat > 0\r\n		GROUP BY us.userId\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'carbs\' for users who had entries (estat 9, \'grams\' unit 17)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)		\r\n		SELECT us.userId AS \'userId\', 9 AS \'estatId\', 17 AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.carbs > 0\r\n		GROUP BY us.userId\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	break;\r\n\r\n// -------------------------------- ESTAT ENTRIES ---------------------------------------------\r\ncase \'2\':\r\n\r\n	echo \"Creating eStat Entries for all users.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	// Clear out table first (just in case)\r\n	$Q = \"DELETE FROM estat_entries\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'weight\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 1 AS \'estatId\', us.weight AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.weight > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'water\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 2 AS \'estatId\', us.water AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.water > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'time exercised\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 3 AS \'estatId\', us.minutesExercise AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.minutesExercise > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'distance exercised\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 4 AS \'estatId\', us.distanceExercised AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.distanceExercised > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'calories\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 7 AS \'estatId\', us.calories AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.calories > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'fat\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 8 AS \'estatId\', us.fat AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.fat > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'carb\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 9 AS \'estatId\', us.carbs AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.carbs > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	break;\r\n\r\n// -------------------------------- COMPANY / GROUPS ---------------------------------------------\r\ncase \'3\':\r\n\r\n	echo \"Creating groups for all companies and group memberships for all users.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	// Create groups for companies\r\n	$Q = \"SELECT id, companyName, companyVanity, userId\r\n		FROM companies\";\r\n\r\n	$companies = $SPADE[\'db\']->query($Q);\r\n\r\n	foreach ($companies as $company) {\r\n		$Q = \"INSERT INTO _groups (name, description, about, ownerId)\r\n			VALUES (\'\" . $company[\'companyVanity\'] . \"\', \r\n				\'\" . $company[\'companyName\'] . \"\', \r\n				\'Company Group Account\', \r\n				\" . (int)$company[\'userId\'] . \")\";\r\n\r\n		$companyGroupId = $SPADE[\'db\']->query($Q);\r\n\r\n		if (FALSE == $companyGroupId) {\r\n			logError (\'An error occurred while attempting to create a group for company \"\' . $company[\'companyName\'] . \'\".\');\r\n			continue;\r\n		}\r\n\r\n		// Update companies with group IDs\r\n		$Q = \"UPDATE companies \r\n			SET groupId = \" . (int)$companyGroupId . \"\r\n			WHERE id = \" . (int)$company[\'id\'];\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'An error occurred while attempting to update the company \"\' . $company[\'companyName\'] . \'\" with its new group id (\' . $companyGroupId . \').\');\r\n			continue;\r\n		}\r\n\r\n		// Create group memberships for all users\r\n		$Q = \"INSERT INTO _group_users (groupId, userId, title)\r\n			SELECT \" . (int)$companyGroupId . \" AS \'groupId\', u.id AS \'userId\', \'Employee: \" . addslashes($company[\'companyName\']) . \"\' AS \'title\'\r\n			FROM _users u\r\n			WHERE u.companyId = \" . (int)$company[\'id\'];\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'An error occurred while attempting to create group memberships for employees of \"\' . $company[\'companyName\'] . \'\". It is possible this company has no registered employees.\');\r\n			//continue;\r\n		}\r\n\r\n		// Update group_forums table with now corresponding group ID\r\n		$Q = \"UPDATE group_forums\r\n			SET groupId = \" . (int)$companyGroupId . \"\r\n			WHERE groupId = \" . (int)$company[\'id\'];\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'An error occurred while attempting to update the company forums for \"\' . $company[\'companyName\'] . \'\". It is possible this company had no registered forums.\');\r\n			//continue;\r\n		}\r\n	\r\n		echo \'SUCCESS: \' . $company[\'id\'] . \'.) \' . $company[\'companyName\'] . \' -- \' . $company[\'companyVanity\'] . \'.ehealthcompete.com<br />\';\r\n	}\r\n\r\n\r\n	break;\r\n\r\n// -------------------------------- COMPETITIONS ---------------------------------------------\r\ncase \'4\':\r\n\r\n	echo \"Converting competition data.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	$scoringMethods = array(\r\n		\'Weight Lost\' => array( \'estatId\' => 1, \'basedOn\' => \'actual change\', \'polarity\' => \'negative\' ),\r\n		\'Percentage Weight Lost\' => array( \'estatId\' => 1, \'basedOn\' => \'percent change\', \'polarity\' => \'negative\' ),\r\n		\'Minutes Exercise\' => array( \'estatId\' => 3, \'basedOn\' => \'total\', \'polarity\' => \'positive\' ),\r\n		\'Distance Exercised\' => array( \'estatId\' => 4, \'basedOn\' => \'total\', \'polarity\' => \'positive\' ),\r\n		\'Weight Gained\' => array( \'estatId\' => 1, \'basedOn\' => \'actual change\', \'polarity\' => \'positive\')\r\n	);\r\n\r\n	/**		\r\n	1  weight  Your current weight  1  lifestyle  yes  2  1119738180  \r\n	2  water  amount of water consumed  4  nutrition  yes  16  1119740160  \r\n	3  time exercised  amount of time exercised  7  fitness  yes  16  1119740340  \r\n	4  distance exercised  amount of distance exercised  9  fitness  yes  16  1119740400  \r\n	5  fruits and vegetables  fruit and vegetables eaten  12  nutrition  yes  16  1119740460  \r\n	6  sleep  amount of time slept at night  8  lifestyle  yes  16  1119740640  \r\n	7  calorie intake  Calories eaten  18  nutrition  yes  2  1122444781  \r\n	8  fat intake  Fat in all food eaten  17  nutrition  yes  2  1122444781  \r\n	9  carb intake  Carbohydrates in all food eaten  17  nutrition  yes  2  1122444781  \r\n	**/\r\n\r\n\r\n	$Q = \"SELECT * FROM competitions_old\";\r\n\r\n	$competitions = $SPADE[\'db\']->query($Q);\r\n\r\n	// Copy main competition data over...\r\n	// Done in SQL step 1.\r\n\r\n	foreach ($competitions as $comp) {\r\n		// ----- CREATE COMPETITION PARAMETERS ----- //\r\n		$currentParameters = array();\r\n		$currentParameters[] = $comp[\'scoringMethod\'];		\r\n\r\n		// Create competition parameters\r\n		$Q = \"INSERT INTO competition_parameters (competitionId, estatId, basedOn, polarity, displayOrder)\r\n			VALUES (\" . (int)$comp[\'id\'] . \",\r\n				\" . (int)$scoringMethods[$comp[\'scoringMethod\']][\'estatId\'] . \",\r\n				\'\" . $scoringMethods[$comp[\'scoringMethod\']][\'basedOn\'] . \"\',\r\n				\'\" . $scoringMethods[$comp[\'scoringMethod\']][\'polarity\'] . \"\',\r\n				0)\";\r\n\r\n		if (FALSE == ($parameterId = $SPADE[\'db\']->query($Q))) {\r\n			logError (\'Unable to create (primary) competition parameter for competition ID \' . $comp[\'id\'] . \'.\');\r\n			continue;\r\n		}\r\n\r\n		// Add parameter \r\n		if ($comp[\'tieBreakerMethod\'] && !in_array($comp[\'tieBreakerMethod\'], $currentParameters)) {\r\n			$currentParameters[] = $comp[\'tieBreakerMethod\'];\r\n\r\n			$Q = \"INSERT INTO competition_parameters (competitionId, estatId, basedOn, polarity, displayOrder)\r\n				VALUES (\" . (int)$comp[\'id\'] . \",\r\n					\" . (int)$scoringMethods[$comp[\'tieBreakerMethod\']][\'estatId\'] . \",\r\n					\'\" . $scoringMethods[$comp[\'tieBreakerMethod\']][\'basedOn\'] . \"\',\r\n					\'\" . $scoringMethods[$comp[\'tieBreakerMethod\']][\'polarity\'] . \"\',\r\n					1)\";\r\n	\r\n			if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n				logError (\'Unable to create (primary) competition parameter for competition ID \' . $comp[\'id\'] . \'.\');\r\n				continue;\r\n			}\r\n		}\r\n\r\n		if ($comp[\'weeklyWinnersMethod1\'] && !in_array($comp[\'weeklyWinnersMethod1\'], $currentParameters)) {\r\n			$currentParameters[] = $comp[\'weeklyWinnersMethod1\'];\r\n\r\n			$Q = \"INSERT INTO competition_parameters (competitionId, estatId, basedOn, polarity, displayOrder)\r\n				VALUES (\" . (int)$comp[\'id\'] . \",\r\n					\" . (int)$scoringMethods[$comp[\'weeklyWinnersMethod1\']][\'estatId\'] . \",\r\n					\'\" . $scoringMethods[$comp[\'weeklyWinnersMethod1\']][\'basedOn\'] . \"\',\r\n					\'\" . $scoringMethods[$comp[\'weeklyWinnersMethod1\']][\'polarity\'] . \"\',\r\n					2)\";\r\n	\r\n			if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n				logError (\'Unable to create (primary) competition parameter for competition ID \' . $comp[\'id\'] . \'.\');\r\n				continue;\r\n			}\r\n		}\r\n\r\n		if ($comp[\'weeklyWinnersMethod2\'] && !in_array($comp[\'weeklyWinnersMethod2\'], $currentParameters)) {\r\n			$currentParameters[] = $comp[\'weeklyWinnersMethod2\'];\r\n\r\n			$Q = \"INSERT INTO competition_parameters (competitionId, estatId, basedOn, polarity, displayOrder)\r\n				VALUES (\" . (int)$comp[\'id\'] . \",\r\n					\" . (int)$scoringMethods[$comp[\'weeklyWinnersMethod2\']][\'estatId\'] . \",\r\n					\'\" . $scoringMethods[$comp[\'weeklyWinnersMethod2\']][\'basedOn\'] . \"\',\r\n					\'\" . $scoringMethods[$comp[\'weeklyWinnersMethod2\']][\'polarity\'] . \"\',\r\n					3)\";\r\n	\r\n			if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n				logError (\'Unable to create (primary) competition parameter for competition ID \' . $comp[\'id\'] . \'.\');\r\n				continue;\r\n			}\r\n		}\r\n\r\n\r\n		// ----- CREATE COMPETITION PRIZES ----- //\r\n		$Q = \"INSERT INTO competition_prizes (\r\n				competitionId, title, description, maxWinners, \r\n				frequency, andOr, dateStart, dateEnd )\r\n			VALUES (\" . (int)$comp[\'id\'] . \",\r\n				\'Competition Prize\',\r\n				\'\" . addslashes($comp[\'potDescription\']) . \"\',\r\n				1,\r\n				\'once\',\r\n				\'and\',\r\n				\" . (int)$comp[\'startDate\'] . \",\r\n				\" . (int)$comp[\'endDate\'] . \")\";\r\n\r\n		if (FALSE == ($prizeId = $SPADE[\'db\']->query($Q))) {\r\n			logError (\'Unable to create a competition prize for competition ID \' . (int)$comp[\'id\'] . \'.\');\r\n			continue;\r\n		}\r\n\r\n		\r\n		// ----- CREATE COMPETITION PRIZE PARAMETERS ----- //\r\n		$Q = \"INSERT INTO competition_prize_parameters (\r\n				competitionPrizeId, competitionParameterId)\r\n			VALUES (\" . (int)$prizeId . \",\r\n				\" . (int)$parameterId . \")\";\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'Unable to create a competition prize parameter for competition ID \' . (int)$comp[\'id\'] . \'.\');\r\n			continue;\r\n		}\r\n	}\r\n\r\n	// ----- CREATE INVOICES ----- //\r\n	$Q = \"SELECT cp.userId, u.firstName, u.lastName, c.companyName, u.address1, u.address2,\r\n			u.city, u.state, u.country, u.zip, u.phone1, u.email,\r\n			cp.amount, cp.dateDonated, cp.paymentMethod, cp.entryFee,\r\n			cp.compId, comp.title\r\n		FROM competition_pot cp\r\n		INNER JOIN _users u ON (cp.userId = u.id)\r\n		LEFT JOIN competitions comp ON (cp.compId = comp.id)\r\n		LEFT JOIN companies c ON (u.companyId = c.id)\";\r\n\r\n	$paymentDetails = $SPADE[\'db\']->query($Q);\r\n\r\n	// Continue if no entry fees were paid\r\n	if (FALSE == is_array($paymentDetails) || 0 == sizeof($paymentDetails)) {\r\n		continue;\r\n	}\r\n\r\n	foreach ($paymentDetails as $payment) {\r\n		$Q = \"INSERT INTO invoices (\r\n				userId, firstName, lastName, company,\r\n				address1, address2, city, state, country, zip, phone, email,\r\n				dateDue, amountDue)\r\n			VALUES (\r\n				\" . (int)$payment[\'userId\'] . \",\r\n				\'\" . addslashes($payment[\'firstName\']) . \"\',\r\n				\'\" . addslashes($payment[\'lastName\']) . \"\',\r\n				\'\" . addslashes($payment[\'companyName\']) . \"\',\r\n				\'\" . addslashes($payment[\'address1\']) . \"\',\r\n				\'\" . addslashes($payment[\'address2\']) . \"\',\r\n				\'\" . addslashes($payment[\'city\']) . \"\',\r\n				\'\" . addslashes($payment[\'state\']) . \"\',\r\n				\'\" . addslashes($payment[\'country\']) . \"\', \r\n				\'\" . $payment[\'zip\'] . \"\',\r\n				\'\" . $payment[\'phone1\'] . \"\',\r\n				\'\" . addslashes($payment[\'email\']) . \"\',\r\n				\" . (int)$payment[\'dateDonated\'] . \",\r\n				\'\" . $payment[\'entryFee\'] . \"\')\";\r\n\r\n		if (FALSE == ($invoiceId = $SPADE[\'db\']->query($Q))) {\r\n			logError (\'Could not create an invoice for competition payment for comp ID \' . $payment[\'compId\'] . \' for \' . $payment[\'firstName\'] . \' \' . $payment[\'lastName\'] . \'.\');\r\n			continue;\r\n		}\r\n\r\n		$Q = \"INSERT INTO competition_entry_fees (\r\n				competitionId, userId, amount, invoiceId)\r\n			VALUES (\r\n				\'\" . $payment[\'compId\'] . \"\',\r\n				\" . (int)$payment[\'userId\'] . \",\r\n				\'\" . $payment[\'amount\'] . \"\',\r\n				\" . (int)$invoiceId . \")\";\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'Unable to save the competition entry fee for comp ID \' . $payment[\'compId\'] . \' for \' . $payment[\'firstName\'] . \' \' . $payment[\'lastName\'] . \'.\');\r\n			continue;\r\n		}\r\n\r\n		$Q = \"INSERT INTO invoice_line_items (\r\n				invoiceNumber, description, price, quantity)\r\n			VALUES (\r\n				\" . (int)$invoiceId . \",\r\n				\'Competition entry fee, competition #\" . $payment[\'compId\'] . \"\',\r\n				\'\" . $payment[\'entryFee\'] . \"\', \r\n				1)\";\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'Could not create an invoice line item for comp ID \' . $payment[\'compId\'] . \' for \' . $payment[\'firstName\'] . \' \' . $payment[\'lastName\'] . \'.\');\r\n		}\r\n\r\n		$Q = \"INSERT INTO invoice_payments (\r\n				invoiceNumber, dateOfPayment, amountPaid, paymentMethod)\r\n			VALUES (\r\n				\" . (int)$invoiceId . \",\r\n				\" . (int)$payment[\'dateDonated\'] . \",\r\n				\'\" . $payment[\'amount\'] . \"\',\r\n				\'\" . $payment[\'paymentMethod\'] . \"\')\";\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'Could not create an invoice payment for comp ID \' . $payment[\'compId\'] . \' for \' . $payment[\'firstName\' ] . \' \' . $payment[\'lastName\'] . \'.\');\r\n			continue;\r\n		}\r\n	}\r\n\r\n	break;\r\n\r\n// -------------------------------- FIX ESTAT ENTRIES FOR NON-STANDARD UNITS ---------------------------------------------\r\ncase \'5\':\r\n\r\n	echo \"Converting eStats for non-standard units.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	// Get userId\'s of users who have non-standard units (ounces = unitId 5) for water entries.\r\n	$Q = \"SELECT u.id\r\n		FROM user_estats ue\r\n		INNER JOIN _users u ON (ue.userId = u.id)\r\n		WHERE ue.estatId = 2\r\n		AND ue.unitId = 5\";\r\n\r\n	$userIds = $SPADE[\'db\']->query($Q, DB_LIST);\r\n	$userIds = implode(\',\', $userIds);\r\n\r\n	$Q = \"UPDATE estat_entries \r\n		SET value = (value * 0.125)\r\n		WHERE estatId = 2\r\n		AND userId IN (\" . $userIds . \")\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError (\'An error occurred while attempting to update and convert water entries from ounces to glasses.\');\r\n		break;\r\n	}\r\n\r\n	// Get userId\'s of users who have non-standard units (steps = unitId 16) for distance exercised entries.\r\n	$Q = \"SELECT u.id\r\n		FROM user_estats ue\r\n		INNER JOIN _users u ON (ue.userId = u.id)\r\n		WHERE ue.estatId = 4\r\n		AND ue.unitId = 16\";\r\n\r\n	$userIds = $SPADE[\'db\']->query($Q, DB_LIST);\r\n	$userIds = implode(\',\', $userIds);\r\n\r\n	$Q = \"UPDATE estat_entries \r\n		SET value = (value * 0.0005)\r\n		WHERE estatId = 4\r\n		AND userId IN (\" . $userIds . \")\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError (\'An error occurred while attempting to update and convert distance exercised entries from steps to miles.\');\r\n		break;\r\n	}\r\n\r\n\r\n	break;\r\n\r\n// -------------------------------- CORRECT / REBUILD estat_entries FROM company_survey_estats ---------------------------------------------\r\ncase \'6\':\r\n\r\n	echo \"Rebuilding estat_entries from company_survey_estats<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	$Q = \"SELECT *\r\n		FROM company_survey_estats\";\r\n\r\n	$companySurveyEstats = $SPADE[\'db\']->query($Q);\r\n\r\n	foreach ($companySurveyEstats as $cse) {\r\n\r\n		$whereAddition = \'\';\r\n\r\n		if ($cse[\'dateStart\']) {\r\n			$whereAddition .= \' AND st.dateTaken > \' . $cse[\'dateStart\'];\r\n		}\r\n\r\n		if ($cse[\'dateEnd\']) {\r\n			$whereAddition .= \' AND st.dateTaken < \' . $cse[\'dateEnd\'];\r\n		}\r\n\r\n		$Q = \"SELECT ee.id\r\n			FROM surveys_taken st\r\n			INNER JOIN surveys s ON (st.surveyId = s.id)\r\n			INNER JOIN estat_entries ee ON (ee.userId = st.userId AND ee.estatId = \" . $cse[\'estatId\'] . \" AND ee.dateOfEntry = st.dateTaken)\r\n			WHERE s.id = \" . $cse[\'surveyId\'] . \"\r\n			AND (s.companyId = \" . $cse[\'companyId\'] . \" OR s.companyId = 0)\" . $whereAddition;\r\n		\r\n		display($Q);\r\n\r\n		$entryIds = trim(implode(\',\', $SPADE[\'db\']->query($Q, DB_LIST)));\r\n\r\n		if ($entryIds) {\r\n			$Q = \"DELETE FROM estat_entries WHERE id IN (\" . $entryIds . \")\";\r\n	\r\n			display($Q);\r\n	\r\n			$SPADE[\'db\']->query($Q);\r\n		}\r\n\r\n		$Q = \"SELECT st.*\r\n			FROM surveys_taken st\r\n			LEFT JOIN surveys s ON (st.surveyId = s.id)\r\n			WHERE s.id = \" . $cse[\'surveyId\'] . \"\r\n			AND (s.companyId = \" . $cse[\'companyId\'] . \" OR s.companyId = 0)\" . $whereAddition;\r\n\r\n		display($Q);\r\n\r\n		$surveysTaken = $SPADE[\'db\']->query($Q);\r\n\r\n		if (is_array($surveysTaken) AND 0 < sizeof($surveysTaken)) {\r\n			foreach ($surveysTaken as $st) {\r\n				$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n					VALUES (\r\n						\" . $st[\'userId\'] . \",\r\n						\" . $cse[\'estatId\'] . \",\r\n						\" . $st[\'pointsEarned\'] . \",\r\n						\" . $st[\'dateTaken\'] . \",\r\n						\" . $SPADE[\'user\']->id . \",\r\n						\" . time() . \")\";\r\n\r\n				display($Q);\r\n\r\n				$SPADE[\'db\']->query($Q);\r\n			}\r\n		}\r\n	}\r\n\r\n\r\n\r\n	break;\r\n\r\ndefault:\r\n	logError( \'Unknown confirm step number: \' . $_REQUEST[\'confirm\'] );\r\n	return;\r\n}\r\n\r\n\r\nif ($_REQUEST[\'confirm\'] <= LAST_STEP_NUMBER) {\r\n	echo \'<br /><br /><a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=\' . ((int)$_REQUEST[\'confirm\'] + 1) . \'\">Execute the next step of the PHP conversion process.</a>\';\r\n}\r\n\r\n\r\n?>'),(4177,258,0.20,'php','0','Added temp query param for step 6',1124984803,2,'63.226.108.67','<h1><a href=\"?pg=<?php echo $SPADE[\'page\'][\'name\']; ?>\">Version 2 (V2) Conversion: Overall Step 4</a></h1>\r\n<br />\r\n\r\n<?php\r\n\r\nif (FALSE == isset($_REQUEST[\'confirm\'])) {\r\n\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=1\">Click here to proceed with the PHP conversion (step 1).</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=2\">Execute step 2.</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=3\">Execute step 3.</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=4\">Execute step 4.</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=5\">Execute step 5.</a><br />\';\r\n	echo \'<a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=6\">Execute step 6 (rebuild estats from surveys taken).</a><br />\';\r\n	echo \'<br />\';\r\n	echo \'Make sure that you have executed steps 1 through 3 of the conversion process on a FRESH copy of of the old V1 EHC database.<br />\';\r\n\r\n	return;\r\n}\r\n\r\ndefine (\'LAST_STEP_NUMBER\', 6);\r\n\r\n/**\r\n * NOTES:\r\n \r\n*** Current eStats\r\n*\r\n\r\n1  weight  Your current weight  1  lifestyle  yes  2  1119738180  \r\n2  water  amount of water consumed  4  nutrition  yes  16  1119740160  \r\n3  time exercised  amount of time exercised  7  fitness  yes  16  1119740340  \r\n4  distance exercised  amount of distance exercised  9  fitness  yes  16  1119740400  \r\n5  fruits and vegetables  fruit and vegetables eaten  12  nutrition  yes  16  1119740460  \r\n6  sleep  amount of time slept at night  8  lifestyle  yes  16  1119740640  \r\n7  calorie intake  Calories eaten  18  nutrition  yes  2  1122444781  \r\n8  fat intake  Fat in all food eaten  17  nutrition  yes  2  1122444781  \r\n9  carb intake  Carbohydrates in all food eaten  17  nutrition  yes  2  1122444781  \r\n\r\n*** Current units\r\n*\r\n\r\n1  pounds  1  2  1119738422  \r\n2  kilograms  1  2  1119738444  \r\n4  glasses  1  16  1119742425  \r\n5  ounces  0  16  1119742425  \r\n7  minutes  0  16  1119742490  \r\n8  hours  2  16  1119742490  \r\n9  miles  2  16  1119742515  \r\n10  kilometers  2  16  1119742515  \r\n11  laps  1  16  1119742546  \r\n12  cups  1  16  1119742939  \r\n13  pieces  1  16  1119742953  \r\n16  steps  0  16  1119743102  \r\n17  grams  1  2  1122444589  \r\n18  calories  0  2  1122444589  \r\n\r\n */\r\n\r\necho \'<h2>PHP Conversion Step \' . (int)$_REQUEST[\'confirm\'] . \'</h2>\';\r\n\r\nswitch ((int)$_REQUEST[\'confirm\']) {\r\n// -------------------------------- USER ESTATS ---------------------------------------------\r\ncase \'1\':\r\n\r\n	echo \"Creating User eStats (determining which eStats to track) for all users.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	// Clear out table first (just in case)\r\n	$Q = \"DELETE FROM user_estats\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up all users to track weight with \'pounds\' as units\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT u.id AS \'userId\', 1 as \'estatId\', 1 AS \'unitId\', \'daily\' as \'frequency\'\r\n		FROM _users u\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up all users to track time exercised with \'minutes\' as units\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT u.id AS \'userId\', 3 as \'estatId\', 7 AS \'unitId\', \'daily\' as \'frequency\'\r\n		FROM _users u\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'distance exercised\' for users who had entries (estat 4, \'steps\' unit 16, \'miles\' unit 9)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT us.userId AS \'userId\', 4 AS \'estatId\', IF(avg(distanceExercised)>100,16,9) AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.distanceExercised > 0\r\n		GROUP BY us.userId\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'water\' for users who had entries (estat 2, \'ounces\' unit 5, \'glasses\' unit 4)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT us.userId AS \'userId\', 2 AS \'estatId\', IF(avg(water)>7,5,4) AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.water > 0\r\n		GROUP BY us.userId\";\r\n		\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'calories\' for users who had entries (estat 7, \'calories\' unit 18)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)\r\n		SELECT us.userId AS \'userId\', 7 AS \'estatId\', 18 AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.calories > 0\r\n		GROUP BY us.userId\";\r\n	\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'fat\' for users who had entries (estat 8, \'grams\' unit 17)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)		\r\n		SELECT us.userId AS \'userId\', 8 AS \'estatId\', 17 AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.fat > 0\r\n		GROUP BY us.userId\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Set up \'carbs\' for users who had entries (estat 9, \'grams\' unit 17)\r\n	$Q = \"INSERT INTO user_estats (userId, estatId, unitId, frequency)		\r\n		SELECT us.userId AS \'userId\', 9 AS \'estatId\', 17 AS \'unitId\', \'daily\' AS \'frequency\'\r\n		FROM user_statistics us \r\n		WHERE us.carbs > 0\r\n		GROUP BY us.userId\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	break;\r\n\r\n// -------------------------------- ESTAT ENTRIES ---------------------------------------------\r\ncase \'2\':\r\n\r\n	echo \"Creating eStat Entries for all users.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	// Clear out table first (just in case)\r\n	$Q = \"DELETE FROM estat_entries\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'weight\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 1 AS \'estatId\', us.weight AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.weight > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'water\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 2 AS \'estatId\', us.water AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.water > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'time exercised\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 3 AS \'estatId\', us.minutesExercise AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.minutesExercise > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'distance exercised\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 4 AS \'estatId\', us.distanceExercised AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.distanceExercised > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'calories\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 7 AS \'estatId\', us.calories AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.calories > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'fat\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 8 AS \'estatId\', us.fat AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.fat > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	// Insert \'carb\' records\r\n	$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n		SELECT us.userId, 9 AS \'estatId\', us.carbs AS \'value\', us.dateOfEntry, us.userId AS \'createdByUserId\', UNIX_TIMESTAMP(NOW()) AS \'dateCreated\'\r\n		FROM user_statistics us\r\n		WHERE us.carbs > 0\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError(\'An error occurred at \' . __FILE__ . \':\' . __LINE__ . \'.\');\r\n		return false;\r\n	}\r\n\r\n	break;\r\n\r\n// -------------------------------- COMPANY / GROUPS ---------------------------------------------\r\ncase \'3\':\r\n\r\n	echo \"Creating groups for all companies and group memberships for all users.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	// Create groups for companies\r\n	$Q = \"SELECT id, companyName, companyVanity, userId\r\n		FROM companies\";\r\n\r\n	$companies = $SPADE[\'db\']->query($Q);\r\n\r\n	foreach ($companies as $company) {\r\n		$Q = \"INSERT INTO _groups (name, description, about, ownerId)\r\n			VALUES (\'\" . $company[\'companyVanity\'] . \"\', \r\n				\'\" . $company[\'companyName\'] . \"\', \r\n				\'Company Group Account\', \r\n				\" . (int)$company[\'userId\'] . \")\";\r\n\r\n		$companyGroupId = $SPADE[\'db\']->query($Q);\r\n\r\n		if (FALSE == $companyGroupId) {\r\n			logError (\'An error occurred while attempting to create a group for company \"\' . $company[\'companyName\'] . \'\".\');\r\n			continue;\r\n		}\r\n\r\n		// Update companies with group IDs\r\n		$Q = \"UPDATE companies \r\n			SET groupId = \" . (int)$companyGroupId . \"\r\n			WHERE id = \" . (int)$company[\'id\'];\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'An error occurred while attempting to update the company \"\' . $company[\'companyName\'] . \'\" with its new group id (\' . $companyGroupId . \').\');\r\n			continue;\r\n		}\r\n\r\n		// Create group memberships for all users\r\n		$Q = \"INSERT INTO _group_users (groupId, userId, title)\r\n			SELECT \" . (int)$companyGroupId . \" AS \'groupId\', u.id AS \'userId\', \'Employee: \" . addslashes($company[\'companyName\']) . \"\' AS \'title\'\r\n			FROM _users u\r\n			WHERE u.companyId = \" . (int)$company[\'id\'];\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'An error occurred while attempting to create group memberships for employees of \"\' . $company[\'companyName\'] . \'\". It is possible this company has no registered employees.\');\r\n			//continue;\r\n		}\r\n\r\n		// Update group_forums table with now corresponding group ID\r\n		$Q = \"UPDATE group_forums\r\n			SET groupId = \" . (int)$companyGroupId . \"\r\n			WHERE groupId = \" . (int)$company[\'id\'];\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'An error occurred while attempting to update the company forums for \"\' . $company[\'companyName\'] . \'\". It is possible this company had no registered forums.\');\r\n			//continue;\r\n		}\r\n	\r\n		echo \'SUCCESS: \' . $company[\'id\'] . \'.) \' . $company[\'companyName\'] . \' -- \' . $company[\'companyVanity\'] . \'.ehealthcompete.com<br />\';\r\n	}\r\n\r\n\r\n	break;\r\n\r\n// -------------------------------- COMPETITIONS ---------------------------------------------\r\ncase \'4\':\r\n\r\n	echo \"Converting competition data.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	$scoringMethods = array(\r\n		\'Weight Lost\' => array( \'estatId\' => 1, \'basedOn\' => \'actual change\', \'polarity\' => \'negative\' ),\r\n		\'Percentage Weight Lost\' => array( \'estatId\' => 1, \'basedOn\' => \'percent change\', \'polarity\' => \'negative\' ),\r\n		\'Minutes Exercise\' => array( \'estatId\' => 3, \'basedOn\' => \'total\', \'polarity\' => \'positive\' ),\r\n		\'Distance Exercised\' => array( \'estatId\' => 4, \'basedOn\' => \'total\', \'polarity\' => \'positive\' ),\r\n		\'Weight Gained\' => array( \'estatId\' => 1, \'basedOn\' => \'actual change\', \'polarity\' => \'positive\')\r\n	);\r\n\r\n	/**		\r\n	1  weight  Your current weight  1  lifestyle  yes  2  1119738180  \r\n	2  water  amount of water consumed  4  nutrition  yes  16  1119740160  \r\n	3  time exercised  amount of time exercised  7  fitness  yes  16  1119740340  \r\n	4  distance exercised  amount of distance exercised  9  fitness  yes  16  1119740400  \r\n	5  fruits and vegetables  fruit and vegetables eaten  12  nutrition  yes  16  1119740460  \r\n	6  sleep  amount of time slept at night  8  lifestyle  yes  16  1119740640  \r\n	7  calorie intake  Calories eaten  18  nutrition  yes  2  1122444781  \r\n	8  fat intake  Fat in all food eaten  17  nutrition  yes  2  1122444781  \r\n	9  carb intake  Carbohydrates in all food eaten  17  nutrition  yes  2  1122444781  \r\n	**/\r\n\r\n\r\n	$Q = \"SELECT * FROM competitions_old\";\r\n\r\n	$competitions = $SPADE[\'db\']->query($Q);\r\n\r\n	// Copy main competition data over...\r\n	// Done in SQL step 1.\r\n\r\n	foreach ($competitions as $comp) {\r\n		// ----- CREATE COMPETITION PARAMETERS ----- //\r\n		$currentParameters = array();\r\n		$currentParameters[] = $comp[\'scoringMethod\'];		\r\n\r\n		// Create competition parameters\r\n		$Q = \"INSERT INTO competition_parameters (competitionId, estatId, basedOn, polarity, displayOrder)\r\n			VALUES (\" . (int)$comp[\'id\'] . \",\r\n				\" . (int)$scoringMethods[$comp[\'scoringMethod\']][\'estatId\'] . \",\r\n				\'\" . $scoringMethods[$comp[\'scoringMethod\']][\'basedOn\'] . \"\',\r\n				\'\" . $scoringMethods[$comp[\'scoringMethod\']][\'polarity\'] . \"\',\r\n				0)\";\r\n\r\n		if (FALSE == ($parameterId = $SPADE[\'db\']->query($Q))) {\r\n			logError (\'Unable to create (primary) competition parameter for competition ID \' . $comp[\'id\'] . \'.\');\r\n			continue;\r\n		}\r\n\r\n		// Add parameter \r\n		if ($comp[\'tieBreakerMethod\'] && !in_array($comp[\'tieBreakerMethod\'], $currentParameters)) {\r\n			$currentParameters[] = $comp[\'tieBreakerMethod\'];\r\n\r\n			$Q = \"INSERT INTO competition_parameters (competitionId, estatId, basedOn, polarity, displayOrder)\r\n				VALUES (\" . (int)$comp[\'id\'] . \",\r\n					\" . (int)$scoringMethods[$comp[\'tieBreakerMethod\']][\'estatId\'] . \",\r\n					\'\" . $scoringMethods[$comp[\'tieBreakerMethod\']][\'basedOn\'] . \"\',\r\n					\'\" . $scoringMethods[$comp[\'tieBreakerMethod\']][\'polarity\'] . \"\',\r\n					1)\";\r\n	\r\n			if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n				logError (\'Unable to create (primary) competition parameter for competition ID \' . $comp[\'id\'] . \'.\');\r\n				continue;\r\n			}\r\n		}\r\n\r\n		if ($comp[\'weeklyWinnersMethod1\'] && !in_array($comp[\'weeklyWinnersMethod1\'], $currentParameters)) {\r\n			$currentParameters[] = $comp[\'weeklyWinnersMethod1\'];\r\n\r\n			$Q = \"INSERT INTO competition_parameters (competitionId, estatId, basedOn, polarity, displayOrder)\r\n				VALUES (\" . (int)$comp[\'id\'] . \",\r\n					\" . (int)$scoringMethods[$comp[\'weeklyWinnersMethod1\']][\'estatId\'] . \",\r\n					\'\" . $scoringMethods[$comp[\'weeklyWinnersMethod1\']][\'basedOn\'] . \"\',\r\n					\'\" . $scoringMethods[$comp[\'weeklyWinnersMethod1\']][\'polarity\'] . \"\',\r\n					2)\";\r\n	\r\n			if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n				logError (\'Unable to create (primary) competition parameter for competition ID \' . $comp[\'id\'] . \'.\');\r\n				continue;\r\n			}\r\n		}\r\n\r\n		if ($comp[\'weeklyWinnersMethod2\'] && !in_array($comp[\'weeklyWinnersMethod2\'], $currentParameters)) {\r\n			$currentParameters[] = $comp[\'weeklyWinnersMethod2\'];\r\n\r\n			$Q = \"INSERT INTO competition_parameters (competitionId, estatId, basedOn, polarity, displayOrder)\r\n				VALUES (\" . (int)$comp[\'id\'] . \",\r\n					\" . (int)$scoringMethods[$comp[\'weeklyWinnersMethod2\']][\'estatId\'] . \",\r\n					\'\" . $scoringMethods[$comp[\'weeklyWinnersMethod2\']][\'basedOn\'] . \"\',\r\n					\'\" . $scoringMethods[$comp[\'weeklyWinnersMethod2\']][\'polarity\'] . \"\',\r\n					3)\";\r\n	\r\n			if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n				logError (\'Unable to create (primary) competition parameter for competition ID \' . $comp[\'id\'] . \'.\');\r\n				continue;\r\n			}\r\n		}\r\n\r\n\r\n		// ----- CREATE COMPETITION PRIZES ----- //\r\n		$Q = \"INSERT INTO competition_prizes (\r\n				competitionId, title, description, maxWinners, \r\n				frequency, andOr, dateStart, dateEnd )\r\n			VALUES (\" . (int)$comp[\'id\'] . \",\r\n				\'Competition Prize\',\r\n				\'\" . addslashes($comp[\'potDescription\']) . \"\',\r\n				1,\r\n				\'once\',\r\n				\'and\',\r\n				\" . (int)$comp[\'startDate\'] . \",\r\n				\" . (int)$comp[\'endDate\'] . \")\";\r\n\r\n		if (FALSE == ($prizeId = $SPADE[\'db\']->query($Q))) {\r\n			logError (\'Unable to create a competition prize for competition ID \' . (int)$comp[\'id\'] . \'.\');\r\n			continue;\r\n		}\r\n\r\n		\r\n		// ----- CREATE COMPETITION PRIZE PARAMETERS ----- //\r\n		$Q = \"INSERT INTO competition_prize_parameters (\r\n				competitionPrizeId, competitionParameterId)\r\n			VALUES (\" . (int)$prizeId . \",\r\n				\" . (int)$parameterId . \")\";\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'Unable to create a competition prize parameter for competition ID \' . (int)$comp[\'id\'] . \'.\');\r\n			continue;\r\n		}\r\n	}\r\n\r\n	// ----- CREATE INVOICES ----- //\r\n	$Q = \"SELECT cp.userId, u.firstName, u.lastName, c.companyName, u.address1, u.address2,\r\n			u.city, u.state, u.country, u.zip, u.phone1, u.email,\r\n			cp.amount, cp.dateDonated, cp.paymentMethod, cp.entryFee,\r\n			cp.compId, comp.title\r\n		FROM competition_pot cp\r\n		INNER JOIN _users u ON (cp.userId = u.id)\r\n		LEFT JOIN competitions comp ON (cp.compId = comp.id)\r\n		LEFT JOIN companies c ON (u.companyId = c.id)\";\r\n\r\n	$paymentDetails = $SPADE[\'db\']->query($Q);\r\n\r\n	// Continue if no entry fees were paid\r\n	if (FALSE == is_array($paymentDetails) || 0 == sizeof($paymentDetails)) {\r\n		continue;\r\n	}\r\n\r\n	foreach ($paymentDetails as $payment) {\r\n		$Q = \"INSERT INTO invoices (\r\n				userId, firstName, lastName, company,\r\n				address1, address2, city, state, country, zip, phone, email,\r\n				dateDue, amountDue)\r\n			VALUES (\r\n				\" . (int)$payment[\'userId\'] . \",\r\n				\'\" . addslashes($payment[\'firstName\']) . \"\',\r\n				\'\" . addslashes($payment[\'lastName\']) . \"\',\r\n				\'\" . addslashes($payment[\'companyName\']) . \"\',\r\n				\'\" . addslashes($payment[\'address1\']) . \"\',\r\n				\'\" . addslashes($payment[\'address2\']) . \"\',\r\n				\'\" . addslashes($payment[\'city\']) . \"\',\r\n				\'\" . addslashes($payment[\'state\']) . \"\',\r\n				\'\" . addslashes($payment[\'country\']) . \"\', \r\n				\'\" . $payment[\'zip\'] . \"\',\r\n				\'\" . $payment[\'phone1\'] . \"\',\r\n				\'\" . addslashes($payment[\'email\']) . \"\',\r\n				\" . (int)$payment[\'dateDonated\'] . \",\r\n				\'\" . $payment[\'entryFee\'] . \"\')\";\r\n\r\n		if (FALSE == ($invoiceId = $SPADE[\'db\']->query($Q))) {\r\n			logError (\'Could not create an invoice for competition payment for comp ID \' . $payment[\'compId\'] . \' for \' . $payment[\'firstName\'] . \' \' . $payment[\'lastName\'] . \'.\');\r\n			continue;\r\n		}\r\n\r\n		$Q = \"INSERT INTO competition_entry_fees (\r\n				competitionId, userId, amount, invoiceId)\r\n			VALUES (\r\n				\'\" . $payment[\'compId\'] . \"\',\r\n				\" . (int)$payment[\'userId\'] . \",\r\n				\'\" . $payment[\'amount\'] . \"\',\r\n				\" . (int)$invoiceId . \")\";\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'Unable to save the competition entry fee for comp ID \' . $payment[\'compId\'] . \' for \' . $payment[\'firstName\'] . \' \' . $payment[\'lastName\'] . \'.\');\r\n			continue;\r\n		}\r\n\r\n		$Q = \"INSERT INTO invoice_line_items (\r\n				invoiceNumber, description, price, quantity)\r\n			VALUES (\r\n				\" . (int)$invoiceId . \",\r\n				\'Competition entry fee, competition #\" . $payment[\'compId\'] . \"\',\r\n				\'\" . $payment[\'entryFee\'] . \"\', \r\n				1)\";\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'Could not create an invoice line item for comp ID \' . $payment[\'compId\'] . \' for \' . $payment[\'firstName\'] . \' \' . $payment[\'lastName\'] . \'.\');\r\n		}\r\n\r\n		$Q = \"INSERT INTO invoice_payments (\r\n				invoiceNumber, dateOfPayment, amountPaid, paymentMethod)\r\n			VALUES (\r\n				\" . (int)$invoiceId . \",\r\n				\" . (int)$payment[\'dateDonated\'] . \",\r\n				\'\" . $payment[\'amount\'] . \"\',\r\n				\'\" . $payment[\'paymentMethod\'] . \"\')\";\r\n\r\n		if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n			logError (\'Could not create an invoice payment for comp ID \' . $payment[\'compId\'] . \' for \' . $payment[\'firstName\' ] . \' \' . $payment[\'lastName\'] . \'.\');\r\n			continue;\r\n		}\r\n	}\r\n\r\n	break;\r\n\r\n// -------------------------------- FIX ESTAT ENTRIES FOR NON-STANDARD UNITS ---------------------------------------------\r\ncase \'5\':\r\n\r\n	echo \"Converting eStats for non-standard units.<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	// Get userId\'s of users who have non-standard units (ounces = unitId 5) for water entries.\r\n	$Q = \"SELECT u.id\r\n		FROM user_estats ue\r\n		INNER JOIN _users u ON (ue.userId = u.id)\r\n		WHERE ue.estatId = 2\r\n		AND ue.unitId = 5\";\r\n\r\n	$userIds = $SPADE[\'db\']->query($Q, DB_LIST);\r\n	$userIds = implode(\',\', $userIds);\r\n\r\n	$Q = \"UPDATE estat_entries \r\n		SET value = (value * 0.125)\r\n		WHERE estatId = 2\r\n		AND userId IN (\" . $userIds . \")\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError (\'An error occurred while attempting to update and convert water entries from ounces to glasses.\');\r\n		break;\r\n	}\r\n\r\n	// Get userId\'s of users who have non-standard units (steps = unitId 16) for distance exercised entries.\r\n	$Q = \"SELECT u.id\r\n		FROM user_estats ue\r\n		INNER JOIN _users u ON (ue.userId = u.id)\r\n		WHERE ue.estatId = 4\r\n		AND ue.unitId = 16\";\r\n\r\n	$userIds = $SPADE[\'db\']->query($Q, DB_LIST);\r\n	$userIds = implode(\',\', $userIds);\r\n\r\n	$Q = \"UPDATE estat_entries \r\n		SET value = (value * 0.0005)\r\n		WHERE estatId = 4\r\n		AND userId IN (\" . $userIds . \")\";\r\n\r\n	if (FALSE == $SPADE[\'db\']->query($Q)) {\r\n		logError (\'An error occurred while attempting to update and convert distance exercised entries from steps to miles.\');\r\n		break;\r\n	}\r\n\r\n\r\n	break;\r\n\r\n// -------------------------------- CORRECT / REBUILD estat_entries FROM company_survey_estats ---------------------------------------------\r\ncase \'6\':\r\n\r\n	echo \"Rebuilding estat_entries from company_survey_estats<br />\";\r\n	echo \"No error indicates success.<br />\";\r\n\r\n	$Q = \"SELECT *\r\n		FROM company_survey_estats\";\r\n\r\n	// Temp...\r\n	$Q .= \" WHERE surveyId = 30\";\r\n\r\n	$companySurveyEstats = $SPADE[\'db\']->query($Q);\r\n\r\n	foreach ($companySurveyEstats as $cse) {\r\n\r\n		$whereAddition = \'\';\r\n\r\n		if ($cse[\'dateStart\']) {\r\n			$whereAddition .= \' AND st.dateTaken > \' . $cse[\'dateStart\'];\r\n		}\r\n\r\n		if ($cse[\'dateEnd\']) {\r\n			$whereAddition .= \' AND st.dateTaken < \' . $cse[\'dateEnd\'];\r\n		}\r\n\r\n		$Q = \"SELECT ee.id\r\n			FROM surveys_taken st\r\n			INNER JOIN surveys s ON (st.surveyId = s.id)\r\n			INNER JOIN estat_entries ee ON (ee.userId = st.userId AND ee.estatId = \" . $cse[\'estatId\'] . \" AND ee.dateOfEntry = st.dateTaken)\r\n			WHERE s.id = \" . $cse[\'surveyId\'] . \"\r\n			AND (s.companyId = \" . $cse[\'companyId\'] . \" OR s.companyId = 0)\" . $whereAddition;\r\n		\r\n		display($Q);\r\n\r\n		$entryIds = trim(implode(\',\', $SPADE[\'db\']->query($Q, DB_LIST)));\r\n\r\n		if ($entryIds) {\r\n			$Q = \"DELETE FROM estat_entries WHERE id IN (\" . $entryIds . \")\";\r\n	\r\n			display($Q);\r\n	\r\n			$SPADE[\'db\']->query($Q);\r\n		}\r\n\r\n		$Q = \"SELECT st.*\r\n			FROM surveys_taken st\r\n			LEFT JOIN surveys s ON (st.surveyId = s.id)\r\n			WHERE s.id = \" . $cse[\'surveyId\'] . \"\r\n			AND (s.companyId = \" . $cse[\'companyId\'] . \" OR s.companyId = 0)\" . $whereAddition;\r\n\r\n		display($Q);\r\n\r\n		$surveysTaken = $SPADE[\'db\']->query($Q);\r\n\r\n		if (is_array($surveysTaken) AND 0 < sizeof($surveysTaken)) {\r\n			foreach ($surveysTaken as $st) {\r\n				$Q = \"INSERT INTO estat_entries (userId, estatId, value, dateOfEntry, createdByUserId, dateCreated)\r\n					VALUES (\r\n						\" . $st[\'userId\'] . \",\r\n						\" . $cse[\'estatId\'] . \",\r\n						\" . $st[\'pointsEarned\'] . \",\r\n						\" . $st[\'dateTaken\'] . \",\r\n						\" . $SPADE[\'user\']->id . \",\r\n						\" . time() . \")\";\r\n\r\n				display($Q);\r\n\r\n				$SPADE[\'db\']->query($Q);\r\n			}\r\n		}\r\n	}\r\n\r\n\r\n\r\n	break;\r\n\r\ndefault:\r\n	logError( \'Unknown confirm step number: \' . $_REQUEST[\'confirm\'] );\r\n	return;\r\n}\r\n\r\n\r\nif ($_REQUEST[\'confirm\'] <= LAST_STEP_NUMBER) {\r\n	echo \'<br /><br /><a href=\"index.php?pg=\' . $SPADE[\'page\'][\'name\'] . \'&confirm=\' . ((int)$_REQUEST[\'confirm\'] + 1) . \'\">Execute the next step of the PHP conversion process.</a>\';\r\n}\r\n\r\n\r\n?>'),(4179,126,0.26,'smarty','0','attempting to remove smarty code from included page',1125379691,2,'24.2.76.126','{assign var=\"pgLayout\" value=\"layouts/default.tpl\"}\r\n\r\n{stored_object name=$smarty.session.session_id|truncate:10:\"\" type=\"signup\" from=\"signup\" assign=\"signup\"}\r\n<!-- {$signup.return} -->\r\n{if $smarty.request.confirmReset}{stored_object name=$smarty.session.session_id|truncate:10:\"\" type=\"signup\" destroy=\"true\"}{/if}\r\n\r\n{select_query assign=\"termsOfUse\" return=\"val\"}\r\n	h.content \r\nFROM _toc t \r\n	INNER JOIN _pages p ON (t.pageId = p.id)\r\n	INNER JOIN _page_history h ON (h.pageId = p.id)\r\n	LEFT JOIN _users u ON (h.userId = u.id)\r\nWHERE\r\n	t.pageName = \'terms\' AND h.isActive = \'1\'\r\nORDER BY h.version DESC\r\n{/select_query}\r\n\r\n{assign var=\"search\" value=$none|cat:\"/\\\\\":$smarty.ldelim:\"[^\\\\\":$smarty.rdelim:\"]*\\\\\":$smarty.rdelim:\"/\"}\r\n\r\n{$termsOfUse|regex_replace:$search:\"\"}\r\n\r\n{toc_next assign=\"next\"}\r\n{toc_prev assign=\"prev\"}\r\n<form name=\"signup\" method=\"post\" action=\"index.php\" style=\"margin:0px;\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$next.pageName}\">\r\n<input type=\"hidden\" name=\"no_expire\" value=\"true\">\r\n<input type=\"hidden\" name=\"email\" value=\"{$signup.email}\">\r\n<input type=\"hidden\" name=\"signup[return]\" value=\"{$signup.return}\">\r\n\r\n<div align=\"center\" class=\"quote\">\r\n	I, {$signup.firstName} {$signup.lastName}, agree to these terms:<br />\r\n	<em>\r\n	<input type=\"radio\" name=\"signup[agree]\" value=\"Yes\"> Yes &nbsp; <input type=\"radio\" name=\"signup[agree]\" value=\"No\"> No\r\n	</em>\r\n</div>\r\n<br />\r\n<h2 class=\"withBG\">Sign up for our Newsletter?</h2>\r\n<p>eHealthCompete sends its users useful tips and advice from the health and wellness world, if you would like to add yourself to this group of recipients, select \'Yes\' below.</p>\r\n\r\n<div style=\"text-align:center;\"><input type=\"radio\" name=\"newsletterAction\" value=\"add\" checked=\"checked\"> Yes <input type=\"radio\" name=\"newsletterAction\" value=\"\"> No</div>\r\n\r\n<div align=\"right\">\r\n	<br />\r\n	{if $prev.pageName}<input type=\"image\" src=\"{$skinFolder}images/btn_back.gif\" class=\"btn_image\" onclick=\"pg.value=\'{$prev.pageName}\';\">&nbsp; {/if}\r\n	{if $next.pageName}<input type=\"image\" src=\"{$skinFolder}images/btn_next.gif\" class=\"btn_image\" onclick=\"pg.value=\'{$next.pageName}\';\">{/if}\r\n</div>\r\n\r\n{stored_object_fill_form object=$signup name=\"signup\"}\r\n\r\n</form>'),(4180,126,0.27,'smarty','1','attempting to remove smarty code from included page',1125379844,2,'24.2.76.126','{assign var=\"pgLayout\" value=\"layouts/default.tpl\"}\r\n\r\n{stored_object name=$smarty.session.session_id|truncate:10:\"\" type=\"signup\" from=\"signup\" assign=\"signup\"}\r\n<!-- {$signup.return} -->\r\n{if $smarty.request.confirmReset}{stored_object name=$smarty.session.session_id|truncate:10:\"\" type=\"signup\" destroy=\"true\"}{/if}\r\n\r\n{select_query assign=\"termsOfUse\" return=\"val\"}\r\n	h.content \r\nFROM _toc t \r\n	INNER JOIN _pages p ON (t.pageId = p.id)\r\n	INNER JOIN _page_history h ON (h.pageId = p.id)\r\n	LEFT JOIN _users u ON (h.userId = u.id)\r\nWHERE\r\n	t.pageName = \'terms\' AND h.isActive = \'1\'\r\nORDER BY h.version DESC\r\n{/select_query}\r\n\r\n{capture name=\"search\"}{literal}/\\{[^\\}]*\\}/{/literal}{/capture}\r\n\r\n{$termsOfUse|regex_replace:$smarty.capture.search:\"\"}\r\n\r\n{toc_next assign=\"next\"}\r\n{toc_prev assign=\"prev\"}\r\n<form name=\"signup\" method=\"post\" action=\"index.php\" style=\"margin:0px;\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$next.pageName}\">\r\n<input type=\"hidden\" name=\"no_expire\" value=\"true\">\r\n<input type=\"hidden\" name=\"email\" value=\"{$signup.email}\">\r\n<input type=\"hidden\" name=\"signup[return]\" value=\"{$signup.return}\">\r\n\r\n<div align=\"center\" class=\"quote\">\r\n	I, {$signup.firstName} {$signup.lastName}, agree to these terms:<br />\r\n	<em>\r\n	<input type=\"radio\" name=\"signup[agree]\" value=\"Yes\"> Yes &nbsp; <input type=\"radio\" name=\"signup[agree]\" value=\"No\"> No\r\n	</em>\r\n</div>\r\n<br />\r\n<h2 class=\"withBG\">Sign up for our Newsletter?</h2>\r\n<p>eHealthCompete sends its users useful tips and advice from the health and wellness world, if you would like to add yourself to this group of recipients, select \'Yes\' below.</p>\r\n\r\n<div style=\"text-align:center;\"><input type=\"radio\" name=\"newsletterAction\" value=\"add\" checked=\"checked\"> Yes <input type=\"radio\" name=\"newsletterAction\" value=\"\"> No</div>\r\n\r\n<div align=\"right\">\r\n	<br />\r\n	{if $prev.pageName}<input type=\"image\" src=\"{$skinFolder}images/btn_back.gif\" class=\"btn_image\" onclick=\"pg.value=\'{$prev.pageName}\';\">&nbsp; {/if}\r\n	{if $next.pageName}<input type=\"image\" src=\"{$skinFolder}images/btn_next.gif\" class=\"btn_image\" onclick=\"pg.value=\'{$next.pageName}\';\">{/if}\r\n</div>\r\n\r\n{stored_object_fill_form object=$signup name=\"signup\"}\r\n\r\n</form>'),(4181,113,1.52,'smarty','0','Now enforces that the company ID is known.',1125380748,2,'24.2.76.126','{assign var=\"pgLayout\" value=\"layouts/default.tpl\"}\r\n{stored_object name=$smarty.session.session_id|truncate:10:\"\" type=\"signup\" from=\"signup\" assign=\"signup\"}\r\n\r\n{if $smarty.request.confirmReset}{stored_object name=$smarty.session.session_id|truncate:10:\"\" type=\"signup\" destroy=\"true\"}{/if}\r\n{assign var=\"return\" value=$smarty.request.return|default:$signup.return|default:\"my_competitions/available\"}\r\n<!-- {$return} -->\r\n{if $user->isLoggedIn() and $return neq \"\"}\r\n	{if $return eq \"home\"}\r\n		{message type=\"error\" value=\"You cannot sign up for a membership when you are already logged in.\"}\r\n	{/if}\r\n	{store_messages}\r\n	{redirect href=\"?pg=`$return`\"}\r\n{/if}\r\n{if not $smarty.session.company.id}\r\n	{message type=\"error\" value=\"Unable to determine your company. It is possible you were given an incorrect link. You should go to <b>http://yourcompany.ehealthcompete.com/signup/begin</b> where <b>yourcompany</b> is the name of your company.\"}\r\n	{message type=\"error\" value=\"If you need assistance, please <a href=\\\"?pg=contact\\\">contact us</a>.\"}\r\n	{store_messages}\r\n	{redirect href=\"?pg=`$return`\"}\r\n{/if}\r\n\r\n<h1 class=\"underline\">Sign Up - Step 1</h1>\r\nCreating your <em>FREE</em> membership is simple.  Just fill out the forms below and click Next.<br />\r\n\r\n<table cellpadding=\"0\" cellspacing=\"0\"><tr><td>\r\n\r\n<div class=\"chunk300\">\r\n	<form name=\"loginForm2\" method=\"post\" action=\"index.php\" style=\"margin:3px;\">\r\n	<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n	<input type=\"hidden\" name=\"return\" value=\"{$smarty.request.return|default:$signup.returndefault:\"home\"}\" />\r\n	<input type=\"hidden\" name=\"no_expire\" value=\"true\" />\r\n	<h2 class=\"withBG\">Already a Member?</h2>\r\n		<div><a href=\"javascript://\" onclick=\"toggle(\'logInNow\');\">Log in now.</a></div>\r\n		<div id=\"logInNow\" style=\"display:none;\">\r\n		Username: <input type=\"text\" name=\"username\" class=\"textInput\" size=\"12\" /><br />\r\n		Password: <input type=\"password\" name=\"password\" class=\"textInput\" size=\"12\" /><br />\r\n		<div class=\"underline\">&nbsp;</div>\r\n		<a href=\"javascript:document.loginForm2.submit();\">Submit</a> | <a href=\"javascript:doForgotPassword();\">Forgot Password?</a>\r\n		</div>\r\n	</form>\r\n</div>\r\n<div class=\"underline\" style=\"clear:left;\"></div>\r\n{toc_next assign=\"next\"}\r\n{toc_prev assign=\"prev\"}\r\n<form name=\"signup\" method=\"post\" action=\"index.php\" style=\"margin:0px;\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$next.pageName}\">\r\n<input type=\"hidden\" name=\"no_expire\" value=\"true\">\r\n<input type=\"hidden\" id=\"signupReturn\" name=\"signup[return]\" value=\"{$return}\">\r\n<input type=\"hidden\" name=\"signup[companyId]\" value=\"{$smarty.session.company.id}\" />\r\n\r\n<table><tr><td>\r\n\r\n<div class=\"chunk300 h150 w300\">\r\n<h2 class=\"withBG\">Create your Membership </h2>\r\n	*First Name:\r\n	<input type=\"text\" name=\"signup[firstName]\" class=\"textInput\" size=\"20\" /><br />\r\n\r\n	*Last Name:\r\n	<input type=\"text\" name=\"signup[lastName]\" class=\"textInput\" size=\"20\" /><br />\r\n\r\n	*E-mail:\r\n	<input type=\"text\" name=\"signup[email]\" class=\"textInput\" size=\"30\" /><br />\r\n\r\n	*Desired Username:\r\n	<input type=\"text\" name=\"signup[username]\" class=\"textInput\" size=\"12\"><br />\r\n</div>\r\n\r\n<div class=\"chunk300\">\r\n<h2 class=\"withBG\">Password</h2>\r\n{if $signup.password}\r\n	<small>You have already chosen a valid password. If you would like to choose a different one, enter it below and confirm it.</small><br /><br />\r\n{/if}\r\n	*Choose Your Password:\r\n	<input type=\"password\" name=\"signupSecure[password]\" size=\"12\" class=\"textInput\"><br />\r\n	<small>(Password must be at least 8 characters long)</small><br />\r\n\r\n	*Confirm Your Password:\r\n	<input type=\"password\" name=\"signupSecure[passwordConfirm]\" size=\"12\" class=\"textInput\"><br />\r\n</div>\r\n\r\n</td><td valign=\"top\">\r\n\r\n<div class=\"chunk300 w300\">\r\n	<h2 class=\"withBG\">Shipping &amp; Contact Address</h2>\r\n	\r\n	<div id=\"addressInfo\" style=\"display:block; width:auto;\">\r\n	*Address:\r\n	<input type=\"text\" name=\"signup[address1]\" value=\"{$smarty.request.signup.address1}\" class=\"textInput\" style=\"width:200px;\" /><br />\r\n	Line 2:\r\n	<input type=\"text\" name=\"signup[address2]\" value=\"{$smarty.request.signup.address2}\" class=\"textInput\" style=\"width:200px;\" /><br />\r\n\r\n	*City:\r\n	<input type=\"text\" name=\"signup[city]\" value=\"{$smarty.request.signup.city}\" class=\"textInput\" style=\"width:200px;\" /><br />\r\n\r\n	*State, *Zip:\r\n	<input type=\"text\" name=\"signup[state]\" value=\"{$smarty.request.signup.state}\" class=\"textInput\" style=\"width:30px;\" maxlength=\"2\" />\r\n	<input type=\"text\" name=\"signup[zip]\" value=\"{$smarty.request.signup.zip}\" class=\"textInput\" style=\"width:50px;\" /><br />\r\n	<div id=\"signupstate\" style=\"text-align:left; margin-left:200px; position:absolute; background-color:#fff; border:1px solid black;\"></div>\r\n\r\n	*Country:\r\n	<input type=\"text\" name=\"signup[country]\" value=\"{$smarty.request.signup.country}\" class=\"textInput\" style=\"width:200px;\" maxlength=\"30\" /><br />\r\n	<div id=\"signupcountry\" style=\"text-align:left; float:left; margin-left:100px; position:absolute; background-color:#fff; border:1px solid black;\"></div>\r\n\r\n	Phone:\r\n	<input type=\"text\" name=\"signup[phone1]\" value=\"{$smarty.request.signup.phone1}\" class=\"textInput\" style=\"width:200px;\" maxlength=\"80\" /><br />\r\n\r\n	Phone 2:\r\n	<input type=\"text\" name=\"signup[phone2]\" value=\"{$smarty.request.signup.phone2}\" class=\"textInput\" style=\"width:200px;\" maxlength=\"80\" /><br />\r\n\r\n	</div>\r\n</div>\r\n<div style=\"clear:left;\">* indicates a required field</div>\r\n</td></tr></table>\r\n\r\n{if $modules.spadeAutoComplete2}\r\n	{capture name=\"headAddendum\"}\r\n	<script language=\"javascript\" src=\"{$modules.spadeAutoComplete2}\"></script>\r\n	<script language=\"javascript\" src=\"js/auto-complete_states.js\"></script>\r\n	<script language=\"javascript\" src=\"js/auto-complete_countries.js\"></script>\r\n	{/capture}\r\n	<script language=\"javascript\">\r\n		initAutoComplete(\'signup[state]\', \'signupstate\', states, true);\r\n		initAutoComplete(\'signup[country]\', \'signupcountry\', countries, true);\r\n	</script>\r\n{/if}\r\n</td></tr></table>\r\n\r\n<div class=\"hBox\" align=\"right\">\r\n	<br />\r\n	{if $prev.pageName}<input type=\"image\" src=\"{$skinFolder}images/btn_back.gif\" class=\"btn_image\" onclick=\"pg.value=\'{$prev.pageName}\';\"><!-- <input type=\"submit\" class=\"btn\" value=\"&nbsp;&lt;&lt; Back&nbsp;\" onclick=\"pg.value=\'{$prev.pageName}\';\"> |-->&nbsp; {/if}\r\n	{if $next.pageName}<input type=\"image\" src=\"{$skinFolder}images/btn_next.gif\" class=\"btn_image\"> <!-- <input type=\"submit\" class=\"btn\" value=\"&nbsp;Next &gt;&gt;&nbsp;\"> -->	{/if}\r\n</div>\r\n\r\n{stored_object_fill_form object=$signup name=\"signup\"}\r\n<script language=\"javascript\">document.getElementById(\'signupReturn\').value = \'{$return}\';</script>\r\n\r\n</form>'),(4195,261,0.18,'smarty','0','Page created.',1126213492,3,'216.194.127.150','<h1>{$page.title}</h1>\r\n\r\n{* display var=$smarty.session.company *}\r\n\r\n{include_php file=\"shared_handle:preferences/groupUpdate\"}\r\n\r\n{assign var=\"currentCategory\" value=\"\"}\r\n\r\n<form method=\"post\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n\r\n{literal}\r\n<script type=\"text/javascript\">\r\nfunction checkNumber(value, min, max, precision) {\r\n	if(value == \'\') return;\r\n	var message = \'\';\r\n	if(value < min || value > max) {\r\n		message = \'Value must be between \' + min + \' and \' + max + \'.\\n\\n\';\r\n		if(precision > 0) {\r\n			message += \'NOTE: Value may be truncated after \' + precision + \' decimal places.\';\r\n		}\r\n	}\r\n	if (value.match(/.*\\..*\\./)) {\r\n		message += \'Please enter a valid number.\';\r\n	}\r\n	if(message) alert(message);\r\n}\r\n</script>\r\n{/literal}\r\n{* display var=$prefValues *}\r\n<table>\r\n{foreach from=$aPrefs item=row}\r\n{* display var=$row *}\r\n{assign var=\"lockedName\" value=\"`$row.name`_locked\"}\r\n{if $currentCategory neq $row.category}\r\n	{assign var=\"currentCategory\" value=$row.category}\r\n	<tr><td colspan=\"3\"><h2 class=\"withBG\">{$currentCategory}</h2></td></tr>\r\n{/if}\r\n<tr><td valign=\"top\">{$row.description}</td>\r\n{if $row.inputType|test_or:\"select-one\":\"select-multiple\":\"radios\":\"checkboxes\"}\r\n	{assign_array var=\"aOptions\" values=$row.validInput}\r\n	{assign_array var=\"aValues\" values=$prefValues[$row.name]}\r\n	{assign_array var=\"aDefaults\" values=$row.defaultValue}\r\n	{* display var=$aDefaults *}\r\n	{* display var=$aValues *}\r\n{/if}\r\n	<td valign=\"top\">\r\n{if $row.inputType eq \"string\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" maxlength=\"{$row.validInput}\" name=\"prefs[{$row.name}]\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n{elseif $row.inputType eq \"integer\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9]/))this.value = this.value.replace(/[^0-9]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n{elseif $row.inputType eq \"float\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9\\.]/))this.value = this.value.replace(/[^0-9\\.]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n{elseif $row.inputType eq \'select-one\' OR $row.inputType eq \'select-multiple\'}\r\n	<select name=\"prefs[{$row.name}]{if $row.inputType eq \'select-multiple\'}[]\" multiple=\"multiple\" size=\"{$row.inputSize}{/if}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if}>\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<option value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option|@in_array:$aValues)} selected=\"selected\"{/if}>{$option}</option>\r\n	{/foreach}</select>\r\n{elseif $row.inputType eq \"radios\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"radio\" name=\"prefs[{$row.name}]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option eq $prefValues[$row.name])} checked=\"checked\"{/if}{if $prefValues[$lockedName]} disabled=\"disabled\"{/if}> {$option}<br />\r\n	{/foreach}\r\n{elseif $row.inputType eq \"checkboxes\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"checkbox\" name=\"prefs[{$row.name}][]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND !$row.name|@inArray:$savedPrefs AND $option|@inArray:$aDefaults) OR ($option|@inArray:$aValues)} checked=\"checked\"{/if}{if $prefValues[$lockedName]} disabled=\"disabled\"{/if}> {$option}<br />\r\n	{/foreach}\r\n	<input type=\"hidden\" name=\"prefs[{$row.name}][]\" value=\"END:{$row.name}\" /> \r\n{elseif $row.inputType eq \"regex\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onchange=\"if(!this.value.match({$row.validInput})) alert (\'\\\'\' + this.value + \'\\\' is not valid for \\\'{$row.description}\\\'.\')\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n{else}\r\n	Unrecognized Input Type! <b>({$row.inputType})</b>\r\n{/if}\r\n	</td>\r\n	<td><input type=\"radio\" name=\"userOverride[{$row.name}]\" value=\"0\" /> No<br />\r\n	    <input type=\"radio\" name=\"userOverride[{$row.name}]\" value=\"1\" /> Yes</td>\r\n</tr>\r\n{/foreach}\r\n</tr>\r\n</table>\r\n\r\n<div align=\"right\">\r\n	<input type=\"submit\" name=\"prefAction\" value=\"Save Changes\" />\r\n</div>\r\n</form>'),(4196,261,0.19,'smarty','0','Page created.',1126213582,3,'216.194.127.150','<h1>{$page.title}</h1>\r\n\r\n{* display var=$smarty.session.company *}\r\n\r\n{include_php file=\"shared_handle:preferences/groupUpdate\"}\r\n\r\n{assign var=\"currentCategory\" value=\"\"}\r\n\r\n<form method=\"post\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n\r\n{literal}\r\n<script type=\"text/javascript\">\r\nfunction checkNumber(value, min, max, precision) {\r\n	if(value == \'\') return;\r\n	var message = \'\';\r\n	if(value < min || value > max) {\r\n		message = \'Value must be between \' + min + \' and \' + max + \'.\\n\\n\';\r\n		if(precision > 0) {\r\n			message += \'NOTE: Value may be truncated after \' + precision + \' decimal places.\';\r\n		}\r\n	}\r\n	if (value.match(/.*\\..*\\./)) {\r\n		message += \'Please enter a valid number.\';\r\n	}\r\n	if(message) alert(message);\r\n}\r\n</script>\r\n{/literal}\r\n{* display var=$prefValues *}\r\n<table>\r\n{foreach from=$aPrefs item=row}\r\n{* display var=$row *}\r\n{assign var=\"lockedName\" value=\"`$row.name`_locked\"}\r\n{if $currentCategory neq $row.category}\r\n	{assign var=\"currentCategory\" value=$row.category}\r\n	<tr><td colspan=\"3\"><h2 class=\"withBG\">{$currentCategory}</h2></td></tr>\r\n{/if}\r\n<tr><td valign=\"top\">{$row.description}</td>\r\n{if $row.inputType|test_or:\"select-one\":\"select-multiple\":\"radios\":\"checkboxes\"}\r\n	{assign_array var=\"aOptions\" values=$row.validInput}\r\n	{assign_array var=\"aValues\" values=$prefValues[$row.name]}\r\n	{assign_array var=\"aDefaults\" values=$row.defaultValue}\r\n	{* display var=$aDefaults *}\r\n	{* display var=$aValues *}\r\n{/if}\r\n	<td valign=\"top\">\r\n{if $row.inputType eq \"string\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" maxlength=\"{$row.validInput}\" name=\"prefs[{$row.name}]\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n{elseif $row.inputType eq \"integer\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9]/))this.value = this.value.replace(/[^0-9]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n{elseif $row.inputType eq \"float\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9\\.]/))this.value = this.value.replace(/[^0-9\\.]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n{elseif $row.inputType eq \'select-one\' OR $row.inputType eq \'select-multiple\'}\r\n	<select name=\"prefs[{$row.name}]{if $row.inputType eq \'select-multiple\'}[]\" multiple=\"multiple\" size=\"{$row.inputSize}{/if}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if}>\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<option value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option|@in_array:$aValues)} selected=\"selected\"{/if}>{$option}</option>\r\n	{/foreach}</select>\r\n{elseif $row.inputType eq \"radios\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"radio\" name=\"prefs[{$row.name}]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option eq $prefValues[$row.name])} checked=\"checked\"{/if}{if $prefValues[$lockedName]} disabled=\"disabled\"{/if}> {$option}<br />\r\n	{/foreach}\r\n{elseif $row.inputType eq \"checkboxes\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"checkbox\" name=\"prefs[{$row.name}][]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND !$row.name|@inArray:$savedPrefs AND $option|@inArray:$aDefaults) OR ($option|@inArray:$aValues)} checked=\"checked\"{/if}{if $prefValues[$lockedName]} disabled=\"disabled\"{/if}> {$option}<br />\r\n	{/foreach}\r\n	<input type=\"hidden\" name=\"prefs[{$row.name}][]\" value=\"END:{$row.name}\" /> \r\n{elseif $row.inputType eq \"regex\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onchange=\"if(!this.value.match({$row.validInput})) alert (\'\\\'\' + this.value + \'\\\' is not valid for \\\'{$row.description}\\\'.\')\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n{else}\r\n	Unrecognized Input Type! <b>({$row.inputType})</b>\r\n{/if}\r\n	</td>\r\n	<td><input type=\"checkbox\" name=\"userOverride[{$row.name}]\" value=\"1\" /> User Override?</td>\r\n</tr>\r\n{/foreach}\r\n</tr>\r\n</table>\r\n\r\n<div align=\"right\">\r\n	<input type=\"submit\" name=\"prefAction\" value=\"Save Changes\" />\r\n</div>\r\n</form>'),(4197,261,0.20,'smarty','0','Page created.',1126214451,3,'216.194.127.150','<h1>{$page.title}</h1>\r\n\r\n{* display var=$smarty.session.company *}\r\n\r\n{include_php file=\"shared_handle:preferences/groupUpdate\"}\r\n\r\n{assign var=\"currentCategory\" value=\"\"}\r\n\r\n<form method=\"post\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n\r\n{literal}\r\n<script type=\"text/javascript\">\r\nfunction checkNumber(value, min, max, precision) {\r\n	if(value == \'\') return;\r\n	var message = \'\';\r\n	if(value < min || value > max) {\r\n		message = \'Value must be between \' + min + \' and \' + max + \'.\\n\\n\';\r\n		if(precision > 0) {\r\n			message += \'NOTE: Value may be truncated after \' + precision + \' decimal places.\';\r\n		}\r\n	}\r\n	if (value.match(/.*\\..*\\./)) {\r\n		message += \'Please enter a valid number.\';\r\n	}\r\n	if(message) alert(message);\r\n}\r\n</script>\r\n{/literal}\r\n{* display var=$prefValues *}\r\n<table>\r\n{foreach from=$aPrefs item=row}\r\n{* display var=$row *}\r\n{assign var=\"lockedName\" value=\"`$row.name`_locked\"}\r\n{if $currentCategory neq $row.category}\r\n	{assign var=\"currentCategory\" value=$row.category}\r\n	<tr><td colspan=\"3\"><h2 class=\"withBG\">{$currentCategory}</h2></td></tr>\r\n{/if}\r\n<tr><td valign=\"top\">{$row.description}</td>\r\n{if $row.inputType|test_or:\"select-one\":\"select-multiple\":\"radios\":\"checkboxes\"}\r\n	{assign_array var=\"aOptions\" values=$row.validInput}\r\n	{assign_array var=\"aValues\" values=$prefValues[$row.name]}\r\n	{assign_array var=\"aDefaults\" values=$row.defaultValue}\r\n	{* display var=$aDefaults *}\r\n	{* display var=$aValues *}\r\n{/if}\r\n	<td valign=\"top\">\r\n{if $row.inputType eq \"string\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" maxlength=\"{$row.validInput}\" name=\"prefs[{$row.name}]\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n{elseif $row.inputType eq \"integer\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9]/))this.value = this.value.replace(/[^0-9]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n{elseif $row.inputType eq \"float\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9\\.]/))this.value = this.value.replace(/[^0-9\\.]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n{elseif $row.inputType eq \'select-one\' OR $row.inputType eq \'select-multiple\'}\r\n	<select name=\"prefs[{$row.name}]{if $row.inputType eq \'select-multiple\'}[]\" multiple=\"multiple\" size=\"{$row.inputSize}{/if}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if}>\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<option value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option|@in_array:$aValues)} selected=\"selected\"{/if}>{$option}</option>\r\n	{/foreach}</select>\r\n{elseif $row.inputType eq \"radios\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"radio\" name=\"prefs[{$row.name}]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option eq $prefValues[$row.name])} checked=\"checked\"{/if}{if $prefValues[$lockedName]} disabled=\"disabled\"{/if}> {$option}<br />\r\n	{/foreach}\r\n{elseif $row.inputType eq \"checkboxes\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"checkbox\" name=\"prefs[{$row.name}][]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND !$row.name|@inArray:$savedPrefs AND $option|@inArray:$aDefaults) OR ($option|@inArray:$aValues)} checked=\"checked\"{/if}{if $prefValues[$lockedName]} disabled=\"disabled\"{/if}> {$option}<br />\r\n	{/foreach}\r\n	<input type=\"hidden\" name=\"prefs[{$row.name}][]\" value=\"END:{$row.name}\" /> \r\n{elseif $row.inputType eq \"regex\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onchange=\"if(!this.value.match({$row.validInput})) alert (\'\\\'\' + this.value + \'\\\' is not valid for \\\'{$row.description}\\\'.\')\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n{else}\r\n	Unrecognized Input Type! <b>({$row.inputType})</b>\r\n{/if}\r\n	</td>\r\n	<td nowrap=\"nowrap\" valign=\"top\"><input type=\"checkbox\" name=\"userOverride[{$row.name}]\" value=\"1\"{if $lockedName neq 1} checked=\"checked\"{/if} /> User Overridable?</td>\r\n</tr>\r\n{/foreach}\r\n</tr>\r\n</table>\r\n\r\n<div align=\"right\">\r\n	<input type=\"submit\" name=\"prefAction\" value=\"Save Changes\" />\r\n</div>\r\n</form>'),(4198,261,0.21,'smarty','0','Page created.',1126214732,3,'216.194.127.150','<h1>{$page.title}</h1>\r\n\r\n{* display var=$smarty.session.company *}\r\n\r\n{include_php file=\"shared_handle:preferences/groupUpdate\"}\r\n\r\n{assign var=\"currentCategory\" value=\"\"}\r\n\r\n<form method=\"post\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n\r\n{literal}\r\n<script type=\"text/javascript\">\r\nfunction checkNumber(value, min, max, precision) {\r\n	if(value == \'\') return;\r\n	var message = \'\';\r\n	if(value < min || value > max) {\r\n		message = \'Value must be between \' + min + \' and \' + max + \'.\\n\\n\';\r\n		if(precision > 0) {\r\n			message += \'NOTE: Value may be truncated after \' + precision + \' decimal places.\';\r\n		}\r\n	}\r\n	if (value.match(/.*\\..*\\./)) {\r\n		message += \'Please enter a valid number.\';\r\n	}\r\n	if(message) alert(message);\r\n}\r\n</script>\r\n{/literal}\r\n{* display var=$prefValues *}\r\n<table>\r\n{foreach from=$aPrefs item=row}\r\n{* display var=$row *}\r\n{assign var=\"lockedName\" value=\"`$row.name`_locked\"}\r\n{if $currentCategory neq $row.category}\r\n	{assign var=\"currentCategory\" value=$row.category}\r\n	<tr><td colspan=\"3\"><h2 class=\"withBG\">{$currentCategory}</h2></td></tr>\r\n{/if}\r\n<tr><td valign=\"top\">{$row.description}</td>\r\n{if $row.inputType|test_or:\"select-one\":\"select-multiple\":\"radios\":\"checkboxes\"}\r\n	{assign_array var=\"aOptions\" values=$row.validInput}\r\n	{assign_array var=\"aValues\" values=$prefValues[$row.name]}\r\n	{assign_array var=\"aDefaults\" values=$row.defaultValue}\r\n	{* display var=$aDefaults *}\r\n	{* display var=$aValues *}\r\n{/if}\r\n	<td valign=\"top\">\r\n{if $row.inputType eq \"string\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" maxlength=\"{$row.validInput}\" name=\"prefs[{$row.name}]\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"integer\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9]/))this.value = this.value.replace(/[^0-9]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"float\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9\\.]/))this.value = this.value.replace(/[^0-9\\.]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \'select-one\' OR $row.inputType eq \'select-multiple\'}\r\n	<select name=\"prefs[{$row.name}]{if $row.inputType eq \'select-multiple\'}[]\" multiple=\"multiple\" size=\"{$row.inputSize}{/if}\">\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<option value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option|@in_array:$aValues)} selected=\"selected\"{/if}>{$option}</option>\r\n	{/foreach}</select>\r\n{elseif $row.inputType eq \"radios\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"radio\" name=\"prefs[{$row.name}]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option eq $prefValues[$row.name])} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n{elseif $row.inputType eq \"checkboxes\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"checkbox\" name=\"prefs[{$row.name}][]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND !$row.name|@inArray:$savedPrefs AND $option|@inArray:$aDefaults) OR ($option|@inArray:$aValues)} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n	<input type=\"hidden\" name=\"prefs[{$row.name}][]\" value=\"END:{$row.name}\" /> \r\n{elseif $row.inputType eq \"regex\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onchange=\"if(!this.value.match({$row.validInput})) alert (\'\\\'\' + this.value + \'\\\' is not valid for \\\'{$row.description}\\\'.\')\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{else}\r\n	Unrecognized Input Type! <b>({$row.inputType})</b>\r\n{/if}\r\n	</td>\r\n	<td nowrap=\"nowrap\" valign=\"top\"><input type=\"checkbox\" name=\"userOverride[{$row.name}]\" value=\"1\"{if $lockedName eq 1} checked=\"checked\"{/if} /> User Overridable?</td>\r\n</tr>\r\n{/foreach}\r\n</tr>\r\n</table>\r\n\r\n<div align=\"right\">\r\n	<input type=\"submit\" name=\"prefAction\" value=\"Save Changes\" />\r\n</div>\r\n</form>'),(4199,261,0.22,'smarty','0','Page created.',1126214928,3,'216.194.127.150','<h1>{$page.title}</h1>\r\n\r\n{* display var=$smarty.session.company *}\r\n\r\n{include_php file=\"shared_handle:preferences/groupUpdate\"}\r\n\r\n{assign var=\"currentCategory\" value=\"\"}\r\n\r\n<form method=\"post\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n\r\n{literal}\r\n<script type=\"text/javascript\">\r\nfunction checkNumber(value, min, max, precision) {\r\n	if(value == \'\') return;\r\n	var message = \'\';\r\n	if(value < min || value > max) {\r\n		message = \'Value must be between \' + min + \' and \' + max + \'.\\n\\n\';\r\n		if(precision > 0) {\r\n			message += \'NOTE: Value may be truncated after \' + precision + \' decimal places.\';\r\n		}\r\n	}\r\n	if (value.match(/.*\\..*\\./)) {\r\n		message += \'Please enter a valid number.\';\r\n	}\r\n	if(message) alert(message);\r\n}\r\n</script>\r\n{/literal}\r\n{* display var=$prefValues *}\r\n<table>\r\n{foreach from=$aPrefs item=row}\r\n{* display var=$row *}\r\n{assign var=\"lockedName\" value=\"`$row.name`_locked\"}\r\n{if $currentCategory neq $row.category}\r\n	{assign var=\"currentCategory\" value=$row.category}\r\n	<tr><td colspan=\"2\"><h2 class=\"withBG\">{$currentCategory}</h2></td></tr>\r\n{/if}\r\n<tr><td valign=\"top\">{$row.description}<br />\r\n	<input type=\"checkbox\" name=\"userOverride[{$row.name}]\" value=\"1\"{if true or $lockedName eq 1} checked=\"checked\"{/if} /> User Overridable?</td>\r\n{if $row.inputType|test_or:\"select-one\":\"select-multiple\":\"radios\":\"checkboxes\"}\r\n	{assign_array var=\"aOptions\" values=$row.validInput}\r\n	{assign_array var=\"aValues\" values=$prefValues[$row.name]}\r\n	{assign_array var=\"aDefaults\" values=$row.defaultValue}\r\n	{* display var=$aDefaults *}\r\n	{* display var=$aValues *}\r\n{/if}\r\n	<td valign=\"top\">\r\n{if $row.inputType eq \"string\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" maxlength=\"{$row.validInput}\" name=\"prefs[{$row.name}]\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"integer\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9]/))this.value = this.value.replace(/[^0-9]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"float\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9\\.]/))this.value = this.value.replace(/[^0-9\\.]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \'select-one\' OR $row.inputType eq \'select-multiple\'}\r\n	<select name=\"prefs[{$row.name}]{if $row.inputType eq \'select-multiple\'}[]\" multiple=\"multiple\" size=\"{$row.inputSize}{/if}\">\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<option value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option|@in_array:$aValues)} selected=\"selected\"{/if}>{$option}</option>\r\n	{/foreach}</select>\r\n{elseif $row.inputType eq \"radios\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"radio\" name=\"prefs[{$row.name}]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option eq $prefValues[$row.name])} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n{elseif $row.inputType eq \"checkboxes\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"checkbox\" name=\"prefs[{$row.name}][]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND !$row.name|@inArray:$savedPrefs AND $option|@inArray:$aDefaults) OR ($option|@inArray:$aValues)} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n	<input type=\"hidden\" name=\"prefs[{$row.name}][]\" value=\"END:{$row.name}\" /> \r\n{elseif $row.inputType eq \"regex\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onchange=\"if(!this.value.match({$row.validInput})) alert (\'\\\'\' + this.value + \'\\\' is not valid for \\\'{$row.description}\\\'.\')\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{else}\r\n	Unrecognized Input Type! <b>({$row.inputType})</b>\r\n{/if}\r\n	</td>\r\n</tr>\r\n{/foreach}\r\n</tr>\r\n</table>\r\n\r\n<div align=\"right\">\r\n	<input type=\"submit\" name=\"prefAction\" value=\"Save Changes\" />\r\n</div>\r\n</form>'),(4200,261,0.23,'smarty','0','Page created.',1126214985,3,'216.194.127.150','<h1>{$page.title}</h1>\r\n\r\n{* display var=$smarty.session.company *}\r\n\r\n{include_php file=\"shared_handle:preferences/groupUpdate\"}\r\n\r\n{assign var=\"currentCategory\" value=\"\"}\r\n\r\n<form method=\"post\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n\r\n{literal}\r\n<script type=\"text/javascript\">\r\nfunction checkNumber(value, min, max, precision) {\r\n	if(value == \'\') return;\r\n	var message = \'\';\r\n	if(value < min || value > max) {\r\n		message = \'Value must be between \' + min + \' and \' + max + \'.\\n\\n\';\r\n		if(precision > 0) {\r\n			message += \'NOTE: Value may be truncated after \' + precision + \' decimal places.\';\r\n		}\r\n	}\r\n	if (value.match(/.*\\..*\\./)) {\r\n		message += \'Please enter a valid number.\';\r\n	}\r\n	if(message) alert(message);\r\n}\r\n</script>\r\n{/literal}\r\n{* display var=$prefValues *}\r\n<table>\r\n{foreach from=$aPrefs item=row}\r\n{* display var=$row *}\r\n{assign var=\"lockedName\" value=\"`$row.name`_locked\"}\r\n{if $currentCategory neq $row.category}\r\n	{assign var=\"currentCategory\" value=$row.category}\r\n	<tr><td colspan=\"2\"><h2 class=\"withBG\">{$currentCategory}</h2></td></tr>\r\n{/if}\r\n<tr><td valign=\"top\"><b>{$row.description}</b><br />\r\n	<input type=\"checkbox\" name=\"userOverride[{$row.name}]\" value=\"1\"{if $lockedName} checked=\"checked\"{/if} /> User Overridable?</td>\r\n{if $row.inputType|test_or:\"select-one\":\"select-multiple\":\"radios\":\"checkboxes\"}\r\n	{assign_array var=\"aOptions\" values=$row.validInput}\r\n	{assign_array var=\"aValues\" values=$prefValues[$row.name]}\r\n	{assign_array var=\"aDefaults\" values=$row.defaultValue}\r\n	{* display var=$aDefaults *}\r\n	{* display var=$aValues *}\r\n{/if}\r\n	<td valign=\"top\">\r\n{if $row.inputType eq \"string\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" maxlength=\"{$row.validInput}\" name=\"prefs[{$row.name}]\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"integer\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9]/))this.value = this.value.replace(/[^0-9]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"float\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9\\.]/))this.value = this.value.replace(/[^0-9\\.]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \'select-one\' OR $row.inputType eq \'select-multiple\'}\r\n	<select name=\"prefs[{$row.name}]{if $row.inputType eq \'select-multiple\'}[]\" multiple=\"multiple\" size=\"{$row.inputSize}{/if}\">\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<option value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option|@in_array:$aValues)} selected=\"selected\"{/if}>{$option}</option>\r\n	{/foreach}</select>\r\n{elseif $row.inputType eq \"radios\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"radio\" name=\"prefs[{$row.name}]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option eq $prefValues[$row.name])} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n{elseif $row.inputType eq \"checkboxes\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"checkbox\" name=\"prefs[{$row.name}][]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND !$row.name|@inArray:$savedPrefs AND $option|@inArray:$aDefaults) OR ($option|@inArray:$aValues)} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n	<input type=\"hidden\" name=\"prefs[{$row.name}][]\" value=\"END:{$row.name}\" /> \r\n{elseif $row.inputType eq \"regex\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onchange=\"if(!this.value.match({$row.validInput})) alert (\'\\\'\' + this.value + \'\\\' is not valid for \\\'{$row.description}\\\'.\')\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{else}\r\n	Unrecognized Input Type! <b>({$row.inputType})</b>\r\n{/if}\r\n	</td>\r\n</tr>\r\n{/foreach}\r\n</tr>\r\n</table>\r\n\r\n<div align=\"right\">\r\n	<input type=\"submit\" name=\"prefAction\" value=\"Save Changes\" />\r\n</div>\r\n</form>'),(4201,261,0.24,'smarty','0','Page created.',1126215025,3,'216.194.127.150','<h1>{$page.title}</h1>\r\n\r\n{* display var=$smarty.session.company *}\r\n\r\n{include_php file=\"shared_handle:preferences/groupUpdate\"}\r\n\r\n{assign var=\"currentCategory\" value=\"\"}\r\n\r\n<form method=\"post\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n\r\n{literal}\r\n<script type=\"text/javascript\">\r\nfunction checkNumber(value, min, max, precision) {\r\n	if(value == \'\') return;\r\n	var message = \'\';\r\n	if(value < min || value > max) {\r\n		message = \'Value must be between \' + min + \' and \' + max + \'.\\n\\n\';\r\n		if(precision > 0) {\r\n			message += \'NOTE: Value may be truncated after \' + precision + \' decimal places.\';\r\n		}\r\n	}\r\n	if (value.match(/.*\\..*\\./)) {\r\n		message += \'Please enter a valid number.\';\r\n	}\r\n	if(message) alert(message);\r\n}\r\n</script>\r\n{/literal}\r\n{* display var=$prefValues *}\r\n<table>\r\n{foreach from=$aPrefs item=row}\r\n{* display var=$row *}\r\n{assign var=\"lockedName\" value=\"`$row.name`_locked\"}\r\n{if $currentCategory neq $row.category}\r\n	{assign var=\"currentCategory\" value=$row.category}\r\n	<tr><td colspan=\"2\"><h2 class=\"withBG\">{$currentCategory}</h2></td></tr>\r\n{/if}\r\n<tr><td valign=\"top\"><b>{$row.description}</b><br />\r\n	{$lockedName}<input type=\"checkbox\" name=\"userOverride[{$row.name}]\" value=\"1\"{if $lockedName} checked=\"checked\"{/if} /> User Overridable?</td>\r\n{if $row.inputType|test_or:\"select-one\":\"select-multiple\":\"radios\":\"checkboxes\"}\r\n	{assign_array var=\"aOptions\" values=$row.validInput}\r\n	{assign_array var=\"aValues\" values=$prefValues[$row.name]}\r\n	{assign_array var=\"aDefaults\" values=$row.defaultValue}\r\n	{* display var=$aDefaults *}\r\n	{* display var=$aValues *}\r\n{/if}\r\n	<td valign=\"top\">\r\n{if $row.inputType eq \"string\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" maxlength=\"{$row.validInput}\" name=\"prefs[{$row.name}]\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"integer\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9]/))this.value = this.value.replace(/[^0-9]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"float\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9\\.]/))this.value = this.value.replace(/[^0-9\\.]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \'select-one\' OR $row.inputType eq \'select-multiple\'}\r\n	<select name=\"prefs[{$row.name}]{if $row.inputType eq \'select-multiple\'}[]\" multiple=\"multiple\" size=\"{$row.inputSize}{/if}\">\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<option value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option|@in_array:$aValues)} selected=\"selected\"{/if}>{$option}</option>\r\n	{/foreach}</select>\r\n{elseif $row.inputType eq \"radios\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"radio\" name=\"prefs[{$row.name}]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option eq $prefValues[$row.name])} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n{elseif $row.inputType eq \"checkboxes\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"checkbox\" name=\"prefs[{$row.name}][]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND !$row.name|@inArray:$savedPrefs AND $option|@inArray:$aDefaults) OR ($option|@inArray:$aValues)} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n	<input type=\"hidden\" name=\"prefs[{$row.name}][]\" value=\"END:{$row.name}\" /> \r\n{elseif $row.inputType eq \"regex\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onchange=\"if(!this.value.match({$row.validInput})) alert (\'\\\'\' + this.value + \'\\\' is not valid for \\\'{$row.description}\\\'.\')\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{else}\r\n	Unrecognized Input Type! <b>({$row.inputType})</b>\r\n{/if}\r\n	</td>\r\n</tr>\r\n{/foreach}\r\n</tr>\r\n</table>\r\n\r\n<div align=\"right\">\r\n	<input type=\"submit\" name=\"prefAction\" value=\"Save Changes\" />\r\n</div>\r\n</form>'),(4202,261,0.25,'smarty','0','Page created.',1126215120,3,'216.194.127.150','<h1>{$page.title}</h1>\r\n\r\n{* display var=$smarty.session.company *}\r\n\r\n{include_php file=\"shared_handle:preferences/groupUpdate\"}\r\n\r\n{assign var=\"currentCategory\" value=\"\"}\r\n\r\n<form method=\"post\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n\r\n{literal}\r\n<script type=\"text/javascript\">\r\nfunction checkNumber(value, min, max, precision) {\r\n	if(value == \'\') return;\r\n	var message = \'\';\r\n	if(value < min || value > max) {\r\n		message = \'Value must be between \' + min + \' and \' + max + \'.\\n\\n\';\r\n		if(precision > 0) {\r\n			message += \'NOTE: Value may be truncated after \' + precision + \' decimal places.\';\r\n		}\r\n	}\r\n	if (value.match(/.*\\..*\\./)) {\r\n		message += \'Please enter a valid number.\';\r\n	}\r\n	if(message) alert(message);\r\n}\r\n</script>\r\n{/literal}\r\n{* display var=$prefValues *}\r\n<table>\r\n{foreach from=$aPrefs item=row}\r\n{* display var=$row *}\r\n{assign var=\"lockedName\" value=\"`$row.name`_locked\"}\r\n{if $currentCategory neq $row.category}\r\n	{assign var=\"currentCategory\" value=$row.category}\r\n	<tr><td colspan=\"2\"><h2 class=\"withBG\">{$currentCategory}</h2></td></tr>\r\n{/if}\r\n<tr><td valign=\"top\"><b>{$row.description}</b><br />\r\n	<input type=\"checkbox\" name=\"userOverride[{$row.name}]\" value=\"1\"{if $prefValues[$lockedName]} checked=\"checked\"{/if} /> User Overridable?</td>\r\n{if $row.inputType|test_or:\"select-one\":\"select-multiple\":\"radios\":\"checkboxes\"}\r\n	{assign_array var=\"aOptions\" values=$row.validInput}\r\n	{assign_array var=\"aValues\" values=$prefValues[$row.name]}\r\n	{assign_array var=\"aDefaults\" values=$row.defaultValue}\r\n	{* display var=$aDefaults *}\r\n	{* display var=$aValues *}\r\n{/if}\r\n	<td valign=\"top\">\r\n{if $row.inputType eq \"string\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" maxlength=\"{$row.validInput}\" name=\"prefs[{$row.name}]\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"integer\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9]/))this.value = this.value.replace(/[^0-9]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"float\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9\\.]/))this.value = this.value.replace(/[^0-9\\.]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \'select-one\' OR $row.inputType eq \'select-multiple\'}\r\n	<select name=\"prefs[{$row.name}]{if $row.inputType eq \'select-multiple\'}[]\" multiple=\"multiple\" size=\"{$row.inputSize}{/if}\">\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<option value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option|@in_array:$aValues)} selected=\"selected\"{/if}>{$option}</option>\r\n	{/foreach}</select>\r\n{elseif $row.inputType eq \"radios\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"radio\" name=\"prefs[{$row.name}]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option eq $prefValues[$row.name])} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n{elseif $row.inputType eq \"checkboxes\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"checkbox\" name=\"prefs[{$row.name}][]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND !$row.name|@inArray:$savedPrefs AND $option|@inArray:$aDefaults) OR ($option|@inArray:$aValues)} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n	<input type=\"hidden\" name=\"prefs[{$row.name}][]\" value=\"END:{$row.name}\" /> \r\n{elseif $row.inputType eq \"regex\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onchange=\"if(!this.value.match({$row.validInput})) alert (\'\\\'\' + this.value + \'\\\' is not valid for \\\'{$row.description}\\\'.\')\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{else}\r\n	Unrecognized Input Type! <b>({$row.inputType})</b>\r\n{/if}\r\n	</td>\r\n</tr>\r\n{/foreach}\r\n</tr>\r\n</table>\r\n\r\n<div align=\"right\">\r\n	<input type=\"submit\" name=\"prefAction\" value=\"Save Changes\" />\r\n</div>\r\n</form>'),(4203,261,0.26,'smarty','0','Page created.',1126215155,3,'216.194.127.150','<h1>{$page.title}</h1>\r\n\r\n{* display var=$smarty.session.company *}\r\n\r\n{include_php file=\"shared_handle:preferences/groupUpdate\"}\r\n\r\n{assign var=\"currentCategory\" value=\"\"}\r\n\r\n<form method=\"post\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n\r\n{literal}\r\n<script type=\"text/javascript\">\r\nfunction checkNumber(value, min, max, precision) {\r\n	if(value == \'\') return;\r\n	var message = \'\';\r\n	if(value < min || value > max) {\r\n		message = \'Value must be between \' + min + \' and \' + max + \'.\\n\\n\';\r\n		if(precision > 0) {\r\n			message += \'NOTE: Value may be truncated after \' + precision + \' decimal places.\';\r\n		}\r\n	}\r\n	if (value.match(/.*\\..*\\./)) {\r\n		message += \'Please enter a valid number.\';\r\n	}\r\n	if(message) alert(message);\r\n}\r\n</script>\r\n{/literal}\r\n{* display var=$prefValues *}\r\n<table>\r\n{foreach from=$aPrefs item=row}\r\n{* display var=$row *}\r\n{assign var=\"lockedName\" value=\"`$row.name`_locked\"}\r\n{if $currentCategory neq $row.category}\r\n	{assign var=\"currentCategory\" value=$row.category}\r\n	<tr><td colspan=\"2\"><h2 class=\"withBG\">{$currentCategory}</h2></td></tr>\r\n{/if}\r\n<tr><td valign=\"top\"><b>{$row.description}</b><br />\r\n	<input type=\"checkbox\" name=\"userOverride[{$row.name}]\" value=\"1\"{if $prefValues[$lockedName] neq 1} checked=\"checked\"{/if} /> User Overridable?</td>\r\n{if $row.inputType|test_or:\"select-one\":\"select-multiple\":\"radios\":\"checkboxes\"}\r\n	{assign_array var=\"aOptions\" values=$row.validInput}\r\n	{assign_array var=\"aValues\" values=$prefValues[$row.name]}\r\n	{assign_array var=\"aDefaults\" values=$row.defaultValue}\r\n	{* display var=$aDefaults *}\r\n	{* display var=$aValues *}\r\n{/if}\r\n	<td valign=\"top\">\r\n{if $row.inputType eq \"string\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" maxlength=\"{$row.validInput}\" name=\"prefs[{$row.name}]\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"integer\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9]/))this.value = this.value.replace(/[^0-9]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"float\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9\\.]/))this.value = this.value.replace(/[^0-9\\.]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \'select-one\' OR $row.inputType eq \'select-multiple\'}\r\n	<select name=\"prefs[{$row.name}]{if $row.inputType eq \'select-multiple\'}[]\" multiple=\"multiple\" size=\"{$row.inputSize}{/if}\">\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<option value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option|@in_array:$aValues)} selected=\"selected\"{/if}>{$option}</option>\r\n	{/foreach}</select>\r\n{elseif $row.inputType eq \"radios\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"radio\" name=\"prefs[{$row.name}]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option eq $prefValues[$row.name])} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n{elseif $row.inputType eq \"checkboxes\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"checkbox\" name=\"prefs[{$row.name}][]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND !$row.name|@inArray:$savedPrefs AND $option|@inArray:$aDefaults) OR ($option|@inArray:$aValues)} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n	<input type=\"hidden\" name=\"prefs[{$row.name}][]\" value=\"END:{$row.name}\" /> \r\n{elseif $row.inputType eq \"regex\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onchange=\"if(!this.value.match({$row.validInput})) alert (\'\\\'\' + this.value + \'\\\' is not valid for \\\'{$row.description}\\\'.\')\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{else}\r\n	Unrecognized Input Type! <b>({$row.inputType})</b>\r\n{/if}\r\n	</td>\r\n</tr>\r\n{/foreach}\r\n</tr>\r\n</table>\r\n\r\n<div align=\"right\">\r\n	<input type=\"submit\" name=\"prefAction\" value=\"Save Changes\" />\r\n</div>\r\n</form>'),(4204,261,0.27,'smarty','0','Page created.',1126215350,3,'216.194.127.150','<h1>{$page.title}</h1>\r\n\r\n{* display var=$smarty.session.company *}\r\n\r\n{include_php file=\"shared_handle:preferences/groupUpdate\"}\r\n\r\n{assign var=\"currentCategory\" value=\"\"}\r\n\r\n<form method=\"post\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n\r\n{literal}\r\n<script type=\"text/javascript\">\r\nfunction checkNumber(value, min, max, precision) {\r\n	if(value == \'\') return;\r\n	var message = \'\';\r\n	if(value < min || value > max) {\r\n		message = \'Value must be between \' + min + \' and \' + max + \'.\\n\\n\';\r\n		if(precision > 0) {\r\n			message += \'NOTE: Value may be truncated after \' + precision + \' decimal places.\';\r\n		}\r\n	}\r\n	if (value.match(/.*\\..*\\./)) {\r\n		message += \'Please enter a valid number.\';\r\n	}\r\n	if(message) alert(message);\r\n}\r\n</script>\r\n{/literal}\r\n{* display var=$prefValues *}\r\n<table>\r\n{foreach from=$aPrefs item=row}\r\n{* display var=$row *}\r\n{assign var=\"lockedName\" value=\"`$row.name`_locked\"}\r\n{if $currentCategory neq $row.category}\r\n	{assign var=\"currentCategory\" value=$row.category}\r\n	<tr><td colspan=\"2\"><h2 class=\"withBG\">{$currentCategory}</h2></td></tr>\r\n{/if}\r\n<tr><td valign=\"top\"><b>{$row.description}</b><br />\r\n	<input type=\"checkbox\" name=\"userOverride[{$row.name}]\" value=\"1\"{if $prefValues[$lockedName] neq \'yes\'} checked=\"checked\"{/if} /> User Overridable?</td>\r\n{if $row.inputType|test_or:\"select-one\":\"select-multiple\":\"radios\":\"checkboxes\"}\r\n	{assign_array var=\"aOptions\" values=$row.validInput}\r\n	{assign_array var=\"aValues\" values=$prefValues[$row.name]}\r\n	{assign_array var=\"aDefaults\" values=$row.defaultValue}\r\n	{* display var=$aDefaults *}\r\n	{* display var=$aValues *}\r\n{/if}\r\n	<td valign=\"top\">\r\n{if $row.inputType eq \"string\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" maxlength=\"{$row.validInput}\" name=\"prefs[{$row.name}]\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"integer\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9]/))this.value = this.value.replace(/[^0-9]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"float\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9\\.]/))this.value = this.value.replace(/[^0-9\\.]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \'select-one\' OR $row.inputType eq \'select-multiple\'}\r\n	<select name=\"prefs[{$row.name}]{if $row.inputType eq \'select-multiple\'}[]\" multiple=\"multiple\" size=\"{$row.inputSize}{/if}\">\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<option value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option|@in_array:$aValues)} selected=\"selected\"{/if}>{$option}</option>\r\n	{/foreach}</select>\r\n{elseif $row.inputType eq \"radios\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"radio\" name=\"prefs[{$row.name}]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option eq $prefValues[$row.name])} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n{elseif $row.inputType eq \"checkboxes\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"checkbox\" name=\"prefs[{$row.name}][]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND !$row.name|@inArray:$savedPrefs AND $option|@inArray:$aDefaults) OR ($option|@inArray:$aValues)} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n	<input type=\"hidden\" name=\"prefs[{$row.name}][]\" value=\"END:{$row.name}\" /> \r\n{elseif $row.inputType eq \"regex\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onchange=\"if(!this.value.match({$row.validInput})) alert (\'\\\'\' + this.value + \'\\\' is not valid for \\\'{$row.description}\\\'.\')\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{else}\r\n	Unrecognized Input Type! <b>({$row.inputType})</b>\r\n{/if}\r\n	</td>\r\n</tr>\r\n{/foreach}\r\n</tr>\r\n</table>\r\n\r\n<div align=\"right\">\r\n	<input type=\"submit\" name=\"prefAction\" value=\"Save Changes\" />\r\n</div>\r\n</form>'),(4205,261,0.28,'smarty','0','Page created.',1126215404,3,'216.194.127.150','<h1>{$page.title}</h1>\r\n\r\n{* display var=$smarty.session.company *}\r\n\r\n{include_php file=\"shared_handle:preferences/groupUpdate\"}\r\n\r\n{assign var=\"currentCategory\" value=\"\"}\r\n\r\n<form method=\"post\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n\r\n{literal}\r\n<script type=\"text/javascript\">\r\nfunction checkNumber(value, min, max, precision) {\r\n	if(value == \'\') return;\r\n	var message = \'\';\r\n	if(value < min || value > max) {\r\n		message = \'Value must be between \' + min + \' and \' + max + \'.\\n\\n\';\r\n		if(precision > 0) {\r\n			message += \'NOTE: Value may be truncated after \' + precision + \' decimal places.\';\r\n		}\r\n	}\r\n	if (value.match(/.*\\..*\\./)) {\r\n		message += \'Please enter a valid number.\';\r\n	}\r\n	if(message) alert(message);\r\n}\r\n</script>\r\n{/literal}\r\n{* display var=$prefValues *}\r\n<table>\r\n{foreach from=$aPrefs item=row}\r\n{* display var=$row *}\r\n{assign var=\"lockedName\" value=\"`$row.name`_locked\"}\r\n{if $currentCategory neq $row.category}\r\n	{assign var=\"currentCategory\" value=$row.category}\r\n	<tr><td colspan=\"2\"><h2 class=\"withBG\">{$currentCategory}</h2></td></tr>\r\n{/if}\r\n<tr><td valign=\"top\"><b>{$row.description}</b><br />\r\n	{$prefValues[$lockedName]} <input type=\"checkbox\" name=\"userOverride[{$row.name}]\" value=\"1\"{if $prefValues[$lockedName] neq 1} checked=\"checked\"{/if} /> User Overridable?</td>\r\n{if $row.inputType|test_or:\"select-one\":\"select-multiple\":\"radios\":\"checkboxes\"}\r\n	{assign_array var=\"aOptions\" values=$row.validInput}\r\n	{assign_array var=\"aValues\" values=$prefValues[$row.name]}\r\n	{assign_array var=\"aDefaults\" values=$row.defaultValue}\r\n	{* display var=$aDefaults *}\r\n	{* display var=$aValues *}\r\n{/if}\r\n	<td valign=\"top\">\r\n{if $row.inputType eq \"string\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" maxlength=\"{$row.validInput}\" name=\"prefs[{$row.name}]\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"integer\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9]/))this.value = this.value.replace(/[^0-9]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"float\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9\\.]/))this.value = this.value.replace(/[^0-9\\.]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \'select-one\' OR $row.inputType eq \'select-multiple\'}\r\n	<select name=\"prefs[{$row.name}]{if $row.inputType eq \'select-multiple\'}[]\" multiple=\"multiple\" size=\"{$row.inputSize}{/if}\">\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<option value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option|@in_array:$aValues)} selected=\"selected\"{/if}>{$option}</option>\r\n	{/foreach}</select>\r\n{elseif $row.inputType eq \"radios\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"radio\" name=\"prefs[{$row.name}]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option eq $prefValues[$row.name])} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n{elseif $row.inputType eq \"checkboxes\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"checkbox\" name=\"prefs[{$row.name}][]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND !$row.name|@inArray:$savedPrefs AND $option|@inArray:$aDefaults) OR ($option|@inArray:$aValues)} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n	<input type=\"hidden\" name=\"prefs[{$row.name}][]\" value=\"END:{$row.name}\" /> \r\n{elseif $row.inputType eq \"regex\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onchange=\"if(!this.value.match({$row.validInput})) alert (\'\\\'\' + this.value + \'\\\' is not valid for \\\'{$row.description}\\\'.\')\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{else}\r\n	Unrecognized Input Type! <b>({$row.inputType})</b>\r\n{/if}\r\n	</td>\r\n</tr>\r\n{/foreach}\r\n</tr>\r\n</table>\r\n\r\n<div align=\"right\">\r\n	<input type=\"submit\" name=\"prefAction\" value=\"Save Changes\" />\r\n</div>\r\n</form>'),(4206,261,0.29,'smarty','0','Page created.',1126215558,3,'216.194.127.150','<h1>{$page.title}</h1>\r\n\r\n{* display var=$smarty.session.company *}\r\n\r\n{include_php file=\"shared_handle:preferences/groupUpdate\"}\r\n\r\n{assign var=\"currentCategory\" value=\"\"}\r\n\r\n<form method=\"post\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n\r\n{literal}\r\n<script type=\"text/javascript\">\r\nfunction checkNumber(value, min, max, precision) {\r\n	if(value == \'\') return;\r\n	var message = \'\';\r\n	if(value < min || value > max) {\r\n		message = \'Value must be between \' + min + \' and \' + max + \'.\\n\\n\';\r\n		if(precision > 0) {\r\n			message += \'NOTE: Value may be truncated after \' + precision + \' decimal places.\';\r\n		}\r\n	}\r\n	if (value.match(/.*\\..*\\./)) {\r\n		message += \'Please enter a valid number.\';\r\n	}\r\n	if(message) alert(message);\r\n}\r\n</script>\r\n{/literal}\r\n{* display var=$prefValues *}\r\n<table>\r\n{foreach from=$aPrefs item=row}\r\n{* display var=$row *}\r\n{assign var=\"lockedName\" value=\"`$row.name`_locked\"}\r\n{if $currentCategory neq $row.category}\r\n	{assign var=\"currentCategory\" value=$row.category}\r\n	<tr><td colspan=\"2\"><h2 class=\"withBG\">{$currentCategory}</h2></td></tr>\r\n{/if}\r\n<tr><td valign=\"top\"><b>{$row.description}</b><br />\r\n	<input type=\"checkbox\" name=\"userOverride[{$row.name}]\" value=\"1\"{if $prefValues[$lockedName] eq 1} checked=\"checked\"{/if} /> User Overridable?</td>\r\n{if $row.inputType|test_or:\"select-one\":\"select-multiple\":\"radios\":\"checkboxes\"}\r\n	{assign_array var=\"aOptions\" values=$row.validInput}\r\n	{assign_array var=\"aValues\" values=$prefValues[$row.name]}\r\n	{assign_array var=\"aDefaults\" values=$row.defaultValue}\r\n	{* display var=$aDefaults *}\r\n	{* display var=$aValues *}\r\n{/if}\r\n	<td valign=\"top\">\r\n{if $row.inputType eq \"string\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" maxlength=\"{$row.validInput}\" name=\"prefs[{$row.name}]\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"integer\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9]/))this.value = this.value.replace(/[^0-9]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"float\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9\\.]/))this.value = this.value.replace(/[^0-9\\.]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \'select-one\' OR $row.inputType eq \'select-multiple\'}\r\n	<select name=\"prefs[{$row.name}]{if $row.inputType eq \'select-multiple\'}[]\" multiple=\"multiple\" size=\"{$row.inputSize}{/if}\">\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<option value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option|@in_array:$aValues)} selected=\"selected\"{/if}>{$option}</option>\r\n	{/foreach}</select>\r\n{elseif $row.inputType eq \"radios\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"radio\" name=\"prefs[{$row.name}]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option eq $prefValues[$row.name])} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n{elseif $row.inputType eq \"checkboxes\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"checkbox\" name=\"prefs[{$row.name}][]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND !$row.name|@inArray:$savedPrefs AND $option|@inArray:$aDefaults) OR ($option|@inArray:$aValues)} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n	<input type=\"hidden\" name=\"prefs[{$row.name}][]\" value=\"END:{$row.name}\" /> \r\n{elseif $row.inputType eq \"regex\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onchange=\"if(!this.value.match({$row.validInput})) alert (\'\\\'\' + this.value + \'\\\' is not valid for \\\'{$row.description}\\\'.\')\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{else}\r\n	Unrecognized Input Type! <b>({$row.inputType})</b>\r\n{/if}\r\n	</td>\r\n</tr>\r\n{/foreach}\r\n</tr>\r\n</table>\r\n\r\n<div align=\"right\">\r\n	<input type=\"submit\" name=\"prefAction\" value=\"Save Changes\" />\r\n</div>\r\n</form>'),(4207,259,0.12,'smarty','0','Page created.',1126216424,3,'216.194.127.150','<h1>{$page.title}</h1>\r\n\r\n{include_php file=\"shared_handle:preferences/userUpdate\"}\r\n\r\n{assign var=\"currentCategory\" value=\"\"}\r\n\r\n<form method=\"post\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n\r\n{literal}\r\n<script type=\"text/javascript\">\r\nfunction checkNumber(value, min, max, precision) {\r\n	if(value == \'\') return;\r\n	var message = \'\';\r\n	if(value < min || value > max) {\r\n		message = \'Value must be between \' + min + \' and \' + max + \'.\\n\\n\';\r\n		if(precision > 0) {\r\n			message += \'NOTE: Value may be truncated after \' + precision + \' decimal places.\';\r\n		}\r\n	}\r\n	if (value.match(/.*\\..*\\./)) {\r\n		message += \'Please enter a valid number.\';\r\n	}\r\n	if(message) alert(message);\r\n}\r\n</script>\r\n{/literal}\r\n{display var=$prefValues}\r\n<table>\r\n{foreach from=$aPrefs item=row}\r\n{display var=$row}\r\n{assign var=\"lockedName\" value=\"`$row.name`_locked\"}\r\n{if $currentCategory neq $row.category}\r\n	{assign var=\"currentCategory\" value=$row.category}\r\n	<tr><td colspan=\"2\"><h2 class=\"withBG\">{$currentCategory}</h2></td></tr>\r\n{/if}\r\n<tr><td valign=\"top\">{$row.description}</td>\r\n{if $row.inputType|test_or:\"select-one\":\"select-multiple\":\"radios\":\"checkboxes\"}\r\n	{assign_array var=\"aOptions\" values=$row.validInput}\r\n	{assign_array var=\"aValues\" values=$prefValues[$row.name]}\r\n	{assign_array var=\"aDefaults\" values=$row.defaultValue}\r\n	{* display var=$aDefaults *}\r\n	{display var=$aValues}\r\n{/if}\r\n	<td valign=\"top\">\r\n{if $row.inputType eq \"string\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" maxlength=\"{$row.validInput}\" name=\"prefs[{$row.name}]\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n{elseif $row.inputType eq \"integer\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9]/))this.value = this.value.replace(/[^0-9]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n{elseif $row.inputType eq \"float\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9\\.]/))this.value = this.value.replace(/[^0-9\\.]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n{elseif $row.inputType eq \'select-one\' OR $row.inputType eq \'select-multiple\'}\r\n	<select name=\"prefs[{$row.name}]{if $row.inputType eq \'select-multiple\'}[]\" multiple=\"multiple\" size=\"{$row.inputSize}{/if}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if}>\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<option value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option|@in_array:$aValues)} selected=\"selected\"{/if}>{$option}</option>\r\n	{/foreach}</select>\r\n{elseif $row.inputType eq \"radios\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"radio\" name=\"prefs[{$row.name}]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option eq $prefValues[$row.name])} checked=\"checked\"{/if}{if $prefValues[$lockedName]} disabled=\"disabled\"{/if}> {$option}<br />\r\n	{/foreach}\r\n{elseif $row.inputType eq \"checkboxes\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"checkbox\" name=\"prefs[{$row.name}][]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND !$row.name|@inArray:$savedPrefs AND $option|@inArray:$aDefaults) OR ($option|@inArray:$aValues)} checked=\"checked\"{/if}{if $prefValues[$lockedName]} disabled=\"disabled\"{/if}> {$option}<br />\r\n	{/foreach}\r\n	<input type=\"hidden\" name=\"prefs[{$row.name}][]\" value=\"END:{$row.name}\" /> \r\n{elseif $row.inputType eq \"regex\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onchange=\"if(!this.value.match({$row.validInput})) alert (\'\\\'\' + this.value + \'\\\' is not valid for \\\'{$row.description}\\\'.\')\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n{else}\r\n	Unrecognized Input Type! <b>({$row.inputType})</b>\r\n{/if} \r\n	</td>\r\n</tr>\r\n{/foreach}\r\n</tr>\r\n</table>\r\n\r\n<div align=\"right\">\r\n	<input type=\"submit\" name=\"prefAction\" value=\"Save Changes\" />\r\n</div>\r\n</form>'),(4208,259,0.13,'smarty','0','Page created.',1126217403,3,'216.194.127.150','<h1>{$page.title}</h1>\r\n\r\n{include_php file=\"shared_handle:preferences/userUpdate\"}\r\n\r\n{assign var=\"currentCategory\" value=\"\"}\r\n\r\n<form method=\"post\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n\r\n{literal}\r\n<script type=\"text/javascript\">\r\nfunction checkNumber(value, min, max, precision) {\r\n	if(value == \'\') return;\r\n	var message = \'\';\r\n	if(value < min || value > max) {\r\n		message = \'Value must be between \' + min + \' and \' + max + \'.\\n\\n\';\r\n		if(precision > 0) {\r\n			message += \'NOTE: Value may be truncated after \' + precision + \' decimal places.\';\r\n		}\r\n	}\r\n	if (value.match(/.*\\..*\\./)) {\r\n		message += \'Please enter a valid number.\';\r\n	}\r\n	if(message) alert(message);\r\n}\r\n</script>\r\n{/literal}\r\n{* display var=$prefValues *}\r\n<table>\r\n{foreach from=$aPrefs item=row}\r\n{* display var=$row *}\r\n{assign var=\"lockedName\" value=\"`$row.name`_locked\"}\r\n{if $prefValues[$lockedName] neq 1}\r\n	{if $currentCategory neq $row.category}\r\n		{assign var=\"currentCategory\" value=$row.category}\r\n		<tr><td colspan=\"2\"><h2 class=\"withBG\">{$currentCategory}</h2></td></tr>\r\n	{/if}\r\n	<tr><td valign=\"top\">{$row.description}</td>\r\n	{if $row.inputType|test_or:\"select-one\":\"select-multiple\":\"radios\":\"checkboxes\"}\r\n		{assign_array var=\"aOptions\" values=$row.validInput}\r\n		{assign_array var=\"aValues\" values=$prefValues[$row.name]}\r\n		{assign_array var=\"aDefaults\" values=$row.defaultValue}\r\n		{* display var=$aDefaults *}\r\n		{display var=$aValues}\r\n	{/if}\r\n		<td valign=\"top\">\r\n	{if $row.inputType eq \"string\"}\r\n		<input type=\"text\" size=\"{$row.inputSize}\" maxlength=\"{$row.validInput}\" name=\"prefs[{$row.name}]\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n	{elseif $row.inputType eq \"integer\"}\r\n		<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9]/))this.value = this.value.replace(/[^0-9]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n	{elseif $row.inputType eq \"float\"}\r\n		<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9\\.]/))this.value = this.value.replace(/[^0-9\\.]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n	{elseif $row.inputType eq \'select-one\' OR $row.inputType eq \'select-multiple\'}\r\n		<select name=\"prefs[{$row.name}]{if $row.inputType eq \'select-multiple\'}[]\" multiple=\"multiple\" size=\"{$row.inputSize}{/if}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if}>\r\n		{foreach from=$aOptions item=\"option\"}\r\n			<option value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option|@in_array:$aValues)} selected=\"selected\"{/if}>{$option}</option>\r\n		{/foreach}</select>\r\n	{elseif $row.inputType eq \"radios\"}\r\n		{foreach from=$aOptions item=\"option\"}\r\n			<input type=\"radio\" name=\"prefs[{$row.name}]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option eq $prefValues[$row.name])} checked=\"checked\"{/if}{if $prefValues[$lockedName]} disabled=\"disabled\"{/if}> {$option}<br />\r\n		{/foreach}\r\n	{elseif $row.inputType eq \"checkboxes\"}\r\n		{foreach from=$aOptions item=\"option\"}\r\n			<input type=\"checkbox\" name=\"prefs[{$row.name}][]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND !$row.name|@inArray:$savedPrefs AND $option|@inArray:$aDefaults) OR ($option|@inArray:$aValues)} checked=\"checked\"{/if}{if $prefValues[$lockedName]} disabled=\"disabled\"{/if}> {$option}<br />\r\n		{/foreach}\r\n		<input type=\"hidden\" name=\"prefs[{$row.name}][]\" value=\"END:{$row.name}\" /> \r\n	{elseif $row.inputType eq \"regex\"}\r\n		<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onchange=\"if(!this.value.match({$row.validInput})) alert (\'\\\'\' + this.value + \'\\\' is not valid for \\\'{$row.description}\\\'.\')\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n	{else}\r\n		Unrecognized Input Type! <b>({$row.inputType})</b>\r\n	{/if} \r\n		</td>\r\n	</tr>\r\n	{/foreach}\r\n	</tr>\r\n{/if}\r\n</table>\r\n\r\n<div align=\"right\">\r\n	<input type=\"submit\" name=\"prefAction\" value=\"Save Changes\" />\r\n</div>\r\n</form>'),(4209,259,0.14,'smarty','1','Page created.',1126217470,3,'216.194.127.150','<h1>{$page.title}</h1>\r\n\r\n{include_php file=\"shared_handle:preferences/userUpdate\"}\r\n\r\n{assign var=\"currentCategory\" value=\"\"}\r\n\r\n<form method=\"post\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n\r\n{literal}\r\n<script type=\"text/javascript\">\r\nfunction checkNumber(value, min, max, precision) {\r\n	if(value == \'\') return;\r\n	var message = \'\';\r\n	if(value < min || value > max) {\r\n		message = \'Value must be between \' + min + \' and \' + max + \'.\\n\\n\';\r\n		if(precision > 0) {\r\n			message += \'NOTE: Value may be truncated after \' + precision + \' decimal places.\';\r\n		}\r\n	}\r\n	if (value.match(/.*\\..*\\./)) {\r\n		message += \'Please enter a valid number.\';\r\n	}\r\n	if(message) alert(message);\r\n}\r\n</script>\r\n{/literal}\r\n{* display var=$prefValues *}\r\n<table>\r\n{foreach from=$aPrefs item=row}\r\n{* display var=$row *}\r\n{assign var=\"lockedName\" value=\"`$row.name`_locked\"}\r\n{if $currentCategory neq $row.category}\r\n	{assign var=\"currentCategory\" value=$row.category}\r\n	<tr><td colspan=\"2\"><h2 class=\"withBG\">{$currentCategory}</h2></td></tr>\r\n{/if}\r\n<tr><td valign=\"top\">{$row.description}</td>\r\n{if $row.inputType|test_or:\"select-one\":\"select-multiple\":\"radios\":\"checkboxes\"}\r\n	{assign_array var=\"aOptions\" values=$row.validInput}\r\n	{assign_array var=\"aValues\" values=$prefValues[$row.name]}\r\n	{assign_array var=\"aDefaults\" values=$row.defaultValue}\r\n	{* display var=$aDefaults *}\r\n	{display var=$aValues}\r\n{/if}\r\n	<td valign=\"top\">\r\n{if $row.inputType eq \"string\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" maxlength=\"{$row.validInput}\" name=\"prefs[{$row.name}]\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n{elseif $row.inputType eq \"integer\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9]/))this.value = this.value.replace(/[^0-9]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n{elseif $row.inputType eq \"float\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9\\.]/))this.value = this.value.replace(/[^0-9\\.]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n{elseif $row.inputType eq \'select-one\' OR $row.inputType eq \'select-multiple\'}\r\n	<select name=\"prefs[{$row.name}]{if $row.inputType eq \'select-multiple\'}[]\" multiple=\"multiple\" size=\"{$row.inputSize}{/if}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if}>\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<option value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option|@in_array:$aValues)} selected=\"selected\"{/if}>{$option}</option>\r\n	{/foreach}</select>\r\n{elseif $row.inputType eq \"radios\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"radio\" name=\"prefs[{$row.name}]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option eq $prefValues[$row.name])} checked=\"checked\"{/if}{if $prefValues[$lockedName]} disabled=\"disabled\"{/if}> {$option}<br />\r\n	{/foreach}\r\n{elseif $row.inputType eq \"checkboxes\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"checkbox\" name=\"prefs[{$row.name}][]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND !$row.name|@inArray:$savedPrefs AND $option|@inArray:$aDefaults) OR ($option|@inArray:$aValues)} checked=\"checked\"{/if}{if $prefValues[$lockedName]} disabled=\"disabled\"{/if}> {$option}<br />\r\n	{/foreach}\r\n	<input type=\"hidden\" name=\"prefs[{$row.name}][]\" value=\"END:{$row.name}\" /> \r\n{elseif $row.inputType eq \"regex\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onchange=\"if(!this.value.match({$row.validInput})) alert (\'\\\'\' + this.value + \'\\\' is not valid for \\\'{$row.description}\\\'.\')\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\"{if $prefValues[$lockedName]} disabled=\"disabled\"{/if} />\r\n{else}\r\n	Unrecognized Input Type! <b>({$row.inputType})</b>\r\n{/if} \r\n	</td>\r\n</tr>\r\n{/foreach}\r\n</tr>\r\n\r\n</table>\r\n\r\n<div align=\"right\">\r\n	<input type=\"submit\" name=\"prefAction\" value=\"Save Changes\" />\r\n</div>\r\n</form>'),(4210,261,0.30,'smarty','0','Page created.',1126218859,3,'216.194.127.150','<h1>{$page.title}</h1>\r\n\r\n{* display var=$smarty.session.company *}\r\n\r\n{include_php file=\"shared_handle:preferences/groupUpdate\"}\r\n\r\n{assign var=\"currentCategory\" value=\"\"}\r\n\r\n<form method=\"post\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n\r\n{literal}\r\n<script type=\"text/javascript\">\r\nfunction checkNumber(value, min, max, precision) {\r\n	if(value == \'\') return;\r\n	var message = \'\';\r\n	if(value < min || value > max) {\r\n		message = \'Value must be between \' + min + \' and \' + max + \'.\\n\\n\';\r\n		if(precision > 0) {\r\n			message += \'NOTE: Value may be truncated after \' + precision + \' decimal places.\';\r\n		}\r\n	}\r\n	if (value.match(/.*\\..*\\./)) {\r\n		message += \'Please enter a valid number.\';\r\n	}\r\n	if(message) alert(message);\r\n}\r\n</script>\r\n{/literal}\r\n{* display var=$prefValues *}\r\n<table>\r\n{foreach from=$aPrefs item=row}\r\n{* display var=$row *}\r\n{assign var=\"lockedName\" value=\"`$row.name`_locked\"}\r\n{if $currentCategory neq $row.category}\r\n	{assign var=\"currentCategory\" value=$row.category}\r\n	<tr><td colspan=\"2\"><h2 class=\"withBG\">{$currentCategory}</h2></td></tr>\r\n{/if}\r\n<tr><td valign=\"top\"><b>{$row.description}</b><br />\r\n	<input type=\"checkbox\" name=\"userOverride[{$row.name}]\" value=\"1\"{if $prefValues[$lockedName] eq 1} checked=\"checked\"{/if} /> Lock?</td>\r\n{if $row.inputType|test_or:\"select-one\":\"select-multiple\":\"radios\":\"checkboxes\"}\r\n	{assign_array var=\"aOptions\" values=$row.validInput}\r\n	{assign_array var=\"aValues\" values=$prefValues[$row.name]}\r\n	{assign_array var=\"aDefaults\" values=$row.defaultValue}\r\n	{* display var=$aDefaults *}\r\n	{* display var=$aValues *}\r\n{/if}\r\n	<td valign=\"top\">\r\n{if $row.inputType eq \"string\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" maxlength=\"{$row.validInput}\" name=\"prefs[{$row.name}]\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"integer\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9]/))this.value = this.value.replace(/[^0-9]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"float\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9\\.]/))this.value = this.value.replace(/[^0-9\\.]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \'select-one\' OR $row.inputType eq \'select-multiple\'}\r\n	<select name=\"prefs[{$row.name}]{if $row.inputType eq \'select-multiple\'}[]\" multiple=\"multiple\" size=\"{$row.inputSize}{/if}\">\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<option value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option|@in_array:$aValues)} selected=\"selected\"{/if}>{$option}</option>\r\n	{/foreach}</select>\r\n{elseif $row.inputType eq \"radios\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"radio\" name=\"prefs[{$row.name}]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option eq $prefValues[$row.name])} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n{elseif $row.inputType eq \"checkboxes\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"checkbox\" name=\"prefs[{$row.name}][]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND !$row.name|@inArray:$savedPrefs AND $option|@inArray:$aDefaults) OR ($option|@inArray:$aValues)} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n	<input type=\"hidden\" name=\"prefs[{$row.name}][]\" value=\"END:{$row.name}\" /> \r\n{elseif $row.inputType eq \"regex\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onchange=\"if(!this.value.match({$row.validInput})) alert (\'\\\'\' + this.value + \'\\\' is not valid for \\\'{$row.description}\\\'.\')\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{else}\r\n	Unrecognized Input Type! <b>({$row.inputType})</b>\r\n{/if}\r\n	</td>\r\n</tr>\r\n{/foreach}\r\n</tr>\r\n</table>\r\n\r\n<div align=\"right\">\r\n	<input type=\"submit\" name=\"prefAction\" value=\"Save Changes\" />\r\n</div>\r\n</form>'),(4211,261,0.31,'smarty','0','Page created.',1126220068,3,'216.194.127.150','<h1>{$page.title}</h1>\r\n\r\n{display var=$smarty.session.company}\r\n\r\n{include_php file=\"shared_handle:preferences/groupUpdate\"}\r\n\r\n{assign var=\"currentCategory\" value=\"\"}\r\n\r\n<form method=\"post\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n\r\n{literal}\r\n<script type=\"text/javascript\">\r\nfunction checkNumber(value, min, max, precision) {\r\n	if(value == \'\') return;\r\n	var message = \'\';\r\n	if(value < min || value > max) {\r\n		message = \'Value must be between \' + min + \' and \' + max + \'.\\n\\n\';\r\n		if(precision > 0) {\r\n			message += \'NOTE: Value may be truncated after \' + precision + \' decimal places.\';\r\n		}\r\n	}\r\n	if (value.match(/.*\\..*\\./)) {\r\n		message += \'Please enter a valid number.\';\r\n	}\r\n	if(message) alert(message);\r\n}\r\n</script>\r\n{/literal}\r\n{* display var=$prefValues *}\r\n<table>\r\n{foreach from=$aPrefs item=row}\r\n{* display var=$row *}\r\n{assign var=\"lockedName\" value=\"`$row.name`_locked\"}\r\n{if $currentCategory neq $row.category}\r\n	{assign var=\"currentCategory\" value=$row.category}\r\n	<tr><td colspan=\"2\"><h2 class=\"withBG\">{$currentCategory}</h2></td></tr>\r\n{/if}\r\n<tr><td valign=\"top\"><b>{$row.description}</b><br />\r\n	<input type=\"checkbox\" name=\"userOverride[{$row.name}]\" value=\"1\"{if $prefValues[$lockedName] eq 1} checked=\"checked\"{/if} /> Lock?</td>\r\n{if $row.inputType|test_or:\"select-one\":\"select-multiple\":\"radios\":\"checkboxes\"}\r\n	{assign_array var=\"aOptions\" values=$row.validInput}\r\n	{assign_array var=\"aValues\" values=$prefValues[$row.name]}\r\n	{assign_array var=\"aDefaults\" values=$row.defaultValue}\r\n	{* display var=$aDefaults *}\r\n	{* display var=$aValues *}\r\n{/if}\r\n	<td valign=\"top\">\r\n{if $row.inputType eq \"string\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" maxlength=\"{$row.validInput}\" name=\"prefs[{$row.name}]\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"integer\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9]/))this.value = this.value.replace(/[^0-9]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"float\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9\\.]/))this.value = this.value.replace(/[^0-9\\.]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \'select-one\' OR $row.inputType eq \'select-multiple\'}\r\n	<select name=\"prefs[{$row.name}]{if $row.inputType eq \'select-multiple\'}[]\" multiple=\"multiple\" size=\"{$row.inputSize}{/if}\">\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<option value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option|@in_array:$aValues)} selected=\"selected\"{/if}>{$option}</option>\r\n	{/foreach}</select>\r\n{elseif $row.inputType eq \"radios\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"radio\" name=\"prefs[{$row.name}]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option eq $prefValues[$row.name])} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n{elseif $row.inputType eq \"checkboxes\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"checkbox\" name=\"prefs[{$row.name}][]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND !$row.name|@inArray:$savedPrefs AND $option|@inArray:$aDefaults) OR ($option|@inArray:$aValues)} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n	<input type=\"hidden\" name=\"prefs[{$row.name}][]\" value=\"END:{$row.name}\" /> \r\n{elseif $row.inputType eq \"regex\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onchange=\"if(!this.value.match({$row.validInput})) alert (\'\\\'\' + this.value + \'\\\' is not valid for \\\'{$row.description}\\\'.\')\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{else}\r\n	Unrecognized Input Type! <b>({$row.inputType})</b>\r\n{/if}\r\n	</td>\r\n</tr>\r\n{/foreach}\r\n</tr>\r\n</table>\r\n\r\n<div align=\"right\">\r\n	<input type=\"submit\" name=\"prefAction\" value=\"Save Changes\" />\r\n</div>\r\n</form>'),(4212,261,0.32,'smarty','0','Page created.',1126222521,3,'216.194.127.150','<h1>{$page.title}</h1>\r\n\r\n{assign var=item value=\"competitions\"}\r\n\r\n{if $smarty.session.company.hide_`$item` eq \"yes\"}\r\n	hiding comps.\r\n{/if}\r\n\r\n{display var=$smarty.session.company}\r\n\r\n{include_php file=\"shared_handle:preferences/groupUpdate\"}\r\n\r\n{assign var=\"currentCategory\" value=\"\"}\r\n\r\n<form method=\"post\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n\r\n{literal}\r\n<script type=\"text/javascript\">\r\nfunction checkNumber(value, min, max, precision) {\r\n	if(value == \'\') return;\r\n	var message = \'\';\r\n	if(value < min || value > max) {\r\n		message = \'Value must be between \' + min + \' and \' + max + \'.\\n\\n\';\r\n		if(precision > 0) {\r\n			message += \'NOTE: Value may be truncated after \' + precision + \' decimal places.\';\r\n		}\r\n	}\r\n	if (value.match(/.*\\..*\\./)) {\r\n		message += \'Please enter a valid number.\';\r\n	}\r\n	if(message) alert(message);\r\n}\r\n</script>\r\n{/literal}\r\n{* display var=$prefValues *}\r\n<table>\r\n{foreach from=$aPrefs item=row}\r\n{* display var=$row *}\r\n{assign var=\"lockedName\" value=\"`$row.name`_locked\"}\r\n{if $currentCategory neq $row.category}\r\n	{assign var=\"currentCategory\" value=$row.category}\r\n	<tr><td colspan=\"2\"><h2 class=\"withBG\">{$currentCategory}</h2></td></tr>\r\n{/if}\r\n<tr><td valign=\"top\"><b>{$row.description}</b><br />\r\n	<input type=\"checkbox\" name=\"userOverride[{$row.name}]\" value=\"1\"{if $prefValues[$lockedName] eq 1} checked=\"checked\"{/if} /> Lock?</td>\r\n{if $row.inputType|test_or:\"select-one\":\"select-multiple\":\"radios\":\"checkboxes\"}\r\n	{assign_array var=\"aOptions\" values=$row.validInput}\r\n	{assign_array var=\"aValues\" values=$prefValues[$row.name]}\r\n	{assign_array var=\"aDefaults\" values=$row.defaultValue}\r\n	{* display var=$aDefaults *}\r\n	{* display var=$aValues *}\r\n{/if}\r\n	<td valign=\"top\">\r\n{if $row.inputType eq \"string\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" maxlength=\"{$row.validInput}\" name=\"prefs[{$row.name}]\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"integer\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9]/))this.value = this.value.replace(/[^0-9]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"float\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9\\.]/))this.value = this.value.replace(/[^0-9\\.]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \'select-one\' OR $row.inputType eq \'select-multiple\'}\r\n	<select name=\"prefs[{$row.name}]{if $row.inputType eq \'select-multiple\'}[]\" multiple=\"multiple\" size=\"{$row.inputSize}{/if}\">\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<option value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option|@in_array:$aValues)} selected=\"selected\"{/if}>{$option}</option>\r\n	{/foreach}</select>\r\n{elseif $row.inputType eq \"radios\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"radio\" name=\"prefs[{$row.name}]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option eq $prefValues[$row.name])} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n{elseif $row.inputType eq \"checkboxes\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"checkbox\" name=\"prefs[{$row.name}][]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND !$row.name|@inArray:$savedPrefs AND $option|@inArray:$aDefaults) OR ($option|@inArray:$aValues)} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n	<input type=\"hidden\" name=\"prefs[{$row.name}][]\" value=\"END:{$row.name}\" /> \r\n{elseif $row.inputType eq \"regex\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onchange=\"if(!this.value.match({$row.validInput})) alert (\'\\\'\' + this.value + \'\\\' is not valid for \\\'{$row.description}\\\'.\')\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{else}\r\n	Unrecognized Input Type! <b>({$row.inputType})</b>\r\n{/if}\r\n	</td>\r\n</tr>\r\n{/foreach}\r\n</tr>\r\n</table>\r\n\r\n<div align=\"right\">\r\n	<input type=\"submit\" name=\"prefAction\" value=\"Save Changes\" />\r\n</div>\r\n</form>'),(4213,261,0.33,'smarty','0','Page created.',1126222593,3,'216.194.127.150','<h1>{$page.title}</h1>\r\n\r\n{assign var=\'hideCheck\' value=\"hide_competitions\"}\r\n\r\n{if $smarty.session.company.`$hideCheck` eq \"yes\"}\r\n	hiding comps.\r\n{/if}\r\n\r\n{display var=$smarty.session.company}\r\n\r\n{include_php file=\"shared_handle:preferences/groupUpdate\"}\r\n\r\n{assign var=\"currentCategory\" value=\"\"}\r\n\r\n<form method=\"post\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n\r\n{literal}\r\n<script type=\"text/javascript\">\r\nfunction checkNumber(value, min, max, precision) {\r\n	if(value == \'\') return;\r\n	var message = \'\';\r\n	if(value < min || value > max) {\r\n		message = \'Value must be between \' + min + \' and \' + max + \'.\\n\\n\';\r\n		if(precision > 0) {\r\n			message += \'NOTE: Value may be truncated after \' + precision + \' decimal places.\';\r\n		}\r\n	}\r\n	if (value.match(/.*\\..*\\./)) {\r\n		message += \'Please enter a valid number.\';\r\n	}\r\n	if(message) alert(message);\r\n}\r\n</script>\r\n{/literal}\r\n{* display var=$prefValues *}\r\n<table>\r\n{foreach from=$aPrefs item=row}\r\n{* display var=$row *}\r\n{assign var=\"lockedName\" value=\"`$row.name`_locked\"}\r\n{if $currentCategory neq $row.category}\r\n	{assign var=\"currentCategory\" value=$row.category}\r\n	<tr><td colspan=\"2\"><h2 class=\"withBG\">{$currentCategory}</h2></td></tr>\r\n{/if}\r\n<tr><td valign=\"top\"><b>{$row.description}</b><br />\r\n	<input type=\"checkbox\" name=\"userOverride[{$row.name}]\" value=\"1\"{if $prefValues[$lockedName] eq 1} checked=\"checked\"{/if} /> Lock?</td>\r\n{if $row.inputType|test_or:\"select-one\":\"select-multiple\":\"radios\":\"checkboxes\"}\r\n	{assign_array var=\"aOptions\" values=$row.validInput}\r\n	{assign_array var=\"aValues\" values=$prefValues[$row.name]}\r\n	{assign_array var=\"aDefaults\" values=$row.defaultValue}\r\n	{* display var=$aDefaults *}\r\n	{* display var=$aValues *}\r\n{/if}\r\n	<td valign=\"top\">\r\n{if $row.inputType eq \"string\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" maxlength=\"{$row.validInput}\" name=\"prefs[{$row.name}]\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"integer\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9]/))this.value = this.value.replace(/[^0-9]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"float\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9\\.]/))this.value = this.value.replace(/[^0-9\\.]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \'select-one\' OR $row.inputType eq \'select-multiple\'}\r\n	<select name=\"prefs[{$row.name}]{if $row.inputType eq \'select-multiple\'}[]\" multiple=\"multiple\" size=\"{$row.inputSize}{/if}\">\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<option value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option|@in_array:$aValues)} selected=\"selected\"{/if}>{$option}</option>\r\n	{/foreach}</select>\r\n{elseif $row.inputType eq \"radios\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"radio\" name=\"prefs[{$row.name}]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option eq $prefValues[$row.name])} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n{elseif $row.inputType eq \"checkboxes\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"checkbox\" name=\"prefs[{$row.name}][]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND !$row.name|@inArray:$savedPrefs AND $option|@inArray:$aDefaults) OR ($option|@inArray:$aValues)} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n	<input type=\"hidden\" name=\"prefs[{$row.name}][]\" value=\"END:{$row.name}\" /> \r\n{elseif $row.inputType eq \"regex\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onchange=\"if(!this.value.match({$row.validInput})) alert (\'\\\'\' + this.value + \'\\\' is not valid for \\\'{$row.description}\\\'.\')\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{else}\r\n	Unrecognized Input Type! <b>({$row.inputType})</b>\r\n{/if}\r\n	</td>\r\n</tr>\r\n{/foreach}\r\n</tr>\r\n</table>\r\n\r\n<div align=\"right\">\r\n	<input type=\"submit\" name=\"prefAction\" value=\"Save Changes\" />\r\n</div>\r\n</form>'),(4214,261,0.34,'smarty','0','Page created.',1126222646,3,'216.194.127.150','<h1>{$page.title}</h1>\r\n\r\n{assign var=\'hideCheck\' value=\"hide_competitions\"}\r\n\r\n{if $smarty.session.company.preferences[$hideCheck] eq \"yes\"}\r\n	hiding comps.\r\n{/if}\r\n\r\n{display var=$smarty.session.company}\r\n\r\n{include_php file=\"shared_handle:preferences/groupUpdate\"}\r\n\r\n{assign var=\"currentCategory\" value=\"\"}\r\n\r\n<form method=\"post\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n\r\n{literal}\r\n<script type=\"text/javascript\">\r\nfunction checkNumber(value, min, max, precision) {\r\n	if(value == \'\') return;\r\n	var message = \'\';\r\n	if(value < min || value > max) {\r\n		message = \'Value must be between \' + min + \' and \' + max + \'.\\n\\n\';\r\n		if(precision > 0) {\r\n			message += \'NOTE: Value may be truncated after \' + precision + \' decimal places.\';\r\n		}\r\n	}\r\n	if (value.match(/.*\\..*\\./)) {\r\n		message += \'Please enter a valid number.\';\r\n	}\r\n	if(message) alert(message);\r\n}\r\n</script>\r\n{/literal}\r\n{* display var=$prefValues *}\r\n<table>\r\n{foreach from=$aPrefs item=row}\r\n{* display var=$row *}\r\n{assign var=\"lockedName\" value=\"`$row.name`_locked\"}\r\n{if $currentCategory neq $row.category}\r\n	{assign var=\"currentCategory\" value=$row.category}\r\n	<tr><td colspan=\"2\"><h2 class=\"withBG\">{$currentCategory}</h2></td></tr>\r\n{/if}\r\n<tr><td valign=\"top\"><b>{$row.description}</b><br />\r\n	<input type=\"checkbox\" name=\"userOverride[{$row.name}]\" value=\"1\"{if $prefValues[$lockedName] eq 1} checked=\"checked\"{/if} /> Lock?</td>\r\n{if $row.inputType|test_or:\"select-one\":\"select-multiple\":\"radios\":\"checkboxes\"}\r\n	{assign_array var=\"aOptions\" values=$row.validInput}\r\n	{assign_array var=\"aValues\" values=$prefValues[$row.name]}\r\n	{assign_array var=\"aDefaults\" values=$row.defaultValue}\r\n	{* display var=$aDefaults *}\r\n	{* display var=$aValues *}\r\n{/if}\r\n	<td valign=\"top\">\r\n{if $row.inputType eq \"string\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" maxlength=\"{$row.validInput}\" name=\"prefs[{$row.name}]\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"integer\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9]/))this.value = this.value.replace(/[^0-9]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"float\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9\\.]/))this.value = this.value.replace(/[^0-9\\.]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \'select-one\' OR $row.inputType eq \'select-multiple\'}\r\n	<select name=\"prefs[{$row.name}]{if $row.inputType eq \'select-multiple\'}[]\" multiple=\"multiple\" size=\"{$row.inputSize}{/if}\">\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<option value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option|@in_array:$aValues)} selected=\"selected\"{/if}>{$option}</option>\r\n	{/foreach}</select>\r\n{elseif $row.inputType eq \"radios\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"radio\" name=\"prefs[{$row.name}]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option eq $prefValues[$row.name])} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n{elseif $row.inputType eq \"checkboxes\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"checkbox\" name=\"prefs[{$row.name}][]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND !$row.name|@inArray:$savedPrefs AND $option|@inArray:$aDefaults) OR ($option|@inArray:$aValues)} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n	<input type=\"hidden\" name=\"prefs[{$row.name}][]\" value=\"END:{$row.name}\" /> \r\n{elseif $row.inputType eq \"regex\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onchange=\"if(!this.value.match({$row.validInput})) alert (\'\\\'\' + this.value + \'\\\' is not valid for \\\'{$row.description}\\\'.\')\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{else}\r\n	Unrecognized Input Type! <b>({$row.inputType})</b>\r\n{/if}\r\n	</td>\r\n</tr>\r\n{/foreach}\r\n</tr>\r\n</table>\r\n\r\n<div align=\"right\">\r\n	<input type=\"submit\" name=\"prefAction\" value=\"Save Changes\" />\r\n</div>\r\n</form>'),(4215,261,0.35,'smarty','0','Page created.',1126222701,3,'216.194.127.150','<h1>{$page.title}</h1>\r\n\r\n{assign var=\"item\" value=\"competitions\"}\r\n{assign var=\'hideCheck\' value=\"hide_`$item`\"}\r\n\r\n{if $smarty.session.company.preferences[\'hide\'] eq \"yes\"}\r\n	hiding comps.\r\n{/if}\r\n\r\n{display var=$smarty.session.company}\r\n\r\n{include_php file=\"shared_handle:preferences/groupUpdate\"}\r\n\r\n{assign var=\"currentCategory\" value=\"\"}\r\n\r\n<form method=\"post\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n\r\n{literal}\r\n<script type=\"text/javascript\">\r\nfunction checkNumber(value, min, max, precision) {\r\n	if(value == \'\') return;\r\n	var message = \'\';\r\n	if(value < min || value > max) {\r\n		message = \'Value must be between \' + min + \' and \' + max + \'.\\n\\n\';\r\n		if(precision > 0) {\r\n			message += \'NOTE: Value may be truncated after \' + precision + \' decimal places.\';\r\n		}\r\n	}\r\n	if (value.match(/.*\\..*\\./)) {\r\n		message += \'Please enter a valid number.\';\r\n	}\r\n	if(message) alert(message);\r\n}\r\n</script>\r\n{/literal}\r\n{* display var=$prefValues *}\r\n<table>\r\n{foreach from=$aPrefs item=row}\r\n{* display var=$row *}\r\n{assign var=\"lockedName\" value=\"`$row.name`_locked\"}\r\n{if $currentCategory neq $row.category}\r\n	{assign var=\"currentCategory\" value=$row.category}\r\n	<tr><td colspan=\"2\"><h2 class=\"withBG\">{$currentCategory}</h2></td></tr>\r\n{/if}\r\n<tr><td valign=\"top\"><b>{$row.description}</b><br />\r\n	<input type=\"checkbox\" name=\"userOverride[{$row.name}]\" value=\"1\"{if $prefValues[$lockedName] eq 1} checked=\"checked\"{/if} /> Lock?</td>\r\n{if $row.inputType|test_or:\"select-one\":\"select-multiple\":\"radios\":\"checkboxes\"}\r\n	{assign_array var=\"aOptions\" values=$row.validInput}\r\n	{assign_array var=\"aValues\" values=$prefValues[$row.name]}\r\n	{assign_array var=\"aDefaults\" values=$row.defaultValue}\r\n	{* display var=$aDefaults *}\r\n	{* display var=$aValues *}\r\n{/if}\r\n	<td valign=\"top\">\r\n{if $row.inputType eq \"string\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" maxlength=\"{$row.validInput}\" name=\"prefs[{$row.name}]\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"integer\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9]/))this.value = this.value.replace(/[^0-9]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"float\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9\\.]/))this.value = this.value.replace(/[^0-9\\.]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \'select-one\' OR $row.inputType eq \'select-multiple\'}\r\n	<select name=\"prefs[{$row.name}]{if $row.inputType eq \'select-multiple\'}[]\" multiple=\"multiple\" size=\"{$row.inputSize}{/if}\">\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<option value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option|@in_array:$aValues)} selected=\"selected\"{/if}>{$option}</option>\r\n	{/foreach}</select>\r\n{elseif $row.inputType eq \"radios\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"radio\" name=\"prefs[{$row.name}]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option eq $prefValues[$row.name])} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n{elseif $row.inputType eq \"checkboxes\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"checkbox\" name=\"prefs[{$row.name}][]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND !$row.name|@inArray:$savedPrefs AND $option|@inArray:$aDefaults) OR ($option|@inArray:$aValues)} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n	<input type=\"hidden\" name=\"prefs[{$row.name}][]\" value=\"END:{$row.name}\" /> \r\n{elseif $row.inputType eq \"regex\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onchange=\"if(!this.value.match({$row.validInput})) alert (\'\\\'\' + this.value + \'\\\' is not valid for \\\'{$row.description}\\\'.\')\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{else}\r\n	Unrecognized Input Type! <b>({$row.inputType})</b>\r\n{/if}\r\n	</td>\r\n</tr>\r\n{/foreach}\r\n</tr>\r\n</table>\r\n\r\n<div align=\"right\">\r\n	<input type=\"submit\" name=\"prefAction\" value=\"Save Changes\" />\r\n</div>\r\n</form>'),(4216,261,0.36,'smarty','0','Page created.',1126222721,3,'216.194.127.150','<h1>{$page.title}</h1>\r\n\r\n{assign var=\"item\" value=\"competitions\"}\r\n{assign var=\'hideCheck\' value=\"hide_`$item`\"}\r\n\r\n{if $smarty.session.company.preferences[$hideCheck] eq \"yes\"}\r\n	hiding comps.\r\n{/if}\r\n\r\n{display var=$smarty.session.company}\r\n\r\n{include_php file=\"shared_handle:preferences/groupUpdate\"}\r\n\r\n{assign var=\"currentCategory\" value=\"\"}\r\n\r\n<form method=\"post\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n\r\n{literal}\r\n<script type=\"text/javascript\">\r\nfunction checkNumber(value, min, max, precision) {\r\n	if(value == \'\') return;\r\n	var message = \'\';\r\n	if(value < min || value > max) {\r\n		message = \'Value must be between \' + min + \' and \' + max + \'.\\n\\n\';\r\n		if(precision > 0) {\r\n			message += \'NOTE: Value may be truncated after \' + precision + \' decimal places.\';\r\n		}\r\n	}\r\n	if (value.match(/.*\\..*\\./)) {\r\n		message += \'Please enter a valid number.\';\r\n	}\r\n	if(message) alert(message);\r\n}\r\n</script>\r\n{/literal}\r\n{* display var=$prefValues *}\r\n<table>\r\n{foreach from=$aPrefs item=row}\r\n{* display var=$row *}\r\n{assign var=\"lockedName\" value=\"`$row.name`_locked\"}\r\n{if $currentCategory neq $row.category}\r\n	{assign var=\"currentCategory\" value=$row.category}\r\n	<tr><td colspan=\"2\"><h2 class=\"withBG\">{$currentCategory}</h2></td></tr>\r\n{/if}\r\n<tr><td valign=\"top\"><b>{$row.description}</b><br />\r\n	<input type=\"checkbox\" name=\"userOverride[{$row.name}]\" value=\"1\"{if $prefValues[$lockedName] eq 1} checked=\"checked\"{/if} /> Lock?</td>\r\n{if $row.inputType|test_or:\"select-one\":\"select-multiple\":\"radios\":\"checkboxes\"}\r\n	{assign_array var=\"aOptions\" values=$row.validInput}\r\n	{assign_array var=\"aValues\" values=$prefValues[$row.name]}\r\n	{assign_array var=\"aDefaults\" values=$row.defaultValue}\r\n	{* display var=$aDefaults *}\r\n	{* display var=$aValues *}\r\n{/if}\r\n	<td valign=\"top\">\r\n{if $row.inputType eq \"string\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" maxlength=\"{$row.validInput}\" name=\"prefs[{$row.name}]\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"integer\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9]/))this.value = this.value.replace(/[^0-9]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"float\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9\\.]/))this.value = this.value.replace(/[^0-9\\.]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \'select-one\' OR $row.inputType eq \'select-multiple\'}\r\n	<select name=\"prefs[{$row.name}]{if $row.inputType eq \'select-multiple\'}[]\" multiple=\"multiple\" size=\"{$row.inputSize}{/if}\">\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<option value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option|@in_array:$aValues)} selected=\"selected\"{/if}>{$option}</option>\r\n	{/foreach}</select>\r\n{elseif $row.inputType eq \"radios\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"radio\" name=\"prefs[{$row.name}]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option eq $prefValues[$row.name])} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n{elseif $row.inputType eq \"checkboxes\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"checkbox\" name=\"prefs[{$row.name}][]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND !$row.name|@inArray:$savedPrefs AND $option|@inArray:$aDefaults) OR ($option|@inArray:$aValues)} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n	<input type=\"hidden\" name=\"prefs[{$row.name}][]\" value=\"END:{$row.name}\" /> \r\n{elseif $row.inputType eq \"regex\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onchange=\"if(!this.value.match({$row.validInput})) alert (\'\\\'\' + this.value + \'\\\' is not valid for \\\'{$row.description}\\\'.\')\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{else}\r\n	Unrecognized Input Type! <b>({$row.inputType})</b>\r\n{/if}\r\n	</td>\r\n</tr>\r\n{/foreach}\r\n</tr>\r\n</table>\r\n\r\n<div align=\"right\">\r\n	<input type=\"submit\" name=\"prefAction\" value=\"Save Changes\" />\r\n</div>\r\n</form>'),(4217,261,0.37,'smarty','0','Page created.',1126222735,3,'216.194.127.150','<h1>{$page.title}</h1>\r\n\r\n{assign var=\"item\" value=\"competitions1\"}\r\n{assign var=\'hideCheck\' value=\"hide_`$item`\"}\r\n\r\n{if $smarty.session.company.preferences[$hideCheck] eq \"yes\"}\r\n	hiding comps.\r\n{/if}\r\n\r\n{display var=$smarty.session.company}\r\n\r\n{include_php file=\"shared_handle:preferences/groupUpdate\"}\r\n\r\n{assign var=\"currentCategory\" value=\"\"}\r\n\r\n<form method=\"post\" action=\"index.php\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n\r\n{literal}\r\n<script type=\"text/javascript\">\r\nfunction checkNumber(value, min, max, precision) {\r\n	if(value == \'\') return;\r\n	var message = \'\';\r\n	if(value < min || value > max) {\r\n		message = \'Value must be between \' + min + \' and \' + max + \'.\\n\\n\';\r\n		if(precision > 0) {\r\n			message += \'NOTE: Value may be truncated after \' + precision + \' decimal places.\';\r\n		}\r\n	}\r\n	if (value.match(/.*\\..*\\./)) {\r\n		message += \'Please enter a valid number.\';\r\n	}\r\n	if(message) alert(message);\r\n}\r\n</script>\r\n{/literal}\r\n{* display var=$prefValues *}\r\n<table>\r\n{foreach from=$aPrefs item=row}\r\n{* display var=$row *}\r\n{assign var=\"lockedName\" value=\"`$row.name`_locked\"}\r\n{if $currentCategory neq $row.category}\r\n	{assign var=\"currentCategory\" value=$row.category}\r\n	<tr><td colspan=\"2\"><h2 class=\"withBG\">{$currentCategory}</h2></td></tr>\r\n{/if}\r\n<tr><td valign=\"top\"><b>{$row.description}</b><br />\r\n	<input type=\"checkbox\" name=\"userOverride[{$row.name}]\" value=\"1\"{if $prefValues[$lockedName] eq 1} checked=\"checked\"{/if} /> Lock?</td>\r\n{if $row.inputType|test_or:\"select-one\":\"select-multiple\":\"radios\":\"checkboxes\"}\r\n	{assign_array var=\"aOptions\" values=$row.validInput}\r\n	{assign_array var=\"aValues\" values=$prefValues[$row.name]}\r\n	{assign_array var=\"aDefaults\" values=$row.defaultValue}\r\n	{* display var=$aDefaults *}\r\n	{* display var=$aValues *}\r\n{/if}\r\n	<td valign=\"top\">\r\n{if $row.inputType eq \"string\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" maxlength=\"{$row.validInput}\" name=\"prefs[{$row.name}]\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"integer\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9]/))this.value = this.value.replace(/[^0-9]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \"float\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onkeyup=\"if(this.value.match(/[^0-9\\.]/))this.value = this.value.replace(/[^0-9\\.]/,\'\');\" onblur=\"checkNumber(this.value, {$row.validInput});\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{elseif $row.inputType eq \'select-one\' OR $row.inputType eq \'select-multiple\'}\r\n	<select name=\"prefs[{$row.name}]{if $row.inputType eq \'select-multiple\'}[]\" multiple=\"multiple\" size=\"{$row.inputSize}{/if}\">\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<option value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option|@in_array:$aValues)} selected=\"selected\"{/if}>{$option}</option>\r\n	{/foreach}</select>\r\n{elseif $row.inputType eq \"radios\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"radio\" name=\"prefs[{$row.name}]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND $option|@inArray:$aDefaults) OR ($option eq $prefValues[$row.name])} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n{elseif $row.inputType eq \"checkboxes\"}\r\n	{foreach from=$aOptions item=\"option\"}\r\n		<input type=\"checkbox\" name=\"prefs[{$row.name}][]\" value=\"{$option}\"{if (!$prefValues[$row.name] AND !$row.name|@inArray:$savedPrefs AND $option|@inArray:$aDefaults) OR ($option|@inArray:$aValues)} checked=\"checked\"{/if}> {$option}<br />\r\n	{/foreach}\r\n	<input type=\"hidden\" name=\"prefs[{$row.name}][]\" value=\"END:{$row.name}\" /> \r\n{elseif $row.inputType eq \"regex\"}\r\n	<input type=\"text\" size=\"{$row.inputSize}\" name=\"prefs[{$row.name}]\" onchange=\"if(!this.value.match({$row.validInput})) alert (\'\\\'\' + this.value + \'\\\' is not valid for \\\'{$row.description}\\\'.\')\" value=\"{$prefValues[$row.name]|default:$row.defaultValue}\" />\r\n{else}\r\n	Unrecognized Input Type! <b>({$row.inputType})</b>\r\n{/if}\r\n	</td>\r\n</tr>\r\n{/foreach}\r\n</tr>\r\n</table>\r\n\r\n<div align=\"right\">\r\n	<input type=\"submit\" name=\"prefAction\" value=\"Save Changes\" />\r\n</div>\r\n</form>'),(4218,202,0.90,'smarty','0','Added company preference check to show SHOPPING stuff.',1126223364,3,'216.194.127.150','{assign var=\"pgLayout\" value=\"layouts/withLeftNav.tpl\"}\r\n\r\n{if $smarty.request.showNewMenu eq \"true\"}\r\n<div class=\"rightSideMenu\">\r\n	<div class=\"rightMenuBox\">\r\n	<h3>EHC News</h3>\r\n		<div class=\"rightMenuItem\">\r\n		<span class=\"floatLeft iconNew\"></span>\r\n		<small><a href=\"#\">Portion Control Article in the nutrition corner. Click here to read</a></small>\r\n		</div>\r\n		<div class=\"rightMenuItem\">\r\n		<small><a href=\"#\">Learn more about carbohydrates and how they affect your body.</a></small>\r\n		</div>	\r\n	</div>\r\n	<div class=\"rightMenuBox\">\r\n	<h3>Product Highlight</h3>\r\n		<div class=\"rightMenuItem\">\r\n		<img src=\"{$skinFolder}images/rypHeartMonitor_small.jpg\" align=\"right\" class=\"img1\" alt=\"\" height=\"120\" width=\"91\" /><br />\r\n		<small><a href=\"#\">Reebok\'s Heart Rate Monitor.  Click here.</a></small>\r\n		</div>\r\n	</div>\r\n	<div class=\"rightMenuBox\">\r\n	<h3>To Do List:</h3>\r\n		<div class=\"rightMenuItem\">\r\n		<small><a href=\"#\">Update your progress</a><br />\r\n		<a href=\"#\">Earn more incentive points</a><br />\r\n		<a href=\"#\">Check out the competition</a><br />\r\n		<a href=\"#\">Read New Articles</a></small>\r\n		</div>\r\n	</div>\r\n</div>\r\n{/if}\r\n\r\n{if $user->isLoggedIn()}\r\n	<img src=\"{$skinFolder}images/ehc/corporateBuilding_sm.jpg\" width=\"100\" height=\"131\" style=\"margin-right:10px; float:left; border:#CCC 1px solid;\" />\r\n\r\n	{include_php file=\"shared_handle:company/announcements\"}\r\n	<h2 class=\"uline\">Company Announcements:</h2>\r\n\r\n	<blockquote>\r\n		<dl>\r\n		{foreach from=$announcements item=\"current\"}\r\n			<dt><div style=\"float:right;\"><small><i>{$current.postedDate|date_format2:\"D, M j\"}</i></small></div>\r\n			    {$current.title}</dt>\r\n			<dd>{$current.description}</dd>\r\n		{foreachelse}\r\n			<dt>No announcements at this time</dt>\r\n		{/foreach}\r\n		</dl>\r\n	</blockquote>\r\n\r\n	{include_php file=\"shared_handle:company/companySurveyList\"}\r\n	<h2 class=\"uline\">Company Surveys:</h2>\r\n	<blockquote>\r\n	<table>\r\n	<tr><td colspan=\"2\">\r\n		<h3>Available Surveys:</h3></td>\r\n	    <td valign=\"middle\"></td></tr>\r\n	{foreach from=$surveys item=item name=\"loopSurveys\"}<tr><td nowrap>\r\n	<tr><td valign=\"top\" nowrap=\"nowrap\">\r\n		{if $item.dateAvailable gt 0}\r\n			<img class=\"icoSurvey\" src=\"blank.gif\" width=\"1\" height=\"1\" alt=\"\" border=\"0\" /></td>\r\n		   <td valign=\"top\"><b><u>{$item.surveyName}</u>:</b> {if $item.frequency eq \"Once\"}Taken{elseif (($item.dateAvailable - $smarty.now) < 43000)}<small>Available At:</small> {$item.dateAvailable|date_format2:\"g:i A\"}{else}<small>Available On:</small> {$item.dateAvailable|date_format2:\"m/d/y\"}{/if}<br />\r\n			{$item.feedbackTitle|default:\"No feedback available.\"}<br />\r\n			<a href=\"?pg=my_feedback&surveyId={$item.id}&amp;feedbackId={$item.feedbackId}\">Click here to learn more<b><i>!</i></b></a><br />\r\n			<br /></td>\r\n		   <td valign=\"middle\" align=\"right\"><em>{$item.pointsEarned}</em></td></tr>\r\n		{else}\r\n			<a href=\"javascript://\" onclick=\"openSurvey({$item.id});\"><img class=\"icoSurvey\" src=\"blank.gif\" width=\"1\" height=\"1\" alt=\"\" border=\"0\" /></a></td>\r\n		   <td valign=\"top\" nowrap=\"nowrap\"><b><u>{$item.surveyName}</u>:</b> <a href=\"javascript://\" onclick=\"openSurvey({$item.id});\">Available Now</a><br />\r\n			{$item.feedbackTitle|default:\"No feedback available.\"}<br />\r\n			<a href=\"?pg=my_feedback&surveyId={$item.id}&amp;feedbackId={$item.feedbackId}\">Click here to learn more<b><i>!</i></b></a><br />\r\n			<br /></td>\r\n		   <td valign=\"middle\" align=\"right\"><em>{$item.pointsEarned}</em></td></tr>\r\n		{/if}\r\n	{foreachelse}\r\n	<tr><td valign=\"top\" colspan=\"3\">\r\n		None found.</td></tr>\r\n	{/foreach}\r\n	</table>\r\n	</blockquote>\r\n\r\n	{if $smarty.session.company.preferences.hide_shop neq \"yes\"}\r\n		<h2 class=\"uline\">eHealthCompete Highlights:</h2>\r\n		\r\n		<table>\r\n		<tr><td valign=\"middle\">\r\n		<blockquote>\r\n		<dl>	\r\n			<dt>Pedometer Deal</dt>\r\n			<dd>eHealthCompete has just negotiated a great deal on RYP Pedometers.  If you have been looking to purchase a pedometer the eHealthCompete price and quality could be your best bet.  This deal is only available to members of EHC.</dd>\r\n			\r\n		</dl>\r\n		</blockquote></td>\r\n		<td valign=\"top\" align=\"center\">\r\n			<a href=\"?pg=my_shop&sub=&tma=VIEW&eids=9\">\r\n			<img id=\"pedometerDealImg\" src=\"blank.gif\" width=\"1\" height=\"1\" alt=\"\" border=\"0\" /><br />\r\n			Buy one now</a>\r\n		</td></tr></table>\r\n	{/if}\r\n{else}\r\n	{assign var=\"hideLogin\" value=\"true\"}\r\n		<script language=\"JavaScript\">{literal}\r\n			function doForgotPassword(boxId, formName) {\r\n				if (!formName) formName = \'loginForm\';\r\n				if (!boxId) boxId = \'usernameBox\';\r\n\r\n				var df = document.forms[formName];\r\n				var obj = document.getElementById(boxId);\r\n		\r\n				if (obj.value == \'\') {\r\n					obj.value = prompt(\'Enter your username:\', \'\');\r\n				}\r\n				\r\n\r\n				df.forgotPassword.value = \'true\';\r\n				df.submit();	\r\n			}\r\n\r\n		{/literal}</script>\r\n	<table align=\"center\" width=\"305\" cellpadding=\"0\" cellspacing=\"0\">\r\n	<tr><td align=\"center\">\r\n		<h2>{$smarty.session.company.companyName}</h2>\r\n	</td></tr>\r\n	<tr><td>\r\n		<div align=\"center\" class=\"chunk300\">\r\n			<form name=\"loginForm2\" method=\"post\" action=\"index.php\" style=\"margin:3px;\">\r\n			<input type=\"hidden\" name=\"pg\" value=\"{$smarty.request.return|default:$signup.return|default:\"my_login\"}\" />\r\n			<input type=\"hidden\" name=\"cid\" value=\"{$smarty.request.cid}\" />\r\n			<input type=\"hidden\" name=\"no_expire\" value=\"true\" />\r\n			<input type=\"hidden\" name=\"no_expire_keep_alive\" value=\"pg cid\" />\r\n			<input type=\"hidden\" name=\"forgotPassword\" value=\"\" />\r\n		\r\n			<h2 class=\"withBG\">Log In:</h2>\r\n				Username: <input id=\"usernameBox2\" type=\"text\" name=\"username\" value=\"{$smarty.request.username}\" class=\"textInput\" size=\"12\" /><br />\r\n				Password: <input type=\"password\" name=\"password\" class=\"textInput\" size=\"12\" /><br />\r\n				<div class=\"underline\">&nbsp;</div>\r\n				<a href=\"javascript:document.forms[\'loginForm2\'].submit();\">Submit</a> | <a href=\"javascript:doForgotPassword(\'usernameBox2\', \'loginForm2\');\">Forgot Password?</a>\r\n				<input type=\"submit\" name=\"loginSubmit\" value=\"Submit\" style=\"position:absolute; top:-300px; left:-300px;\" />\r\n			</form>\r\n			<script language=\"javascript\">\r\n				document.forms.loginForm2.username.focus();\r\n			</script>\r\n		</div>\r\n	</td></tr>\r\n	<tr><td align=\"right\">\r\n		<br />\r\n		{if $smarty.session.company.companyName}\r\n			<small>Not registered yet?</small> <a href=\"?pg=signup/begin\">Sign Up Now!</a> &nbsp;\r\n		{else}\r\n			<!-- Place holder for sign up info content. -->\r\n		{/if}\r\n	</td></tr>\r\n	</table>\r\n{/if}'),(4222,198,0.41,'smarty','0','added content.',1126223650,3,'216.194.127.150','{include file=\"layouts/forceLoggedIn.tpl\"}\r\n{assign var=\"pgLayout\" value=\"layouts/withLeftNav.tpl\"}\r\n<h1>{$page.title}</h1>\r\n\r\n<table>\r\n<tr><td valign=\"top\">\r\n	<div align=\"right\" style=\"width:200px; float:right;\">\r\n	{if $smarty.session.company.preferences.hide_shop neq \"yes\"}\r\n		<a href=\"?pg=my_shop&sub=&tma=VIEW&eids=9\"><img id=\"pedometerDealImg\" src=\"blank.gif\" width=\"1\" height=\"1\" alt=\"\" border=\"0\" /><br style=\"clear:both;\" />\r\n		Buy a Pedometer</a>\r\n	{/if}\r\n	</div>\r\n\r\n	<img src=\"blank.gif\" width=\"1\" height=\"1\" alt=\"\" class=\"iconJoggers\" /> \r\n	<p>Its time to get Active!  Below you will find links that can help you understand ways to get exercise and be safe. Remember, the most difficult hurdle to exercise is time - but you must make time. Check out the \"At the Office\" link for things you can do at work.</p>\r\n	<br />\r\n	<br />\r\n<blockquote>\r\n<table width=\"100%\" cellspacing=\"10\"><tr>\r\n		<td valign=\"top\" width=\"50%\">\r\n		<h3>Fitness Tools:</h3>\r\n		<img src=\"{$skinFolder}images/pliers.gif\" class=\"floatLeft\" />\r\n		<table cellspacing=\"0\" cellpadding=\"0\"><tr><td>\r\n		<ul>\r\n{toc_display start_id=247 level_limit=1 hide_start=1}\r\n{literal}\r\n		<li><a href=\"?pg={$toc_pageName}\">{$toc_title}<br />\r\n			<small>{$toc_description}<br /><br /></small></a></li>\r\n{/literal}\r\n{/toc_display}\r\n		</ul></td></tr></table>\r\n		<br class=\"clearLeft\" />\r\n		<br />\r\n		<h3>Fitness Tip:</h3>\r\n		<img src=\"{$skinFolder}images/ehc/tack.gif\" class=\"floatLeft\" />\r\n		<blockquote class=\"bgWhite\">{include_php file=\"shared_handle:fitness/echoRandomTip\"}</blockquote>\r\n		<ul>\r\n			<li><a href=\"?pg=tips&sub=exercise_tips\">View All Fitness Tips</a></li>\r\n		</ul>\r\n		</td>\r\n		<td valign=\"top\" width=\"50%\">\r\n		<h3>Fitness Articles:</h3>\r\n		<img src=\"{$skinFolder}images/ehc/newspaper.gif\" class=\"floatLeft\" />\r\n		<table><tr><td><ul>\r\n{toc_display start_id=198 level_limit=1 hide_start=1}\r\n{literal}\r\n		<li><a href=\"?pg={$toc_pageName}\">{$toc_title}<br />\r\n			<small>{$toc_description}<br /><br /></small></a></li>\r\n{/literal}\r\n{/toc_display}\r\n		</ul></td></tr></table>\r\n		</td>\r\n	</tr></table>\r\n	</blockquote>\r\n</td></tr>\r\n</table>'),(4223,198,0.42,'smarty','0','added content.',1126223687,3,'216.194.127.150','{include file=\"layouts/forceLoggedIn.tpl\"}\r\n{assign var=\"pgLayout\" value=\"layouts/withLeftNav.tpl\"}\r\n<h1>{$page.title}</h1>\r\n\r\n<table>\r\n<tr><td valign=\"top\">\r\n	<div align=\"right\" style=\"width:200px; float:right;\">\r\n	{if $smarty.session.company.preferences.hide_shop eq \"yes\"}\r\n		<br /><br /><br />\r\n	{else}\r\n		<a href=\"?pg=my_shop&sub=&tma=VIEW&eids=9\"><img id=\"pedometerDealImg\" src=\"blank.gif\" width=\"1\" height=\"1\" alt=\"\" border=\"0\" /><br style=\"clear:both;\" />\r\n		Buy a Pedometer</a>\r\n	{/if}\r\n	</div>\r\n\r\n	<img src=\"blank.gif\" width=\"1\" height=\"1\" alt=\"\" class=\"iconJoggers\" /> \r\n	<p>Its time to get Active!  Below you will find links that can help you understand ways to get exercise and be safe. Remember, the most difficult hurdle to exercise is time - but you must make time. Check out the \"At the Office\" link for things you can do at work.</p>\r\n	<br />\r\n	<br />\r\n<blockquote>\r\n<table width=\"100%\" cellspacing=\"10\"><tr>\r\n		<td valign=\"top\" width=\"50%\">\r\n		<h3>Fitness Tools:</h3>\r\n		<img src=\"{$skinFolder}images/pliers.gif\" class=\"floatLeft\" />\r\n		<table cellspacing=\"0\" cellpadding=\"0\"><tr><td>\r\n		<ul>\r\n{toc_display start_id=247 level_limit=1 hide_start=1}\r\n{literal}\r\n		<li><a href=\"?pg={$toc_pageName}\">{$toc_title}<br />\r\n			<small>{$toc_description}<br /><br /></small></a></li>\r\n{/literal}\r\n{/toc_display}\r\n		</ul></td></tr></table>\r\n		<br class=\"clearLeft\" />\r\n		<br />\r\n		<h3>Fitness Tip:</h3>\r\n		<img src=\"{$skinFolder}images/ehc/tack.gif\" class=\"floatLeft\" />\r\n		<blockquote class=\"bgWhite\">{include_php file=\"shared_handle:fitness/echoRandomTip\"}</blockquote>\r\n		<ul>\r\n			<li><a href=\"?pg=tips&sub=exercise_tips\">View All Fitness Tips</a></li>\r\n		</ul>\r\n		</td>\r\n		<td valign=\"top\" width=\"50%\">\r\n		<h3>Fitness Articles:</h3>\r\n		<img src=\"{$skinFolder}images/ehc/newspaper.gif\" class=\"floatLeft\" />\r\n		<table><tr><td><ul>\r\n{toc_display start_id=198 level_limit=1 hide_start=1}\r\n{literal}\r\n		<li><a href=\"?pg={$toc_pageName}\">{$toc_title}<br />\r\n			<small>{$toc_description}<br /><br /></small></a></li>\r\n{/literal}\r\n{/toc_display}\r\n		</ul></td></tr></table>\r\n		</td>\r\n	</tr></table>\r\n	</blockquote>\r\n</td></tr>\r\n</table>'),(4224,199,0.28,'smarty','0','Added a page_display for the sub pages.',1126223949,3,'216.194.127.150','{include file=\"layouts/forceLoggedIn.tpl\"}\r\n{assign var=\"pgLayout\" value=\"layouts/withLeftNav.tpl\"}\r\n<h1>{$page.title}</h1>\r\n\r\n<table>\r\n<tr><td valign=\"top\">\r\n	<div style=\"float:right; width:200px;\" align=\"right\">\r\n	{if $smarty.session.company.preferences.hide_shop eq \"yes\"}\r\n		<br /><br /><br />\r\n	{else}\r\n		<a href=\"?pg=my_shop&amp;sub=&amp;tma=VIEW&amp;eids=29\">\r\n		<img src=\"blank.gif\" width=\"1\" height=\"1\" alt=\"\" class=\"bigCookbook\" /><br />\r\n		Buy a Cookbook</a>\r\n	{/if}\r\n	</div>\r\n	<img src=\"blank.gif\" width=\"1\" height=\"1\" alt=\"\" class=\"iconEater\" /> \r\n	<p>How nutritious are your meals?  Nutrition is the fuel for your body and is a major factor to your over all health.  Many different chronic diseases are caused by poor eating habits and are very preventable.  Use the links below to learn more about nutrition.</p>\r\n	<br />\r\n	<br />\r\n	<br />\r\n	<br />\r\n<blockquote>\r\n<table width=\"100%\"><tr>\r\n		<td valign=\"top\" width=\"50%\">\r\n		<h3>Nutrition Tools:</h3>\r\n		<img src=\"{$skinFolder}images/pliers.gif\" class=\"floatLeft\" />\r\n		<table cellpadding=\"0\" cellspacing=\"0\"><tr><td>\r\n		<ul>\r\n{toc_display start_id=248 level_limit=1 hide_start=1}\r\n{literal}\r\n	<li><a href=\"?pg={$toc_pageName}\">{$toc_title}<br />\r\n		<small>{$toc_description}<br /><br /></small></a></li>\r\n{/literal}\r\n{/toc_display}\r\n{* \r\n			<li><a href=\"?pg=recipes\">Recipes<br /><small>Slim and tasty recipies to cut out those calories.<br /><br /></small></a></li>\r\n			<li><a href=\"?pg=dieticianinfo\">Nutrition Coach<br /><small>Set an appointment with an EHC Dietitian today.<br /><br /></small></a></li>\r\n			<li><a href=\"?pg=nutrition\">Nutrition Data<br /><small><br /><br /></small></a></li>\r\n*}\r\n		</ul></td></tr></table>\r\n		<br />\r\n		<h3>Nutrition Tip:</h3>\r\n		<img src=\"{$skinFolder}images/ehc/tack.gif\" class=\"floatLeft\" />		\r\n		<blockquote class=\"bgWhite\">		\r\n		{include_php file=\"shared_handle:nutrition/echoRandomTip\"}</blockquote>\r\n		<ul>\r\n			<li><a href=\"?pg=tips&sub=dieting_tips\">View All Nutrition Tips</a></li>\r\n		</ul>\r\n		</td>\r\n		<td valign=\"top\" width=\"50%\">\r\n		<h3>Nutrition Articles:</h3>\r\n		<img src=\"{$skinFolder}images/ehc/newspaper.gif\" class=\"floatLeft\" />\r\n		<table cellspacing=\"0\" cellpadding=\"0\"><tr><td><ul>\r\n{toc_display start_id=199 level_limit=1 hide_start=1}\r\n{literal}\r\n	<li><a href=\"?pg={$toc_pageName}\">{$toc_title}<br />\r\n		<small>{$toc_description}<br /><br /></small></a></li>\r\n{/literal}\r\n{/toc_display}\r\n		</ul></td></tr></table>\r\n		</td>\r\n	</tr></table>\r\n	</blockquote>\r\n</td></tr>\r\n</table>'),(4225,199,0.29,'smarty','0','Added a page_display for the sub pages.',1126224205,3,'216.194.127.150','{include file=\"layouts/forceLoggedIn.tpl\"}\r\n{assign var=\"pgLayout\" value=\"layouts/withLeftNav.tpl\"}\r\n<h1>{$page.title}</h1>\r\n\r\n<table>\r\n<tr><td valign=\"top\">\r\n	<div style=\"float:right; width:200px;\" align=\"right\">\r\n	{if $smarty.session.company.preferences.hide_shop eq \"yes\"}\r\n		<br /><br /><br />\r\n	{else}\r\n		<a href=\"?pg=my_shop&amp;sub=&amp;tma=VIEW&amp;eids=29\">\r\n		<img src=\"blank.gif\" width=\"1\" height=\"1\" alt=\"\" class=\"smallCookbook\" /><br />\r\n		Buy a Cookbook</a>\r\n	{/if}\r\n	</div>\r\n	<img src=\"blank.gif\" width=\"1\" height=\"1\" alt=\"\" class=\"iconEater\" /> \r\n	<p>How nutritious are your meals?  Nutrition is the fuel for your body and is a major factor to your over all health.  Many different chronic diseases are caused by poor eating habits and are very preventable.  Use the links below to learn more about nutrition.</p>\r\n	<br />\r\n	<br />\r\n	<br />\r\n	<br />\r\n<blockquote>\r\n<table width=\"100%\"><tr>\r\n		<td valign=\"top\" width=\"50%\">\r\n		<h3>Nutrition Tools:</h3>\r\n		<img src=\"{$skinFolder}images/pliers.gif\" class=\"floatLeft\" />\r\n		<table cellpadding=\"0\" cellspacing=\"0\"><tr><td>\r\n		<ul>\r\n{toc_display start_id=248 level_limit=1 hide_start=1}\r\n{literal}\r\n	<li><a href=\"?pg={$toc_pageName}\">{$toc_title}<br />\r\n		<small>{$toc_description}<br /><br /></small></a></li>\r\n{/literal}\r\n{/toc_display}\r\n{* \r\n			<li><a href=\"?pg=recipes\">Recipes<br /><small>Slim and tasty recipies to cut out those calories.<br /><br /></small></a></li>\r\n			<li><a href=\"?pg=dieticianinfo\">Nutrition Coach<br /><small>Set an appointment with an EHC Dietitian today.<br /><br /></small></a></li>\r\n			<li><a href=\"?pg=nutrition\">Nutrition Data<br /><small><br /><br /></small></a></li>\r\n*}\r\n		</ul></td></tr></table>\r\n		<br />\r\n		<h3>Nutrition Tip:</h3>\r\n		<img src=\"{$skinFolder}images/ehc/tack.gif\" class=\"floatLeft\" />		\r\n		<blockquote class=\"bgWhite\">		\r\n		{include_php file=\"shared_handle:nutrition/echoRandomTip\"}</blockquote>\r\n		<ul>\r\n			<li><a href=\"?pg=tips&sub=dieting_tips\">View All Nutrition Tips</a></li>\r\n		</ul>\r\n		</td>\r\n		<td valign=\"top\" width=\"50%\">\r\n		<h3>Nutrition Articles:</h3>\r\n		<img src=\"{$skinFolder}images/ehc/newspaper.gif\" class=\"floatLeft\" />\r\n		<table cellspacing=\"0\" cellpadding=\"0\"><tr><td><ul>\r\n{toc_display start_id=199 level_limit=1 hide_start=1}\r\n{literal}\r\n	<li><a href=\"?pg={$toc_pageName}\">{$toc_title}<br />\r\n		<small>{$toc_description}<br /><br /></small></a></li>\r\n{/literal}\r\n{/toc_display}\r\n		</ul></td></tr></table>\r\n		</td>\r\n	</tr></table>\r\n	</blockquote>\r\n</td></tr>\r\n</table>'),(4226,184,0.53,'smarty','1','added feedback display',1126227403,3,'216.194.127.150','{assign var=\"pgLayout\" value=\"file:./layouts/lite.tpl\"}\r\n{include_php file=\"shared_handle:company/survey\"}\r\n\r\n<h2 class=\"withBG\">{$survey.surveyName|default:\"Unnamed Survey\"}</h2>\r\n<div style=\"margin-left:20px;\"><small>\r\n	May be taken: <i>{$survey.frequency}</i><br />\r\n	Logged in as: <i>{$user->firstName} {$user->lastName} ({$user->username})</i><br />	\r\n</small></div>\r\n\r\n<form name=\"surveyForm\" action=\"index.php\" method=\"post\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n<input type=\"hidden\" name=\"no_expire\" value=\"true\" />\r\n<input type=\"hidden\" name=\"id\" value=\"{$smarty.request.id}\" />\r\n\r\n{if !$survey.takenId AND $survey.instructions}<blockquote><small>{$survey.instructions}</small></blockquote>\r\n{elseif $survey.takenId AND $survey.completionText}<blockquote><small>{$survey.completionText}</small></blockquote>\r\n{/if}\r\n\r\n<!-- {$survey.takenId} AND {$survey.feedbackId} -->\r\n\r\n{if $survey.takenId AND $survey.feedbackId}\r\n{select_query return=\"row\" assign=\"feedback\"}\r\n	title, feedback AS details FROM survey_feedback WHERE id = {$survey.feedbackId} \r\n{/select_query}\r\n<h2 class=\"withBG\">Result: <b>{$feedback.title}</b></h2>\r\n<blockquote><small>{$feedback.details}</small></blockquote>{/if}\r\n\r\n<ol id=\"surveyQuestionList\">\r\n	{foreach name=\"questions\" from=$survey.questions item=\"question\"}\r\n	<li>{$question.question}{assign var=\"qid\" value=$question.id}\r\n	<dl>{assign var=\"i\" value=$smarty.foreach.questions.iteration}\r\n		{if $question.A != \"\"}<dt><input id=\"q{$i}A\" type=\"radio\" name=\"q[{$qid}]\" value=\"A\" {if $smarty.post.q.$qid eq \"A\"}checked=\"checked\" {/if}/> <a href=\"javascript://\" onclick=\"document.getElementById(\'q{$i}A\').checked = true;\">{$question.A}</a></dt>{/if}\r\n		{if $question.B != \"\"}<dt><input id=\"q{$i}B\" type=\"radio\" name=\"q[{$qid}]\" value=\"B\" {if $smarty.post.q.$qid eq \"B\"}checked=\"checked\" {/if}/> <a href=\"javascript://\" onclick=\"document.getElementById(\'q{$i}B\').checked = true;\">{$question.B}</a></dt>{/if}\r\n		{if $question.C != \"\"}<dt><input id=\"q{$i}C\" type=\"radio\" name=\"q[{$qid}]\" value=\"C\" {if $smarty.post.q.$qid eq \"C\"}checked=\"checked\" {/if}/> <a href=\"javascript://\" onclick=\"document.getElementById(\'q{$i}C\').checked = true;\">{$question.C}</a></dt>{/if}\r\n		{if $question.D != \"\"}<dt><input id=\"q{$i}D\" type=\"radio\" name=\"q[{$qid}]\" value=\"D\" {if $smarty.post.q.$qid eq \"D\"}checked=\"checked\" {/if}/> <a href=\"javascript://\" onclick=\"document.getElementById(\'q{$i}D\').checked = true;\">{$question.D}</a></dt>{/if}\r\n		{if $question.E != \"\"}<dt><input id=\"q{$i}E\" type=\"radio\" name=\"q[{$qid}]\" value=\"E\" {if $smarty.post.q.$qid eq \"E\"}checked=\"checked\" {/if}/> <a href=\"javascript://\" onclick=\"document.getElementById(\'q{$i}E\').checked = true;\">{$question.E}</a></dt>{/if}\r\n	</dl></li>\r\n	{/foreach}\r\n</ol>\r\n\r\n<div class=\"underline\"></div>\r\n<div style=\"text-align:center;margin-top:10px;\">{if !$survey.takenId AND $survey.dateAvailable eq \"now\"}<input type=\"submit\" name=\"surveyAction\" value=\"Submit Responses\" />{else}{if $survey.takenId}<input type=\"button\" onclick=\"location.replace(\'index.php?pg=surveyReview&takenId={$survey.takenId}\')\" value=\"Review Responses &amp; Feedback\" />{/if}<input type=\"button\" onclick=\"location.replace(\'index.php?pg=surveyHistory\');\" value=\"{if $survey.frequency eq \"Once\"}No Longer Available (One time survey){elseif $survey.dateAvailable}Not available again until {$survey.dateAvailable|date_format2:\"m/d/y\"}{else}View Survey History{/if}\" />{/if}</div>\r\n</form>\r\n'),(4668,274,0.10,'smarty','0','Page created.',1135917904,3,'24.2.76.126',''),(4669,274,0.11,'smarty','0','Page created.',1135918194,3,'24.2.76.126','{include file=\"shared:layouts/comp_create_navbar.tpl\"}\r\n\r\n<table width=\"100%\">\r\n<tr>\r\n  <td valign=\"top\">\r\n   <h2>Already a Member?:</h2>\r\n   Login..\r\n  </td>\r\n  <td valign=\"top\">\r\n   <h2>Create an Account:</h2>\r\n   <table>\r\n   <tr>\r\n     <td>First Name:</td>\r\n     <td><input type=\"text\" /></td>\r\n  </td>\r\n</tr>\r\n</table>'),(4233,210,0.20,'smarty','0','Page created.',1126304648,3,'216.194.127.150','{assign var=\"pgLayout\" value=\"layouts/withLeftNav.tpl\"}\r\n<h1>{$page.title}</h1>\r\n<br />\r\n<h2 class=\"withBG\">{$smarty.session.company.companyName}</h2>\r\n\r\n{include_php file=\"shared_handle:availableCompetitions\"}\r\n\r\n<form name=\"joinCompetitions\" method=\"post\" action=\"index.php\" style=\"margin:0px;\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n<input type=\"hidden\" name=\"no_expire\" value=\"true\" />\r\n\r\n{* style_table folder=\"img/st/floatbox\" *}\r\n  <table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" width=\"100%\">\r\n	<tr>\r\n		<td bgcolor=\"#EEEEEE\">&nbsp;</td>\r\n		<td bgcolor=\"#EEEEEE\"><b>ID #</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>Title</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>Start Date</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>End Date</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>Style</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>Scoring Method</b></td>\r\n	</tr>\r\n	{foreach from=$availableCompetitions item=\"comp\"}\r\n	<tr>\r\n		{if not $user->inGroupName($comp.code)}\r\n		{assign var=\"isJoinable\" value=\"true\"}\r\n		<td><input type=\"checkbox\" name=\"joinComp[]\" value=\"{$comp.id}\" /></td>\r\n		<td>{$comp.id}</td>\r\n		<td>{$comp.title}</td>\r\n		<td>{$comp.startDate|date_format2:\"D n/j/y\"}</td>\r\n		<td>{$comp.endDate|date_format2:\"D n/j/y\"}</td>\r\n		<td>{$comp.style}</td>\r\n		<td>{$comp.scoringMethod}</td>\r\n		{else}\r\n		{assign var=\"isInComps\" value=\"true\"}\r\n		<td bgcolor=\"#FFCCCC\">&times;</td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.id}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.title}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.startDate|date_format2:\"D n/j/y\"}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.endDate|date_format2:\"D n/j/y\"}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.style}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.scoringMethod}</i></td>\r\n		{/if}\r\n	</tr>\r\n	{foreachelse}\r\n	<tr>\r\n		<td colspan=\"7\" align=\"center\">Sorry. There are currently no active competitions available.</td>\r\n	</tr>	\r\n	{/foreach}\r\n  </table>\r\n{* /style_table *}\r\n\r\n{if !$isJoinable}{redirect href=\"?pg=my_login\"}{/if}\r\n\r\n<br />\r\n<div align=\"center\">{if $isJoinable}<input type=\"submit\" name=\"submitBtn\" value=\"Join Selected Competitions\" /> <input type=\"submit\" name=\"submitBtn\" value=\"Join Later\" />{else}<b>No Competitions To Join</b>{/if}</div>\r\n{if $isInComps}\r\n<br />\r\n<div style=\"background-color:#FCC; margin-left:20px; width:250px;\">&times; - You are already a member</div>\r\n{/if}\r\n\r\n</form>\r\n\r\n{if $company.vanity eq \"myfamily\"}\r\n<div>\r\nClick <a href=\"?pg=5to9Rules\">here</a> for the 5 to 9 a-day instructions and rules\r\n</div>\r\n{/if}'),(4234,210,0.21,'smarty','0','Page created.',1126304684,3,'216.194.127.150','{assign var=\"pgLayout\" value=\"layouts/withLeftNav.tpl\"}\r\n<h1>{$page.title}</h1>\r\n<br />\r\n<h2 class=\"withBG\">{$smarty.session.company.companyName}</h2>\r\n\r\n{include_php file=\"shared_handle:availableCompetitions\"}\r\n\r\n<form name=\"joinCompetitions\" method=\"post\" action=\"index.php\" style=\"margin:0px;\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n<input type=\"hidden\" name=\"no_expire\" value=\"true\" />\r\n\r\n{* style_table folder=\"img/st/floatbox\" *}\r\n  <table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" width=\"100%\">\r\n	<tr>\r\n		<td bgcolor=\"#EEEEEE\">&nbsp;</td>\r\n		<td bgcolor=\"#EEEEEE\"><b>ID #</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>Title</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>Start Date</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>End Date</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>Style</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>Scoring Method</b></td>\r\n	</tr>\r\n	{foreach from=$availableCompetitions item=\"comp\"}\r\n	<tr>\r\n		{if not $user->inGroupName($comp.code)}\r\n		{assign var=\"isJoinable\" value=\"true\"}\r\n		<td><input type=\"checkbox\" name=\"joinComp[]\" value=\"{$comp.id}\" /></td>\r\n		<td>{$comp.id}</td>\r\n		<td>{$comp.title}</td>\r\n		<td>{$comp.startDate|date_format2:\"D n/j/y\"}</td>\r\n		<td>{$comp.endDate|date_format2:\"D n/j/y\"}</td>\r\n		<td>{$comp.style}</td>\r\n		<td>{$comp.scoringMethod}</td>\r\n		{else}\r\n		{assign var=\"isInComps\" value=\"true\"}\r\n		<td bgcolor=\"#FFCCCC\">&times;</td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.id}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.title}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.startDate|date_format2:\"D n/j/y\"}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.endDate|date_format2:\"D n/j/y\"}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.style}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.scoringMethod}</i></td>\r\n		{/if}\r\n	</tr>\r\n	{foreachelse}\r\n	<tr>\r\n		<td colspan=\"7\" align=\"center\">Sorry. There are currently no active competitions available.</td>\r\n	</tr>	\r\n	{/foreach}\r\n  </table>\r\n{* /style_table *}\r\n\r\n{* if !$isJoinable}{redirect href=\"?pg=my_login\"}{/if *}\r\n\r\n<br />\r\n<div align=\"center\">{if $isJoinable}<input type=\"submit\" name=\"submitBtn\" value=\"Join Selected Competitions\" /> <input type=\"submit\" name=\"submitBtn\" value=\"Join Later\" />{else}<b>No Competitions To Join</b>{/if}</div>\r\n{if $isInComps}\r\n<br />\r\n<div style=\"background-color:#FCC; margin-left:20px; width:250px;\">&times; - You are already a member</div>\r\n{/if}\r\n\r\n</form>\r\n\r\n{if $company.vanity eq \"myfamily\"}\r\n<div>\r\nClick <a href=\"?pg=5to9Rules\">here</a> for the 5 to 9 a-day instructions and rules\r\n</div>\r\n{/if}'),(4235,210,0.22,'smarty','0','Page created.',1126304879,3,'216.194.127.150','{assign var=\"pgLayout\" value=\"layouts/withLeftNav.tpl\"}\r\n<h1>{$page.title}</h1>\r\n<br />\r\n<h2 class=\"withBG\">{$smarty.session.company.companyName}</h2>\r\n\r\n{include_php file=\"shared_handle:availableCompetitions\"}\r\n\r\n<form name=\"joinCompetitions\" method=\"post\" action=\"index.php\" style=\"margin:0px;\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n<input type=\"hidden\" name=\"no_expire\" value=\"true\" />\r\n\r\n{* style_table folder=\"img/st/floatbox\" *}\r\n  <table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" width=\"100%\">\r\n	<tr>\r\n		<td bgcolor=\"#EEEEEE\">&nbsp;</td>\r\n		<td bgcolor=\"#EEEEEE\"><b>ID #</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>Title</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>Start Date</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>End Date</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>Style</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>Scoring Method</b></td>\r\n	</tr>\r\n	{foreach from=$availableCompetitions item=\"comp\"}\r\n	<tr>\r\n		{if not $user->inGroupName($comp.code)}\r\n		{assign var=\"isJoinable\" value=\"true\"}\r\n		<td><input type=\"checkbox\" name=\"joinComp[]\" value=\"{$comp.id}\" /></td>\r\n		<td>{$comp.id}</td>\r\n		<td>{$comp.title}</td>\r\n		<td>{$comp.startDate|date_format2:\"D n/j/y\"}</td>\r\n		<td>{$comp.endDate|date_format2:\"D n/j/y\"}</td>\r\n		<td>{$comp.style}</td>\r\n		<td>{$comp.scoringMethod}</td>\r\n		{else}\r\n		{assign var=\"isInComps\" value=\"true\"}\r\n		<td bgcolor=\"#FFCCCC\">&times;</td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.id}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.title}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.startDate|date_format2:\"D n/j/y\"}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.endDate|date_format2:\"D n/j/y\"}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.style}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.scoringMethod}</i></td>\r\n		{/if}\r\n	</tr>\r\n	{foreachelse}\r\n	<tr>\r\n		<td colspan=\"7\" align=\"center\">Sorry. There are currently no active competitions available.</td>\r\n	</tr>	\r\n	{/foreach}\r\n  </table>\r\n{* /style_table *}\r\n\r\n{* if !$isJoinable}{redirect href=\"?pg=my_login\"}{/if *}\r\n\r\n<br />\r\n<div align=\"center\">{if $isJoinable}<input type=\"submit\" name=\"submitBtn\" value=\"Join Selected Competitions\" /> <input type=\"submit\" name=\"submitBtn\" value=\"Join Later\" />{else}<b>No Competitions To Join</b> <input type=\"submit\" name=\"submitBtn\" value=\"Go to My Home\" />{/if}</div>\r\n{if $isInComps}\r\n<br />\r\n<div style=\"background-color:#FCC; margin-left:20px; width:250px;\">&times; - You are already a member</div>\r\n{/if}\r\n\r\n</form>\r\n\r\n{if $company.vanity eq \"myfamily\"}\r\n<div>\r\nClick <a href=\"?pg=5to9Rules\">here</a> for the 5 to 9 a-day instructions and rules\r\n</div>\r\n{/if}'),(4236,210,0.23,'smarty','0','Page created.',1126305156,3,'216.194.127.150','{assign var=\"pgLayout\" value=\"layouts/withLeftNav.tpl\"}\r\n<h1>{$page.title}</h1>\r\n<br />\r\n<h2 class=\"withBG\">{$smarty.session.company.companyName}</h2>\r\n\r\n{include_php file=\"shared_handle:availableCompetitions\"}\r\n\r\n<form name=\"joinCompetitions\" method=\"post\" action=\"index.php\" style=\"margin:0px;\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n<input type=\"hidden\" name=\"no_expire\" value=\"true\" />\r\n\r\n{* style_table folder=\"img/st/floatbox\" *}\r\n  <table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" width=\"100%\">\r\n	<tr>\r\n		<td bgcolor=\"#EEEEEE\">&nbsp;</td>\r\n		<td bgcolor=\"#EEEEEE\"><b>ID #</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>Title</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>Start Date</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>End Date</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>Style</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>Scoring Method</b></td>\r\n	</tr>\r\n	{foreach from=$availableCompetitions item=\"comp\"}\r\n	<tr>\r\n		{if not $user->inGroupName($comp.code)}\r\n		{assign var=\"isJoinable\" value=\"true\"}\r\n		<td><input type=\"checkbox\" name=\"joinComp[]\" value=\"{$comp.id}\" /></td>\r\n		<td>{$comp.id}</td>\r\n		<td>{$comp.title}</td>\r\n		<td>{$comp.startDate|date_format2:\"D n/j/y\"}</td>\r\n		<td>{$comp.endDate|date_format2:\"D n/j/y\"}</td>\r\n		<td>{$comp.style}</td>\r\n		<td>{$comp.scoringMethod}</td>\r\n		{else}\r\n		{assign var=\"isInComps\" value=\"true\"}\r\n		<td bgcolor=\"#FFCCCC\">&times;</td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.id}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.title}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.startDate|date_format2:\"D n/j/y\"}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.endDate|date_format2:\"D n/j/y\"}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.style}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.scoringMethod}</i></td>\r\n		{/if}\r\n	</tr>\r\n	{foreachelse}\r\n	<tr>\r\n		<td colspan=\"7\" align=\"center\">There are currently no active competitions available.</td>\r\n	</tr>	\r\n	{/foreach}\r\n  </table>\r\n{* /style_table *}\r\n\r\n{* if !$isJoinable}{log_error message=\'There are no competitions to join\' db_log=0 is_critical=0}{redirect href=\"?pg=my_login\"}{/if *}\r\n\r\n<br />\r\n<div align=\"center\">{if $isJoinable}<input type=\"submit\" name=\"submitBtn\" value=\"Join Selected Competitions\" /> <input type=\"submit\" name=\"submitBtn\" value=\"Join Later\" />{else}<b>No Competitions To Join</b> <input type=\"submit\" name=\"submitBtn\" value=\"Go to My Home\" />{/if}</div>\r\n{if $isInComps}\r\n<br />\r\n<div style=\"background-color:#FCC; margin-left:20px; width:250px;\">&times; - You are already a member</div>\r\n{/if}\r\n\r\n</form>\r\n\r\n{if $company.vanity eq \"myfamily\"}\r\n<div>\r\nClick <a href=\"?pg=5to9Rules\">here</a> for the 5 to 9 a-day instructions and rules\r\n</div>\r\n{/if}'),(4834,286,0.14,'smarty','0','Page created.',1139608295,16,'216.194.127.150','{include file=\"layouts/forceLoggedIn.tpl\"}\r\n{include_php file=\"shared_handle:company/consumerSurveyList\"}\r\n\r\n{assign var=\"pgLayout\" value=\"layouts/withLeftNav.tpl\"}\r\n<h1>Healthy For Life</h1>\r\n\r\n<table width=\"100%\"><tr><td valign=\"top\">\r\n	<img class=\"iconClipboard\" src=\"blank.gif\" width=\"1\" height=\"1\" alt=\"\" />\r\n</td><td valign=\"top\" width=\"100%\">\r\n	Welcome to Healthy For life.....add text here!	\r\n</td></tr>\r\n</table>\r\n\r\n<blockquote>\r\n<table width=\"100%\"><tr>\r\n<td valign=\"top\" width=\"100%\">\r\n	<h3>Available Surveys:</h3>\r\n	<table>\r\n	{foreach from=$surveys item=item name=\"loopSurveys\"}<tr><td nowrap>\r\n	<tr><td valign=\"top\" nowrap=\"nowrap\">\r\n		{if $item.dateAvailable gt 0}\r\n			<img class=\"ico{$item.id}\" src=\"blank.gif\" width=\"1\" height=\"1\" alt=\"\" /></td>\r\n		   <td valign=\"top\"><b><u>{$item.surveyName}</u>:</b> {if $item.frequency eq \"Once\"}Taken{elseif (($item.dateAvailable - $smarty.now) < 43000)}<small>Available At:</small> {$item.dateAvailable|date_format2:\"g:i A\"}{else}<small>Available On:</small> {$item.dateAvailable|date_format2:\"m/d/y\"}{/if}<br />\r\n			{$item.feedbackTitle|default:\"No feedback available.\"}<br />\r\n			<a href=\"?pg=my_feedback&surveyId={$item.id}&amp;feedbackId={$item.feedbackId}\">Click here to learn more<b><i>!</i></b></a><br />\r\n			<br /></td>\r\n		   <td valign=\"middle\" align=\"right\"><em>{$item.pointsEarned}</em></td></tr>\r\n		{else}\r\n			<a href=\"javascript://\" onclick=\"openSurvey({$item.id});\"><img class=\"ico{$item.id}\" src=\"blank.gif\" width=\"1\" height=\"1\" alt=\"\" /></a></td>\r\n		   <td valign=\"top\" nowrap=\"nowrap\"><b><u>{$item.surveyName}</u>:</b> <a href=\"javascript://\" onclick=\"openSurvey({$item.id});\">Available Now</a><br />\r\n			{$item.feedbackTitle|default:\"No feedback available.\"}<br />\r\n			<a href=\"?pg=my_feedback&surveyId={$item.id}&amp;feedbackId={$item.feedbackId}\">Click here to learn more<b><i>!</i></b></a><br />\r\n			<br /></td>\r\n		   <td valign=\"middle\" align=\"right\"><em>{$item.pointsEarned}</em></td></tr>\r\n		{/if}\r\n	{foreachelse}\r\n	<tr><td valign=\"top\" colspan=\"3\">\r\n		None found.</td></tr>\r\n	{/foreach}\r\n	</table>\r\n</td>\r\n<td valign=\"top\" nowrap=\"nowrap\">\r\n	<h3>Company Forums:</h3>\r\n	<ul>\r\n	{foreach from=$companyForums item=\"cForum\"}\r\n	<li><a href=\"?pg=company_forum&fId={$cForum.id}\">{$cForum.name}</a></li>\r\n	{/foreach}\r\n	</ul>\r\n</td>\r\n</tr>\r\n</table>\r\n</blockquote>'),(4835,286,0.15,'smarty','0','Page created.',1139608329,16,'216.194.127.150','{include file=\"layouts/forceLoggedIn.tpl\"}\r\n{include_php file=\"shared_handle:company/consumerSurveyList\"}\r\n\r\n{assign var=\"pgLayout\" value=\"layouts/withLeftNav.tpl\"}\r\n<h1>Healthy For Life</h1>\r\n\r\n<table width=\"100%\"><tr><td valign=\"top\">\r\n	<img class=\"iconClipboard\" src=\"blank.gif\" width=\"1\" height=\"1\" alt=\"\" />\r\n</td><td valign=\"top\" width=\"100%\">\r\n	Welcome to Healthy For life.....add text here!	\r\n</td></tr>\r\n</table>\r\n\r\n<blockquote>\r\n<table width=\"100%\"><tr>\r\n<td valign=\"top\" width=\"100%\">\r\n	<h3>Available Surveys:</h3>\r\n	<table>\r\n	{foreach from=$surveys item=item name=\"loopSurveys\"}<tr><td nowrap>\r\n	<tr><td valign=\"top\" nowrap=\"nowrap\">\r\n		{if $item.dateAvailable gt 0}\r\n			<img class=\"ico{$item.id}\" src=\"blank.gif\" width=\"1\" height=\"1\" alt=\"\" /></td>\r\n		   <td valign=\"top\"><b><u>{$item.surveyName}</u>:</b> {if $item.frequency eq \"Once\"}Taken{elseif (($item.dateAvailable - $smarty.now) < 43000)}<small>Available At:</small> {$item.dateAvailable|date_format2:\"g:i A\"}{else}<small>Available On:</small> {$item.dateAvailable|date_format2:\"m/d/y\"}{/if}<br />\r\n			{$item.feedbackTitle|default:\"No feedback available.\"}<br />\r\n			<a href=\"?pg=my_feedback&surveyId={$item.id}&amp;feedbackId={$item.feedbackId}\">Click here to learn more<b><i>!</i></b></a><br />\r\n			<br /></td>\r\n		   <td valign=\"middle\" align=\"right\"><em>{$item.pointsEarned}</em></td></tr>\r\n		{else}\r\n			<a href=\"javascript://\" onclick=\"openSurvey({$item.id});\"><img class=\"ico{$item.id}\" src=\"blank.gif\" width=\"1\" height=\"1\" alt=\"\" /></a></td>\r\n		   <td valign=\"top\" nowrap=\"nowrap\"><b><u>{$item.surveyName}</u>:</b> <a href=\"javascript://\" onclick=\"openSurvey({$item.id});\">Available Now</a><br />\r\n			{$item.feedbackTitle|default:\"No feedback available.\"}<br />\r\n			<a href=\"?pg=my_feedback&surveyId={$item.id}&amp;feedbackId={$item.feedbackId}\">Click here to learn more<b><i>!</i></b></a><br />\r\n			<br /></td>\r\n		   <td valign=\"middle\" align=\"right\"><em>{$item.pointsEarned}</em></td></tr>\r\n		{/if}\r\n	{foreachelse}\r\n	<tr><td valign=\"top\" colspan=\"3\">\r\n		None found.</td></tr>\r\n	{/foreach}\r\n	</table>\r\n</td>\r\n</tr>\r\n</table>\r\n</blockquote>'),(4692,275,0.11,'smarty','0','Page created.',1135920219,3,'24.2.76.126','{include file=\"shared:layouts/comp_create_navbar.tpl\"}\r\n\r\n<br />\r\n<h2>Competition Fee Payment</h2>\r\n\r\n<b>Competition title</b><br />\r\nEtc.<br />\r\netc.<br />\r\n\r\n<table width=\"100%\">\r\n<tr>\r\n  <td><b>Billing Information:</b></td>\r\n  <td><b>Payment Information:</b></td>\r\n</tr>\r\n</table>\r\n'),(4693,275,0.12,'smarty','0','Page created.',1135920729,3,'24.2.76.126','{include file=\"shared:layouts/comp_create_navbar.tpl\"}\r\n\r\n<br />\r\n<h2>Competition Fee Payment</h2>\r\n\r\n<b>Competition title</b><br />\r\nEtc.<br />\r\netc.<br />\r\n\r\n<table width=\"100%\">\r\n<tr>\r\n  <td><b>Billing Information:</b>\r\n  <div class=\"chunk300\">\r\n	<h2 class=\"withBG\">\r\n		<div class=\"topRight hideShow\"><a href=\"javascript:toggle(\'billInfo\', \'\', \'showHide\');\"><img id=\"billInfo_swap\" src=\"./img/blank.gif\" class=\"showHide_{if $success.billIsValid}off{else}on{/if}\" alt=\"show/hide\" border=\"0\" /></a></div>\r\n		Billing Information</h2>\r\n	<p>Enter the billing information for the credit card owner.<br />\r\n	<small>(* indicates a required field)</small></p>\r\n	\r\n	<div id=\"billInfo\" style=\"display:{if $success.billIsValid}none{else}block{/if};\">\r\n	<a href=\"javascript:billFromShip();\" class=\"button\">Same as Shipping</a><br />\r\n	*First Name:\r\n	<input type=\"text\" name=\"bill[firstname]\" value=\"{$smarty.request.bill.firstname|default:$userInfo.firstName}\" class=\"textInput\" style=\"width:200px;\" /><br />\r\n	*Last Name:\r\n	<input type=\"text\" name=\"bill[lastname]\" value=\"{$smarty.request.bill.lastname|default:$userInfo.lastName}\" class=\"textInput\" style=\"width:200px;\" /><br />\r\n\r\n	Company:\r\n	<input type=\"text\" name=\"bill[company]\" value=\"{$smarty.request.bill.company|default:$userInfo.company}\" class=\"textInput\" style=\"width:200px;\" /><br />\r\n\r\n	*Address:\r\n	<input type=\"text\" name=\"bill[address1]\" value=\"{$smarty.request.bill.address1|default:$userInfo.address1}\" class=\"textInput\" style=\"width:200px;\" /><br />\r\n	Line 2:\r\n	<input type=\"text\" name=\"bill[address2]\" value=\"{$smarty.request.bill.address2|default:$userInfo.address2}\" class=\"textInput\" style=\"width:200px;\" /><br />\r\n\r\n	*City:\r\n	<input type=\"text\" name=\"bill[city]\" value=\"{$smarty.request.bill.city|default:$userInfo.city}\" class=\"textInput\" style=\"width:200px;\" /><br />\r\n\r\n	*State, *Zip:\r\n	<input type=\"text\" name=\"bill[state]\" value=\"{$smarty.request.bill.state|default:$userInfo.state}\" class=\"textInput\" style=\"width:30px;\" maxlength=\"2\" />\r\n	<input type=\"text\" name=\"bill[zip]\" value=\"{$smarty.request.bill.zip|default:$userInfo.zip}\" class=\"textInput\" style=\"width:50px;\" /><br />\r\n\r\n	*Country:\r\n	<input type=\"text\" name=\"bill[country]\" value=\"{$smarty.request.bill.country|default:$userInfo.country}\" class=\"textInput\" style=\"width:200px;\" maxlength=\"30\" /><br />\r\n\r\n	*Phone:<small>(xxx-xxx-xxxx)\r\n	<input type=\"text\" name=\"bill[phone]\" value=\"{$smarty.request.bill.phone|default:$userInfo.phone}\" class=\"textInput\" style=\"width:200px;\" maxlength=\"80\" /><br />\r\n\r\n	</div>\r\n</div>\r\n</td>\r\n  <td><b>Payment Information:</b></td>\r\n</tr>\r\n</table>\r\n'),(4694,275,0.13,'smarty','0','Page created.',1135920912,3,'24.2.76.126','{include file=\"shared:layouts/comp_create_navbar.tpl\"}\r\n\r\n<br />\r\n<h2>Competition Fee Payment</h2>\r\n\r\n<b>Competition title</b><br />\r\nEtc.<br />\r\netc.<br />\r\n\r\n<table width=\"100%\">\r\n<tr>\r\n  <td><b>Billing Information:</b>\r\n	<p>Enter the billing information for the credit card owner.<br />\r\n	<small>(* indicates a required field)</small></p>\r\n	\r\n	<div id=\"billInfo\">\r\n	*First Name:\r\n	<input type=\"text\" name=\"bill[firstname]\" value=\"{$smarty.request.bill.firstname|default:$userInfo.firstName}\" class=\"textInput\" style=\"width:200px;\" /><br />\r\n	*Last Name:\r\n	<input type=\"text\" name=\"bill[lastname]\" value=\"{$smarty.request.bill.lastname|default:$userInfo.lastName}\" class=\"textInput\" style=\"width:200px;\" /><br />\r\n\r\n	Company:\r\n	<input type=\"text\" name=\"bill[company]\" value=\"{$smarty.request.bill.company|default:$userInfo.company}\" class=\"textInput\" style=\"width:200px;\" /><br />\r\n\r\n	*Address:\r\n	<input type=\"text\" name=\"bill[address1]\" value=\"{$smarty.request.bill.address1|default:$userInfo.address1}\" class=\"textInput\" style=\"width:200px;\" /><br />\r\n	Line 2:\r\n	<input type=\"text\" name=\"bill[address2]\" value=\"{$smarty.request.bill.address2|default:$userInfo.address2}\" class=\"textInput\" style=\"width:200px;\" /><br />\r\n\r\n	*City:\r\n	<input type=\"text\" name=\"bill[city]\" value=\"{$smarty.request.bill.city|default:$userInfo.city}\" class=\"textInput\" style=\"width:200px;\" /><br />\r\n\r\n	*State, *Zip:\r\n	<input type=\"text\" name=\"bill[state]\" value=\"{$smarty.request.bill.state|default:$userInfo.state}\" class=\"textInput\" style=\"width:30px;\" maxlength=\"2\" />\r\n	<input type=\"text\" name=\"bill[zip]\" value=\"{$smarty.request.bill.zip|default:$userInfo.zip}\" class=\"textInput\" style=\"width:50px;\" /><br />\r\n\r\n	*Country:\r\n	<input type=\"text\" name=\"bill[country]\" value=\"{$smarty.request.bill.country|default:$userInfo.country}\" class=\"textInput\" style=\"width:200px;\" maxlength=\"30\" /><br />\r\n\r\n	*Phone:<small>(xxx-xxx-xxxx)\r\n	<input type=\"text\" name=\"bill[phone]\" value=\"{$smarty.request.bill.phone|default:$userInfo.phone}\" class=\"textInput\" style=\"width:200px;\" maxlength=\"80\" /><br />\r\n	</div>\r\n</div>\r\n</td>\r\n  <td><b>Payment Information:</b>\r\n\r\n	<script language=\"javascript\">{literal}\r\n	function verifyFormatCcnum(obj) {\r\n		if (obj.value.match(/[^\\d]/)) {\r\n			alert(\'The Credit Card Number should contain no dashes or spaces.\\n\\nI.E.  4007000000027\');\r\n			obj.value = obj.value.replace(/[^\\d]/g, \'\');\r\n			obj.focus();\r\n		}\r\n	}\r\n	function verifyFormatCcexp(obj) {\r\n		if (obj.value.match(/[^\\d]/)) {\r\n			alert(\'The format for Credit Card expiration date is MMYY with no slash.\\n\\nI.E.  0606  for June, 2006\');\r\n			obj.value = obj.value.replace(/[^\\d]/g, \'\');\r\n			obj.focus();\r\n		}\r\n	}\r\n	{/literal}</script>\r\n\r\n	Payment Method:\r\n	<select name=\"bill[paymentMethod]\" size=\"1\">\r\n		<option value=\"visa\"{if $smarty.request.bill.paymentMethod eq \"visa\"} selected{/if}>Visa</option>\r\n		<option value=\"mastercard\"{if $smarty.request.bill.paymentMethod eq \"mastercard\"} selected{/if}>Mastercard</option>\r\n		<option value=\"american express\"{if $smarty.request.bill.paymentMethod eq \"american express\"} selected{/if}>American Express</option>\r\n		<option value=\"discover\"{if $smarty.request.bill.paymentMethod eq \"discover\"} selected{/if}>Discover</option>\r\n	</select><br />\r\n\r\n	Card Number:\r\n	<input type=\"text\" name=\"bill[ccnum]\" value=\"\" class=\"textInput\" style=\"width:200px;\" onchange=\"verifyFormatCcnum(this);\" onkeyup=\"verifyFormatCcnum(this);\" /><br />\r\n\r\n	Expiration Date: <small>(MMYY)</small>\r\n	<input type=\"text\" name=\"bill[ccexp]\" value=\"\" class=\"textInput\" maxlength=\"4\" style=\"width:50px;\" onchange=\"verifyFormatCcexp(this);\" onkeyup=\"verifyFormatCcexp(this);\" /><br />\r\n</td>\r\n</tr>\r\n</table>\r\n'),(5218,196,1.73,'smarty','1','Fixing healthy for life link stuff',1169745293,2,'63.149.122.93','{if $smarty.session.company.preferences.hide_incentives eq \"yes\"}{include file=\"file:layouts/hiddenPageRedirector.tpl\"}{/if}\r\n{include file=\"layouts/forceLoggedIn.tpl\"}\r\n\r\n{* HANDLERS *}\r\n{include_php file=\"shared_handle:company/participationPoints_v2\"}\r\n{include_php file=\"shared_handle:company/surveyList\"}\r\n{include_php file=\"shared_handle:company/incentivePointAdjustments\"}\r\n\r\n\r\n{assign var=\"pgLayout\" value=\"layouts/withLeftNav.tpl\"}\r\n<h1>{if $smarty.session.company.preferences.title_my_incentives}{$smarty.session.company.preferences.title_my_incentives}</h1>{else}\r\n<h1>{$page.title}</h1>{/if}\r\n\r\n<table width=\"100%\"><tr><td valign=\"top\">\r\n	<img class=\"iconPrize\" src=\"blank.gif\" width=\"1\" height=\"1\" alt=\"\" />\r\n</td><td valign=\"top\" width=\"100%\">\r\n	{$incentiveText|default:\"<em>Yearly Incentive</em><br /><br />Not Yet Determined.\"}	\r\n</td></tr>\r\n</table>\r\n<br />\r\n{assign var=\"surveyPointsEarned\" value=$surveyPointsEarned|default:\"0\"}\r\n{assign var=\"totalIncentivePointAdjustments\" value=$totalIncentivePointAdjustments|default:\"0\"}\r\n<h2 class=\"boxed\"><i>Total Points Earned</i>: <em>{$totalParticipationPoints|math:\"x+$surveyPointsEarned+$totalIncentivePointAdjustments\"}</em></h2>\r\n\r\n<blockquote>\r\n<table width=\"700\">\r\n<tr><td valign=\"top\">\r\n	\r\n	<table>\r\n	<tr><td colspan=\"2\">\r\n		<h3>Available {if $smarty.session.company.preferences.change_word_survey}{$smarty.session.company.preferences.change_word_survey}{else} Surveys:</h3></td>{/if}\r\n	    <td valign=\"middle\"></td></tr>\r\n	{foreach from=$surveys item=item name=\"loopSurveys\"}\r\n	{assign var=\"hideCheck\" value=\"hide_survey_`$item.id`\"}\r\n	{if $smarty.session.company.preferences[$hideCheck] neq \"yes\"}\r\n		<tr><td valign=\"top\" nowrap=\"nowrap\">\r\n		{if $item.dateAvailable gt 0}\r\n			<img class=\"sIco ico{$item.icon}\" src=\"blank.gif\" width=\"1\" height=\"1\" alt=\"\" /></td>\r\n		   <td valign=\"top\"><b><u>{$item.surveyName}</u>:</b> {if $item.frequency eq \"Once\"}Taken{elseif (($item.dateAvailable - $smarty.now) < 43000)}<small>Available At:</small> {$item.dateAvailable|date_format2:\"g:i A\"}{else}<small>Available On:</small> {$item.dateAvailable|date_format2:\"m/d/y\"}{/if}<br />\r\n			{$item.feedbackTitle|default:\"No feedback available.\"}<br />\r\n			<a href=\"?pg=my_feedback&surveyId={$item.id}&amp;feedbackId={$item.feedbackId}\">Click here to learn more<b><i>!</i></b></a><br />\r\n			<br /></td>\r\n		   <td valign=\"middle\" align=\"right\"><em>{$item.pointsEarned}</em></td></tr>\r\n		{else}\r\n			<a href=\"javascript://\" onclick=\"openSurvey({$item.id});\"><img class=\"sIco ico{$item.icon}\" src=\"blank.gif\" width=\"1\" height=\"1\" alt=\"\" /></a></td>\r\n		   <td valign=\"top\" nowrap=\"nowrap\"><b><u>{$item.surveyName}</u>:</b> <a href=\"javascript://\" onclick=\"openSurvey({$item.id});\">Available Now</a><br />\r\n			{$item.feedbackTitle|default:\"No feedback available.\"}<br />\r\n			<a href=\"?pg=my_feedback&surveyId={$item.id}&amp;feedbackId={$item.feedbackId}\">Click here to learn more<b><i>!</i></b></a><br />\r\n			<br /></td>\r\n		   <td valign=\"middle\" align=\"right\"><em>{$item.pointsEarned}</em></td></tr>\r\n		{/if}\r\n	{/if}\r\n	{foreachelse}\r\n	<tr><td valign=\"top\" colspan=\"3\">>\r\n		None found.</td></tr>\r\n	{/foreach}\r\n\r\n	<tr><td>&nbsp;</td>\r\n	    <td align=\"right\"><em>{if $smarty.session.company.preferences.change_word_survey}{$smarty.session.company.preferences.change_word_survey} points earned{else}Survey points earned:{/if}</em></td>\r\n	    <td align=\"center\"><span class=\"boxed\">{$surveyPointsEarned|default:0}</span></td></tr>\r\n\r\n	{if $smarty.session.company.preferences.healthyForLifeLink}\r\n	<tr><td colspan=\"2\">\r\n		<ul><li><a href=\"?pg=healthyForLife\" style=\"color:#003366;\"><b>{$smarty.session.company.preferences.healthyForLifeLink}</b></a></li></ul></td>\r\n	    <td valign=\"middle\"></td></tr>\r\n	{/if}\r\n\r\n	{if $smarty.session.company.preferences.hide_survey_hra neq \"yes\"}\r\n		{select_query return=\"row\" assign=\"aHRA\"}\r\n			dateTaken, pointsEarned FROM surveys_taken\r\n			WHERE userId = {$user->id}\r\n			AND surveyId = 8\r\n			ORDER BY dateTaken DESC\r\n			LIMIT 1\r\n		{/select_query}\r\n		<tr><td><img class=\"icoStethescope\" src=\"blank.gif\" width=\"1\" height=\"1\" alt=\"\" /></td>\r\n		    <td><b><u>HRA Score</u>:</b>\r\n		    {if ($aHRA.dateTaken eq \"\") OR ($aHRA.dateTaken < $smarty.now|math:\"x - 31536000\")}<br /><a href=\"javascript://\" onclick=\"openSurvey(8);\">Available Now</a>{/if}</td>\r\n		    <td align=\"center\"><em>{$aHRA.pointsEarned}</em></td></tr>\r\n	{/if}\r\n\r\n	{if $vanity eq \"onai\" or $vanity eq \"mycompany\" or $vanity eq \"zions\" or $vanity eq \"zions2\"}\r\n	<tr><td><img class=\"icoWeights\" src=\"blank.gif\" width=\"1\" height=\"1\" alt=\"\" /></td>\r\n		    <td><b><u>Consumer Tools</u>:</b><br /><em>NEW<i>!</i></em></td>\r\n		    <td align=\"center\"><a href=\"?pg=consumer_tools\">Click Here</a></td></tr>\r\n	{/if}\r\n\r\n	{if 0 neq $totalIncentivePointAdjustments}\r\n	<br style=\"clear:left;\" />\r\n	<tr><td colspan=\"3\"><h3>Adjustments/Redemptions:</h3></td></tr>\r\n        {foreach from=$incentivePointAdjustments item=\"adjustment\" name=\"loopAdjustments\"}<tr><td nowrap>\r\n	<tr><td colspan=\"2\"><small><i>{$adjustment.dateAssigned|date_format2:\"m/d/Y\"}</i> - {$adjustment.comment}</small></td>\r\n	    <td valign=\"middle\" align=\"right\"><em>{$adjustment.points}</em></td></tr>\r\n        {foreachelse}\r\n		<tr><td colspan=\"3\">None.</td></tr>\r\n        {/foreach}\r\n	<tr><td colspan=\"2\" align=\"right\"><em>Total Adjustments:</em></td>\r\n		<td align=\"center\" nowrap=\"nowrap\"><span class=\"boxed\"><nobr>{$totalIncentivePointAdjustments|default:0}</nobr></span></td></tr>\r\n	{/if}\r\n\r\n	</table>\r\n\r\n</td><td valign=\"top\">\r\n	<h3>Feedback:</h3>\r\n	<table>\r\n	<tr><td>\r\n	<img class=\"icoNurse\" src=\"blank.gif\" width=\"1\" height=\"1\" alt=\"\" />\r\n	</td><td>\r\n	<ul>\r\n		<li><a href=\"javascript:viewSurveys();\">Review My History</a></li>\r\n		{if $smarty.session.company.preferences.hide_survey_hra neq \"yes\"}\r\n		<li><a href=\"?pg=HRAScoreInfo\">HRA Score Info</a></li>\r\n		{/if}\r\n	<ul>\r\n	</td></tr>\r\n	</table>\r\n	<br />\r\n\r\n	{if $aScales|@count gt 0} {* PARTICIPATION POINTS -- IF APPLICABLE *}\r\n	<table align=\"right\">\r\n	<tr><td colspan=\"3\"><h3>Participation Points:</h3></td></tr>\r\n        {foreach from=$aScales item=\"scale\" name=\"loopScales\"}<tr><td nowrap>\r\n	<tr><td>{$scale.name|niceText}</td>\r\n	    <td><small>({$scale.dateStart|date_format2:\"m/d/y\"} - {$scale.dateEnd|date_format2:\"m/d/y\"})</small></td>\r\n	    <td valign=\"middle\" align=\"right\"><em>{$aScores[$scale.id]|number_format:\"1\"}</em></td></tr>\r\n        {foreachelse}\r\n		<tr><td colspan=\"3\">None.</td></tr>\r\n        {/foreach}\r\n	<tr><td colspan=\"2\" align=\"right\"><em>Participation points earned:</em></td>\r\n		<td align=\"right\"><span class=\"boxed\">{$totalParticipationPoints|default:0}</span></td></tr>\r\n	</table>\r\n	{/if}\r\n\r\n	</td></tr>\r\n</table>\r\n</blockquote>'),(4258,210,0.26,'smarty','0','Page created.',1126684229,3,'24.10.217.227','{assign var=\"pgLayout\" value=\"layouts/withLeftNav.tpl\"}\r\n<h1>{$page.title}</h1>\r\n<br />\r\n<h2 class=\"withBG\">{$smarty.session.company.companyName}</h2>\r\n\r\n{include_php file=\"shared_handle:availableCompetitions\"}\r\n\r\n<form name=\"joinCompetitions\" method=\"post\" action=\"index.php\" style=\"margin:0px;\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n<input type=\"hidden\" name=\"no_expire\" value=\"true\" />\r\n\r\n{* style_table folder=\"img/st/floatbox\" *}\r\n  <table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" width=\"100%\">\r\n	<tr>\r\n		<td bgcolor=\"#EEEEEE\">&nbsp;</td>\r\n		<td bgcolor=\"#EEEEEE\"><b>ID #</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>Title</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>Start Date</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>End Date</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>Style</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>Scoring Method</b></td>\r\n	</tr>\r\n	{foreach from=$availableCompetitions item=\"comp\"}\r\n	<tr>\r\n		{if not $user->inGroupName($comp.code)}\r\n		{assign var=\"isJoinable\" value=\"true\"}\r\n		<td><input type=\"checkbox\" name=\"joinComp[]\" value=\"{$comp.id}\" /></td>\r\n		<td>{$comp.id}</td>\r\n		<td>{$comp.title}</td>\r\n		<td>{$comp.startDate|date_format2:\"D n/j/y\"}</td>\r\n		<td>{$comp.endDate|date_format2:\"D n/j/y\"}</td>\r\n		<td>{$comp.style}</td>\r\n		<td>{$comp.scoringMethod}</td>\r\n		{else}\r\n		{assign var=\"isInComps\" value=\"true\"}\r\n		<td bgcolor=\"#FFCCCC\">&times;</td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.id}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.title}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.startDate|date_format2:\"D n/j/y\"}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.endDate|date_format2:\"D n/j/y\"}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.style}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.scoringMethod}</i></td>\r\n		{/if}\r\n	</tr>\r\n	{foreachelse}\r\n	<tr>\r\n		<td colspan=\"7\" align=\"center\">There are currently no active competitions available.</td>\r\n	</tr>	\r\n	{/foreach}\r\n  </table>\r\n{* /style_table *}\r\n\r\n{if !$isJoinable}{* log_error message=\'There are no competitions to join\' db_log=0 is_critical=0 *}{log_messages}{redirect href=\"?pg=my_login\"}{/if}\r\n\r\n<br />\r\n<div align=\"center\">{if $isJoinable}<input type=\"submit\" name=\"submitBtn\" value=\"Join Selected Competitions\" /> <input type=\"submit\" name=\"submitBtn\" value=\"Join Later\" />{else}<b>No Competitions To Join</b> <input type=\"submit\" name=\"submitBtn\" value=\"Go to My Home\" />{/if}</div>\r\n{if $isInComps}\r\n<br />\r\n<div style=\"background-color:#FCC; margin-left:20px; width:250px;\">&times; - You are already a member</div>\r\n{/if}\r\n\r\n</form>\r\n\r\n{if $company.vanity eq \"myfamily\"}\r\n<div>\r\nClick <a href=\"?pg=5to9Rules\">here</a> for the 5 to 9 a-day instructions and rules\r\n</div>\r\n{/if}'),(4259,210,0.27,'smarty','0','Page created.',1126724980,3,'24.10.217.227','{assign var=\"pgLayout\" value=\"layouts/withLeftNav.tpl\"}\r\n<h1>{$page.title}</h1>\r\n<br />\r\n<h2 class=\"withBG\">{$smarty.session.company.companyName}</h2>\r\n\r\n{include_php file=\"shared_handle:availableCompetitions\"}\r\n\r\n<form name=\"joinCompetitions\" method=\"post\" action=\"index.php\" style=\"margin:0px;\">\r\n<input type=\"hidden\" name=\"pg\" value=\"{$page.name}\" />\r\n<input type=\"hidden\" name=\"no_expire\" value=\"true\" />\r\n\r\n{* style_table folder=\"img/st/floatbox\" *}\r\n  <table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" width=\"100%\">\r\n	<tr>\r\n		<td bgcolor=\"#EEEEEE\">&nbsp;</td>\r\n		<td bgcolor=\"#EEEEEE\"><b>ID #</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>Title</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>Start Date</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>End Date</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>Style</b></td>\r\n		<td bgcolor=\"#EEEEEE\"><b>Scoring Method</b></td>\r\n	</tr>\r\n	{foreach from=$availableCompetitions item=\"comp\"}\r\n	<tr>\r\n		{if not $user->inGroupName($comp.code)}\r\n		{assign var=\"isJoinable\" value=\"true\"}\r\n		<td><input type=\"checkbox\" name=\"joinComp[]\" value=\"{$comp.id}\" /></td>\r\n		<td>{$comp.id}</td>\r\n		<td>{$comp.title}</td>\r\n		<td>{$comp.startDate|date_format2:\"D n/j/y\"}</td>\r\n		<td>{$comp.endDate|date_format2:\"D n/j/y\"}</td>\r\n		<td>{$comp.style}</td>\r\n		<td>{$comp.scoringMethod}</td>\r\n		{else}\r\n		{assign var=\"isInComps\" value=\"true\"}\r\n		<td bgcolor=\"#FFCCCC\">&times;</td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.id}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.title}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.startDate|date_format2:\"D n/j/y\"}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.endDate|date_format2:\"D n/j/y\"}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.style}</i></td>\r\n		<td bgcolor=\"#FFCCCC\"><i>{$comp.scoringMethod}</i></td>\r\n		{/if}\r\n	</tr>\r\n	{foreachelse}\r\n	<tr>\r\n		<td colspan=\"7\" align=\"center\">There are currently no active competitions available.</td>\r\n	</tr>	\r\n	{/foreach}\r\n  </table>\r\n{* /style_table *}\r\n\r\n{if !$isJoinable}{* log_error message=\'There are no competitions to join\' db_log=0 is_critical=0 *}{store_messages}{redirect href=\"?pg=my_login\"}{/if}\r\n\r\n<br />\r\n<div align=\"center\">{if $isJoinable}<input type=\"submit\" name=\"submitBtn\" value=\"Join Selected Competitions\" /> <input type=\"submit\" name=\"submitBtn\" value=\"Join Later\" />{else}<b>No Competitions To Join</b> <input type=\"submit\" name=\"submitBtn\" value=\"Go to My Home\" />{/if}</div>\r\n{if $isInComps}\r\n<br />\r\n<div style=\"background-color:#FCC; margin-left:20px; width:250px;\">&times; - You are already a member</div>\r\n{/if}\r\n\r\n</form>\r\n\r\n{if $company.vanity eq \"myfamily\"}\r\n<div>\r\nClick <a href=\"?pg=5to9Rules\">here</a> for the 5 to 9 a-day instructions and rules\r\n</div>\r\n{/if}'),(4260,138,0.43,'smarty','0','starting flashgraph v2 update',1126826191,3,'216.194.127.150','{assign var=\"pgLayout\" value=\"none\"}<html>\r\n<head>\r\n	<link rel=\"stylesheet\" href=\"{$skinFolder}/styles/base.css\" />\r\n	{if $styleName neq \"\"}<link rel=\"stylesheet\" type=\"text/css\" href=\"{$skinFolder}styles/{$styleName}.css\" />{/if}\r\n</head>\r\n<body style=\"margin:0px;background-image:none;\">\r\n\r\n{if $smarty.request.compId}\r\n	{assign var=\"compId\" value=\"comp\"|cat:$smarty.request.compId}\r\n{/if}\r\n{assign var=\"type\" value=$smarty.request.type}\r\n{assign var=\"fillPrevious\" value=$smarty.request.fillPrevious|default:\"1\"}\r\n{assign var=\"precision\" value=$smarty.request.precision|default:\"0\"}\r\n{assign var=\"stars\" value=$smarty.request.stars|default:\"\"}\r\n{assign var=\"totalChange\" value=$smarty.request.totalChange|default:\"0\"}\r\n{assign var=\"userIds\" value=$smarty.request.userIds|default:\"\"}\r\n{if $smarty.request.gParams}{include_php file=\"shared_handle:assignGraphParams\"}{/if}\r\n{if $smarty.request.format eq \"small\"}\r\n	{assign var=\"url\" value=$skinFolder|cat:\"/flash/grapher_sm.swf?id=\":$compId:\"!\":$type:\"!\":$fillPrevious:\"!\":$precision:\"!\":$stars:\"!\":$totalChange:\"!\":$userIds:\"&session_id=\":$smarty.session.session_id}\r\n{elseif $smarty.request.format eq \"wide\"}\r\n	{assign var=\"url\" value=$skinFolder|cat:\"/flash/grapher_wide.swf?id=\":$compId:\"!\":$type:\"!\":$fillPrevious:\"!\":$precision:\"!\":$stars:\"!\":$totalChange:\"!\":$userIds:\"&session_id=\":$smarty.session.session_id}\r\n{else}\r\n	{assign var=\"url\" value=$skinFolder|cat:\"/flash/grapher.swf?id=\":$compId:\"!\":$type:\"!\":$fillPrevious:\"!\":$precision:\"!\":$stars:\"!\":$totalChange:\"!\":$userIds:\"&session_id=\":$smarty.session.session_id}\r\n{/if}\r\n\r\n{* assign var=\"url\" value=$skinFolder|cat:\"/flash/grapher{if $smarty.request.format eq \"small\"}_sm{elseif $smarty.request.format eq \"wide\"}_wide{/if}.swf?id=comp1!weight!1!0!!1&session_id=\":$smarty.session.session_id\" *}\r\n\r\n<h3 class=\"underline\">&nbsp; {if $userIds}Showing{else}Comparing{/if} {if $totalChange}Change in {/if}{$type|niceText} Over Time</h3>\r\n{if $user->username eq \"trave\" AND $type}\r\n	{if $smarty.request.format eq \"small\"}\r\n		{swf src=$url width=\"425\" height=\"195\" bgcolor=\"#FFFFFF\" wmode=\"transparent\"}\r\n	{elseif $smarty.request.format eq \"wide\"}\r\n		{swf src=$url width=\"595\" height=\"195\" bgcolor=\"#FFFFFF\" wmode=\"transparent\"}\r\n	{else}\r\n		{swf src=$url width=\"555\" height=\"195\" bgcolor=\"#FFFFFF\" wmode=\"transparent\"}\r\n	{/if}\r\n{elseif $user->username eq \"trave\"}\r\n	{if $smarty.request.format eq \"small\"}\r\n		<img src=\"{$systemFolder}images/choose_graph_small.gif\" width=\"421\" height=\"187\" />\r\n	{else}\r\n		<img src=\"{$systemFolder}images/choose_graph_wide.gif\" width=\"588\" height=\"180\" />\r\n	{/if}\r\n{else}\r\n<ul>\r\n	<li>The eHealthCompete graphing engine is temporarily unavailable due to upgrades.</li>\r\n</ul>\r\n{/if}\r\n\r\n{if false AND $acm->isDomainAdmin()}\r\n	{$smarty.request.gParams}\r\n	{assign var=\"debugUrl\" value=$url|regex_replace:\"/.*\\?/\":\"?pg=flashgraph&\"}\r\n	Debug this graph: <a href=\"{$debugUrl}\" target=\"_blank\">Source</a> | <a href=\"{$debugUrl}&debug=1\" target=\"_blank\">Debugger</a>\r\n{/if}\r\n\r\n</body></html>'),(4261,128,0.13,'php','1','Page created.',1126827968,3,'216.194.127.150','<?php\r\n\r\n$SPADE[\'template\']->_tpl_vars[\'pgLayout\'] = \'NONE\';\r\n\r\ninclude \"systems/v2_shared/handlers/handle.graphStats.php\";\r\n\r\n?>'),(4262,195,0.53,'smarty','0','Imported from V2 conversion',1126831657,3,'24.2.76.126','{include file=\"layouts/forceLoggedIn.tpl\"}\r\n{include_php file=\"shared_handle:myHome\"}\r\n{include_php file=\"shared_handle:getProfile\"}\r\n{assign var=\"pgLayout\" value=\"layouts/withLeftNav.tpl\"}\r\n<h1>{$page.title} - {$userProfile.firstName} {$userProfile.lastName} ({$userProfile.username})</h1>\r\n\r\n{select_query return=\"row\" assign=\"aHRA\"}\r\n	dateTaken, pointsEarned FROM surveys_taken\r\n		WHERE userId = {$user->id}\r\n		AND surveyId = 8\r\n		ORDER BY dateTaken DESC\r\n		LIMIT 1\r\n{/select_query}\r\n\r\n<table width=\"700\">\r\n<tr>\r\n	<td>\r\n	<div id=\"statsContainer\" style=\"overflow:hidden;\">\r\n		<a name=\"updateStats\"></a>\r\n		<iframe name=\"profileUpdateFrame\" id=\"profileUpdateIFrame\" src=\"?pg=my_statistics/update&userId={$smarty.request.userId|default:$userProfile.id}\" frameborder=\"0\" width=\"700\" height=\"440\" scrolling=\"no\"></iframe>\r\n	</div>\r\n	</td>\r\n</tr>\r\n</table>\r\n\r\n<table width=\"700\">\r\n<tr><td>\r\n<h2 class=\"withBG\">\r\n	<div class=\"topRight hideShow\">\r\n		<a href=\"javascript:toggle(\'profileGraphTable\', \'\', \'showHide\');\"><img id=\"profileGraphTable_img\" src=\"blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a>\r\n	</div>User Profile &amp; Graphs</h2>\r\n</td></tr></table>\r\n\r\n<table id=\"profileGraphTable\" width=\"700\">\r\n<tr><td width=\"205\" valign=\"top\">\r\n	<div id=\"UserProfileColumn\" class=\"contentColumn\">\r\n	<h2 class=\"withBG\">Your Profile</h2>\r\n		<span class=\"cellHeadLarge\">Age:</span><span class=\"cellSmall\">{$userProfile.age|default:\"-\"}</span><br />\r\n		<span class=\"cellHeadLarge\">Height:</span><span class=\"cellSmall\">{$userProfile.heightFeet|default:\"-\"}\'{$userProfile.heightInches|default:\"-\"}&quot;</span><br />\r\n		<span class=\"cellHeadLarge\">Start BMI:</span><span class=\"cellSmall\">{$userProfile.startBMI|default:\"-\"}</span><br />\r\n		<span class=\"cellHeadLarge\">Start Weight:</span><span class=\"cellSmall\">{$userProfile.initialWeight|default:\"-\"}</span><br /><span class=\"cellHeadLarge\">Goal Weight:</span><span class=\"cellSmall\">{$userProfile.goalWeight|default:\"-\"}</span><br />\r\n		<span class=\"cellHeadLarge\">Current Weight:</span><span class=\"cellSmall\">{$userProfile.currentWeight|default:\"-\"}</span><br />\r\n		<span class=\"cellHeadLarge\">HRA Score:</span><span class=\"cellSmall\">{$aHRA.pointsEarned|default:\"-\"}</span><br />\r\n\r\n		<a href=\"?pg=my_profile\" class=\"link\"><img src=\"{$skinFolder}images/btn_profile.gif\" border=\"0\" alt=\"Update Profile\" vspace=\"10\" /></a><br />\r\n		<a href=\"?pg=my_settings\" class=\"link\"><img src=\"{$skinFolder}images/btn_settings.gif\" border=\"0\" alt=\"Account Settings\" vspace=\"0\" /></a>\r\n	</div>\r\n</td><td valign=\"top\" align=\"center\">	\r\n	<div id=\"graphContainer\">\r\n	<iframe name=\"graphwindow\" src=\"?pg=flashgraph-frame&compId={$compData.id}&format=small{* &type=weight&fillPrevious=1&precision=1&totalChange=0&userIds={$userProfile.id} *}\" frameborder=\"0\" width=\"425\" height=\"230\" scrollbars=\"no\"></iframe></div>\r\n	{if $user->username eq \"trave\"}{include_php file=\"shared_handle:estats/getEstatsInfo\"}{/if}\r\n	<small>\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=weight&fillPrevious=1&precision=1&totalChange=1\" target=\"graphwindow\">Change in Weight</a> |\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=weight&fillPrevious=1&precision=1\" target=\"graphwindow\">Weight</a> |\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=fat&fillPrevious=0&precision=1\" target=\"graphwindow\">Fat Intake</a> |\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=calories&fillPrevious=0&precision=1\" target=\"graphwindow\">Calorie Intake</a> |\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=carbs&fillPrevious=0&precision=1\" target=\"graphwindow\">Carb Intake</a><br />\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=water&fillPrevious=0&precision=1\" target=\"graphwindow\">Water Intake</a> |\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=minutesExercise&fillPrevious=0&precision=1\" target=\"graphwindow\">Exercise Min</a> |\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=distanceExercised&fillPrevious=0&precision=1\" target=\"graphwindow\">Distance Exercised</a>\r\n	</small>\r\n</td></tr>\r\n</table>\r\n<br />\r\n<table width=\"700\">\r\n<tr><td colspan=\"2\">\r\n<h2 class=\"withBG\">\r\n	<div class=\"topRight hideShow\">\r\n		<a href=\"javascript:toggle(\'goalsMottosBlock\', \'\', \'showHide\');\"><img id=\"goalsMottosBlock_img\" src=\"blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a>\r\n	</div>\r\n	Goals &amp; Mottos</h2>\r\n<blockquote id=\"goalsMottosBlock\" style=\"display:block;\">\r\n<dl>\r\n	<dt>Motto:</dt>\r\n	<dd>{$userProfile.personalSaying|default:\"- Not Set - Click on the <i><b>Update my Profile</b></i> button toward the top of this page to set your goal\"}</dd>\r\n	<dt>Nutrition Goal:</dt>\r\n	<dd>{$userProfile.nutritionGoal|default:\"- Not Set - Click on the <i><b>Update my Profile</b></i> button toward the top of this page to set your goal\"}</dd>\r\n	<dt>Fitness Goal:</dt>\r\n	<dd>{$userProfile.fitnessGoal|default:\"- Not Set - Click on the <i><b>Update my Profile</b></i> button toward the top of this page to set your goal\"}</dd>\r\n	<dt>Lifestyle Goal:</dt>\r\n	<dd>{$userProfile.lifestyleGoal|default:\"- Not Set - Click on the <i><b>Update my Profile</b></i> button toward the top of this page to set your goal\"}</dd>\r\n</dl>\r\n</blockquote>\r\n</td></tr>\r\n</table>'),(4266,138,0.45,'smarty','0','starting flashgraph v2 update',1126834827,3,'24.2.76.126','{if $user->username eq \"trave\"}{display var=$smarty.get}{/if}\r\n\r\n{assign var=\"pgLayout\" value=\"none\"}<html>\r\n<head>\r\n	<link rel=\"stylesheet\" href=\"{$skinFolder}/styles/base.css\" />\r\n	{if $styleName neq \"\"}<link rel=\"stylesheet\" type=\"text/css\" href=\"{$skinFolder}styles/{$styleName}.css\" />{/if}\r\n</head>\r\n<body style=\"margin:0px;background-image:none;\">\r\n\r\n{if $smarty.request.compId}\r\n	{assign var=\"compId\" value=\"comp\"|cat:$smarty.request.compId}\r\n{/if}\r\n{assign var=\"type\" value=$smarty.request.type}\r\n{assign var=\"fillPrevious\" value=$smarty.request.fillPrevious|default:\"1\"}\r\n{assign var=\"precision\" value=$smarty.request.precision|default:\"0\"}\r\n{assign var=\"stars\" value=$smarty.request.stars|default:\"\"}\r\n{assign var=\"totalChange\" value=$smarty.request.totalChange|default:\"0\"}\r\n{assign var=\"userIds\" value=$smarty.request.userIds|default:\"\"}\r\n{if $smarty.request.gParams}{include_php file=\"shared_handle:assignGraphParams\"}{/if}\r\n{if $smarty.request.format eq \"small\"}\r\n	{assign var=\"url\" value=$skinFolder|cat:\"/flash/grapher_sm.swf?id=\":$compId:\"!\":$type:\"!\":$fillPrevious:\"!\":$precision:\"!\":$stars:\"!\":$totalChange:\"!\":$userIds:\"&session_id=\":$smarty.session.session_id}\r\n{elseif $smarty.request.format eq \"wide\"}\r\n	{assign var=\"url\" value=$skinFolder|cat:\"/flash/grapher_wide.swf?id=\":$compId:\"!\":$type:\"!\":$fillPrevious:\"!\":$precision:\"!\":$stars:\"!\":$totalChange:\"!\":$userIds:\"&session_id=\":$smarty.session.session_id}\r\n{else}\r\n	{assign var=\"url\" value=$skinFolder|cat:\"/flash/grapher.swf?id=\":$compId:\"!\":$type:\"!\":$fillPrevious:\"!\":$precision:\"!\":$stars:\"!\":$totalChange:\"!\":$userIds:\"&session_id=\":$smarty.session.session_id}\r\n{/if}\r\n\r\n{* assign var=\"url\" value=$skinFolder|cat:\"/flash/grapher{if $smarty.request.format eq \"small\"}_sm{elseif $smarty.request.format eq \"wide\"}_wide{/if}.swf?id=comp1!weight!1!0!!1&session_id=\":$smarty.session.session_id\" *}\r\n\r\n<h3 class=\"underline\">&nbsp; {if $userIds}Showing{else}Comparing{/if} {if $totalChange}Change in {/if}{$type|niceText} Over Time</h3>\r\n{if $user->username eq \"trave\" AND ($type OR $smarty.get.esId)}\r\n	{if $smarty.request.format eq \"small\"}\r\n		{swf src=$url width=\"425\" height=\"195\" bgcolor=\"#FFFFFF\" wmode=\"transparent\"}\r\n	{elseif $smarty.request.format eq \"wide\"}\r\n		{swf src=$url width=\"595\" height=\"195\" bgcolor=\"#FFFFFF\" wmode=\"transparent\"}\r\n	{else}\r\n		{swf src=$url width=\"555\" height=\"195\" bgcolor=\"#FFFFFF\" wmode=\"transparent\"}\r\n	{/if}\r\n{elseif $user->username eq \"trave\"}\r\n	{if $smarty.request.format eq \"small\"}\r\n		<img src=\"{$systemFolder}images/choose_graph_small.gif\" width=\"421\" height=\"187\" />\r\n	{else}\r\n		<img src=\"{$systemFolder}images/choose_graph_wide.gif\" width=\"588\" height=\"180\" />\r\n	{/if}\r\n{else}\r\n<ul>\r\n	<li>The eHealthCompete graphing engine is temporarily unavailable due to upgrades.</li>\r\n</ul>\r\n{/if}\r\n\r\n{if false AND $acm->isDomainAdmin()}\r\n	{$smarty.request.gParams}\r\n	{assign var=\"debugUrl\" value=$url|regex_replace:\"/.*\\?/\":\"?pg=flashgraph&\"}\r\n	Debug this graph: <a href=\"{$debugUrl}\" target=\"_blank\">Source</a> | <a href=\"{$debugUrl}&debug=1\" target=\"_blank\">Debugger</a>\r\n{/if}\r\n\r\n</body></html>'),(4267,195,0.56,'smarty','0','Imported from V2 conversion',1126834927,3,'24.2.76.126','{include file=\"layouts/forceLoggedIn.tpl\"}\r\n{include_php file=\"shared_handle:myHome\"}\r\n{include_php file=\"shared_handle:getProfile\"}\r\n{assign var=\"pgLayout\" value=\"layouts/withLeftNav.tpl\"}\r\n<h1>{$page.title} - {$userProfile.firstName} {$userProfile.lastName} ({$userProfile.username})</h1>\r\n\r\n{select_query return=\"row\" assign=\"aHRA\"}\r\n	dateTaken, pointsEarned FROM surveys_taken\r\n		WHERE userId = {$user->id}\r\n		AND surveyId = 8\r\n		ORDER BY dateTaken DESC\r\n		LIMIT 1\r\n{/select_query}\r\n\r\n<table width=\"700\">\r\n<tr>\r\n	<td>\r\n	<div id=\"statsContainer\" style=\"overflow:hidden;\">\r\n		<a name=\"updateStats\"></a>\r\n		<iframe name=\"profileUpdateFrame\" id=\"profileUpdateIFrame\" src=\"?pg=my_statistics/update&userId={$smarty.request.userId|default:$userProfile.id}\" frameborder=\"0\" width=\"700\" height=\"440\" scrolling=\"no\"></iframe>\r\n	</div>\r\n	</td>\r\n</tr>\r\n</table>\r\n\r\n<table width=\"700\">\r\n<tr><td>\r\n<h2 class=\"withBG\">\r\n	<div class=\"topRight hideShow\">\r\n		<a href=\"javascript:toggle(\'profileGraphTable\', \'\', \'showHide\');\"><img id=\"profileGraphTable_img\" src=\"blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a>\r\n	</div>User Profile &amp; Graphs</h2>\r\n</td></tr></table>\r\n\r\n<table id=\"profileGraphTable\" width=\"700\">\r\n<tr><td width=\"205\" valign=\"top\">\r\n	<div id=\"UserProfileColumn\" class=\"contentColumn\">\r\n	<h2 class=\"withBG\">Your Profile</h2>\r\n		<span class=\"cellHeadLarge\">Age:</span><span class=\"cellSmall\">{$userProfile.age|default:\"-\"}</span><br />\r\n		<span class=\"cellHeadLarge\">Height:</span><span class=\"cellSmall\">{$userProfile.heightFeet|default:\"-\"}\'{$userProfile.heightInches|default:\"-\"}&quot;</span><br />\r\n		<span class=\"cellHeadLarge\">Start BMI:</span><span class=\"cellSmall\">{$userProfile.startBMI|default:\"-\"}</span><br />\r\n		<span class=\"cellHeadLarge\">Start Weight:</span><span class=\"cellSmall\">{$userProfile.initialWeight|default:\"-\"}</span><br /><span class=\"cellHeadLarge\">Goal Weight:</span><span class=\"cellSmall\">{$userProfile.goalWeight|default:\"-\"}</span><br />\r\n		<span class=\"cellHeadLarge\">Current Weight:</span><span class=\"cellSmall\">{$userProfile.currentWeight|default:\"-\"}</span><br />\r\n		<span class=\"cellHeadLarge\">HRA Score:</span><span class=\"cellSmall\">{$aHRA.pointsEarned|default:\"-\"}</span><br />\r\n\r\n		<a href=\"?pg=my_profile\" class=\"link\"><img src=\"{$skinFolder}images/btn_profile.gif\" border=\"0\" alt=\"Update Profile\" vspace=\"10\" /></a><br />\r\n		<a href=\"?pg=my_settings\" class=\"link\"><img src=\"{$skinFolder}images/btn_settings.gif\" border=\"0\" alt=\"Account Settings\" vspace=\"0\" /></a>\r\n	</div>\r\n</td><td valign=\"top\" align=\"center\">	\r\n	<div id=\"graphContainer\">\r\n	<iframe name=\"graphwindow\" src=\"?pg=flashgraph-frame&compId={$compData.id}&format=small{* &type=weight&fillPrevious=1&precision=1&totalChange=0&userIds={$userProfile.id} *}\" frameborder=\"0\" width=\"425\" height=\"230\" scrollbars=\"no\"></iframe></div>\r\n	{if $user->username eq \"trave\"}{include_php file=\"shared_handle:estats/getEstatsInfo\"}\r\n	<small>\r\n		{foreach from=$aEstats item=\"es\" name=\"loopEstats\"}\r\n			<a href=\"?pg=flashgraph-frame&format=small&userIds={$userProfile.id}&esId={$es.id}\" target=\"graphwindow\">{$es.name|niceText|replace:\" \":\"&nbsp;\"}</a> {if !$smarty.foreach.loopEstats.last}|{/if}\r\n		{foreachelse}\r\n			<b>No Available eStat Graphs</b>\r\n		{/foreach}\r\n	</small>\r\n	{else}\r\n	<small>\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=weight&fillPrevious=1&precision=1&totalChange=1\" target=\"graphwindow\">Change in Weight</a> |\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=weight&fillPrevious=1&precision=1\" target=\"graphwindow\">Weight</a> |\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=fat&fillPrevious=0&precision=1\" target=\"graphwindow\">Fat Intake</a> |\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=calories&fillPrevious=0&precision=1\" target=\"graphwindow\">Calorie Intake</a> |\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=carbs&fillPrevious=0&precision=1\" target=\"graphwindow\">Carb Intake</a><br />\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=water&fillPrevious=0&precision=1\" target=\"graphwindow\">Water Intake</a> |\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=minutesExercise&fillPrevious=0&precision=1\" target=\"graphwindow\">Exercise Min</a> |\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=distanceExercised&fillPrevious=0&precision=1\" target=\"graphwindow\">Distance Exercised</a>\r\n	</small>\r\n	{/if}\r\n</td></tr>\r\n</table>\r\n<br />\r\n<table width=\"700\">\r\n<tr><td colspan=\"2\">\r\n<h2 class=\"withBG\">\r\n	<div class=\"topRight hideShow\">\r\n		<a href=\"javascript:toggle(\'goalsMottosBlock\', \'\', \'showHide\');\"><img id=\"goalsMottosBlock_img\" src=\"blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a>\r\n	</div>\r\n	Goals &amp; Mottos</h2>\r\n<blockquote id=\"goalsMottosBlock\" style=\"display:block;\">\r\n<dl>\r\n	<dt>Motto:</dt>\r\n	<dd>{$userProfile.personalSaying|default:\"- Not Set - Click on the <i><b>Update my Profile</b></i> button toward the top of this page to set your goal\"}</dd>\r\n	<dt>Nutrition Goal:</dt>\r\n	<dd>{$userProfile.nutritionGoal|default:\"- Not Set - Click on the <i><b>Update my Profile</b></i> button toward the top of this page to set your goal\"}</dd>\r\n	<dt>Fitness Goal:</dt>\r\n	<dd>{$userProfile.fitnessGoal|default:\"- Not Set - Click on the <i><b>Update my Profile</b></i> button toward the top of this page to set your goal\"}</dd>\r\n	<dt>Lifestyle Goal:</dt>\r\n	<dd>{$userProfile.lifestyleGoal|default:\"- Not Set - Click on the <i><b>Update my Profile</b></i> button toward the top of this page to set your goal\"}</dd>\r\n</dl>\r\n</blockquote>\r\n</td></tr>\r\n</table>'),(4269,138,0.47,'smarty','0','starting flashgraph v2 update',1126836951,3,'24.2.76.126','{* if $user->username eq \"trave\"}{display var=$smarty.get}{/if *}\r\n{assign var=\"pgLayout\" value=\"none\"}<html>\r\n<head>\r\n	<link rel=\"stylesheet\" href=\"{$skinFolder}/styles/base.css\" />\r\n	{if $styleName neq \"\"}<link rel=\"stylesheet\" type=\"text/css\" href=\"{$skinFolder}styles/{$styleName}.css\" />{/if}\r\n</head>\r\n<body style=\"margin:0px;background-image:none;\">\r\n\r\n{if $smarty.request.compId}\r\n	{assign var=\"compId\" value=\"comp\"|cat:$smarty.request.compId}\r\n{/if}\r\n{assign var=\"type\" value=$smarty.request.type}\r\n{assign var=\"fillPrevious\" value=$smarty.request.fillPrevious|default:\"1\"}\r\n{assign var=\"precision\" value=$smarty.request.precision|default:\"0\"}\r\n{assign var=\"stars\" value=$smarty.request.stars|default:\"\"}\r\n{assign var=\"totalChange\" value=$smarty.request.totalChange|default:\"0\"}\r\n{assign var=\"userIds\" value=$smarty.request.userIds|default:\"\"}\r\n{if $smarty.get.esId}{assign var=\"type\" value=\"es:`$smarty.get.esId`\"}{/if}\r\n{if $smarty.request.gParams}{include_php file=\"shared_handle:assignGraphParams\"}{/if}\r\n{if $smarty.request.format eq \"small\"}\r\n	{assign var=\"url\" value=$skinFolder|cat:\"/flash/grapher_sm.swf?id=\":$compId:\"!\":$type:\"!\":$fillPrevious:\"!\":$precision:\"!\":$stars:\"!\":$totalChange:\"!\":$userIds:\"&session_id=\":$smarty.session.session_id}\r\n{elseif $smarty.request.format eq \"wide\"}\r\n	{assign var=\"url\" value=$skinFolder|cat:\"/flash/grapher_wide.swf?id=\":$compId:\"!\":$type:\"!\":$fillPrevious:\"!\":$precision:\"!\":$stars:\"!\":$totalChange:\"!\":$userIds:\"&session_id=\":$smarty.session.session_id}\r\n{else}\r\n	{assign var=\"url\" value=$skinFolder|cat:\"/flash/grapher.swf?id=\":$compId:\"!\":$type:\"!\":$fillPrevious:\"!\":$precision:\"!\":$stars:\"!\":$totalChange:\"!\":$userIds:\"&session_id=\":$smarty.session.session_id}\r\n{/if}\r\n\r\n{* assign var=\"url\" value=$skinFolder|cat:\"/flash/grapher{if $smarty.request.format eq \"small\"}_sm{elseif $smarty.request.format eq \"wide\"}_wide{/if}.swf?id=comp1!weight!1!0!!1&session_id=\":$smarty.session.session_id\" *}\r\n\r\n<h3 class=\"underline\">&nbsp; {if $userIds}Showing{else}Comparing{/if} {if $totalChange}Change in {/if}{$type|niceText} Over Time</h3>\r\n{if $user->username eq \"trave\" AND ($type OR $smarty.get.esId)}\r\n	{if $smarty.request.format eq \"small\"}\r\n		{swf src=$url width=\"425\" height=\"195\" bgcolor=\"#FFFFFF\" wmode=\"transparent\"}\r\n	{elseif $smarty.request.format eq \"wide\"}\r\n		{swf src=$url width=\"595\" height=\"195\" bgcolor=\"#FFFFFF\" wmode=\"transparent\"}\r\n	{else}\r\n		{swf src=$url width=\"555\" height=\"195\" bgcolor=\"#FFFFFF\" wmode=\"transparent\"}\r\n	{/if}\r\n{elseif $user->username eq \"trave\"}\r\n	{if $smarty.request.format eq \"small\"}\r\n		<img src=\"{$systemFolder}images/choose_graph_small.gif\" width=\"421\" height=\"187\" />\r\n	{else}\r\n		<img src=\"{$systemFolder}images/choose_graph_wide.gif\" width=\"588\" height=\"180\" />\r\n	{/if}\r\n{else}\r\n<ul>\r\n	<li>The eHealthCompete graphing engine is temporarily unavailable due to upgrades.</li>\r\n</ul>\r\n{/if}\r\n\r\n{if false AND $acm->isDomainAdmin()}\r\n	{$smarty.request.gParams}\r\n	{assign var=\"debugUrl\" value=$url|regex_replace:\"/.*\\?/\":\"?pg=flashgraph&\"}\r\n	Debug this graph: <a href=\"{$debugUrl}\" target=\"_blank\">Source</a> | <a href=\"{$debugUrl}&debug=1\" target=\"_blank\">Debugger</a>\r\n{/if}\r\n\r\n</body></html>'),(4270,195,0.57,'smarty','0','Imported from V2 conversion',1126837421,3,'24.2.76.126','{include file=\"layouts/forceLoggedIn.tpl\"}\r\n{include_php file=\"shared_handle:myHome\"}\r\n{include_php file=\"shared_handle:getProfile\"}\r\n{assign var=\"pgLayout\" value=\"layouts/withLeftNav.tpl\"}\r\n<h1>{$page.title} - {$userProfile.firstName} {$userProfile.lastName} ({$userProfile.username})</h1>\r\n\r\n{select_query return=\"row\" assign=\"aHRA\"}\r\n	dateTaken, pointsEarned FROM surveys_taken\r\n		WHERE userId = {$user->id}\r\n		AND surveyId = 8\r\n		ORDER BY dateTaken DESC\r\n		LIMIT 1\r\n{/select_query}\r\n\r\n<table width=\"700\">\r\n<tr>\r\n	<td>\r\n	<div id=\"statsContainer\" style=\"overflow:hidden;\">\r\n		<a name=\"updateStats\"></a>\r\n		<iframe name=\"profileUpdateFrame\" id=\"profileUpdateIFrame\" src=\"?pg=my_statistics/update&userId={$smarty.request.userId|default:$userProfile.id}\" frameborder=\"0\" width=\"700\" height=\"440\" scrolling=\"no\"></iframe>\r\n	</div>\r\n	</td>\r\n</tr>\r\n</table>\r\n\r\n<table width=\"700\">\r\n<tr><td>\r\n<h2 class=\"withBG\">\r\n	<div class=\"topRight hideShow\">\r\n		<a href=\"javascript:toggle(\'profileGraphTable\', \'\', \'showHide\');\"><img id=\"profileGraphTable_img\" src=\"blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a>\r\n	</div>User Profile &amp; Graphs</h2>\r\n</td></tr></table>\r\n\r\n<table id=\"profileGraphTable\" width=\"700\">\r\n<tr><td width=\"205\" valign=\"top\">\r\n	<div id=\"UserProfileColumn\" class=\"contentColumn\">\r\n	<h2 class=\"withBG\">Your Profile</h2>\r\n		<span class=\"cellHeadLarge\">Age:</span><span class=\"cellSmall\">{$userProfile.age|default:\"-\"}</span><br />\r\n		<span class=\"cellHeadLarge\">Height:</span><span class=\"cellSmall\">{$userProfile.heightFeet|default:\"-\"}\'{$userProfile.heightInches|default:\"-\"}&quot;</span><br />\r\n		<span class=\"cellHeadLarge\">Start BMI:</span><span class=\"cellSmall\">{$userProfile.startBMI|default:\"-\"}</span><br />\r\n		<span class=\"cellHeadLarge\">Start Weight:</span><span class=\"cellSmall\">{$userProfile.initialWeight|default:\"-\"}</span><br /><span class=\"cellHeadLarge\">Goal Weight:</span><span class=\"cellSmall\">{$userProfile.goalWeight|default:\"-\"}</span><br />\r\n		<span class=\"cellHeadLarge\">Current Weight:</span><span class=\"cellSmall\">{$userProfile.currentWeight|default:\"-\"}</span><br />\r\n		<span class=\"cellHeadLarge\">HRA Score:</span><span class=\"cellSmall\">{$aHRA.pointsEarned|default:\"-\"}</span><br />\r\n\r\n		<a href=\"?pg=my_profile\" class=\"link\"><img src=\"{$skinFolder}images/btn_profile.gif\" border=\"0\" alt=\"Update Profile\" vspace=\"10\" /></a><br />\r\n		<a href=\"?pg=my_settings\" class=\"link\"><img src=\"{$skinFolder}images/btn_settings.gif\" border=\"0\" alt=\"Account Settings\" vspace=\"0\" /></a>\r\n	</div>\r\n</td><td valign=\"top\" align=\"center\">	\r\n	<div id=\"graphContainer\">\r\n	<iframe name=\"graphwindow\" src=\"?pg=flashgraph-frame&compId={$compData.id}&format=small{* &type=weight&fillPrevious=1&precision=1&totalChange=0&userIds={$userProfile.id} *}\" frameborder=\"0\" width=\"425\" height=\"230\" scrollbars=\"no\"></iframe></div>\r\n	{if $user->username eq \"trave\"}{include_php file=\"shared_handle:estats/getEstatsInfo\"}\r\n	<small>\r\n		{foreach from=$aEstats item=\"es\" name=\"loopEstats\"}\r\n			<a href=\"?pg=flashgraph-frame&format=small&userIds={$userProfile.id}&esId={$es.id}&type={$es.name|niceText|htmlspecialchars}\" target=\"graphwindow\">{$es.name|niceText|replace:\" \":\"&nbsp;\"}</a> {if !$smarty.foreach.loopEstats.last}|{/if}\r\n		{foreachelse}\r\n			<b>No Available eStat Graphs</b>\r\n		{/foreach}\r\n	</small>\r\n	{else}\r\n	<small>\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=weight&fillPrevious=1&precision=1&totalChange=1\" target=\"graphwindow\">Change in Weight</a> |\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=weight&fillPrevious=1&precision=1\" target=\"graphwindow\">Weight</a> |\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=fat&fillPrevious=0&precision=1\" target=\"graphwindow\">Fat Intake</a> |\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=calories&fillPrevious=0&precision=1\" target=\"graphwindow\">Calorie Intake</a> |\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=carbs&fillPrevious=0&precision=1\" target=\"graphwindow\">Carb Intake</a><br />\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=water&fillPrevious=0&precision=1\" target=\"graphwindow\">Water Intake</a> |\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=minutesExercise&fillPrevious=0&precision=1\" target=\"graphwindow\">Exercise Min</a> |\r\n		<a href=\"?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=distanceExercised&fillPrevious=0&precision=1\" target=\"graphwindow\">Distance Exercised</a>\r\n	</small>\r\n	{/if}\r\n</td></tr>\r\n</table>\r\n<br />\r\n<table width=\"700\">\r\n<tr><td colspan=\"2\">\r\n<h2 class=\"withBG\">\r\n	<div class=\"topRight hideShow\">\r\n		<a href=\"javascript:toggle(\'goalsMottosBlock\', \'\', \'showHide\');\"><img id=\"goalsMottosBlock_img\" src=\"blank.gif\" class=\"showHide_on\" alt=\"show/hide\" border=\"0\" /></a>\r\n	</div>\r\n	Goals &amp; Mottos</h2>\r\n<blockquote id=\"goalsMottosBlock\" style=\"display:block;\">\r\n<dl>\r\n	<dt>Motto:</dt>\r\n	<dd>{$userProfile.personalSaying|default:\"- Not Set - Click on the <i><b>Update my Profile</b></i> button toward the top of this page to set your goal\"}</dd>\r\n	<dt>Nutrition Goal:</dt>\r\n	<dd>{$userProfile.nutritionGoal|default:\"- Not Set - Click on the <i><b>Update my Profile</b></i> button toward the top of this page to set your goal\"}</dd>\r\n	<dt>Fitness Goal:</dt>\r\n	<dd>{$userProfile.fitnessGoal|default:\"- Not Set - Click on the <i><b>Update my Profile</b></i> button toward the top of this page to set your goal\"}</dd>\r\n	<dt>Lifestyle Goal:</dt>\r\n	<dd>{$userProfile.lifestyleGoal|default:\"- Not Set - Click on the <i><b>Update my Profile</b></i> button toward the top of this page to set your goal\"}</dd>\r\n</dl>\r\n</blockquote>\r\n</td></tr>\r\n</table>'),(4272,138,0.49,'smarty','0','starting flashgraph v2 update',1126842196,3,'24.2.76.126','{* if $user->username eq \"trave\"}{display var=$smarty.get}{/if *}\r\n{assign var=\"pgLayout\" value=\"none\"}<html>\r\n<head>\r\n	<link rel=\"stylesheet\" href=\"{$skinFolder}/styles/base.css\" />\r\n	{if $styleName neq \"\"}<link rel=\"stylesheet\" type=\"text/css\" href=\"{$skinFolder}styles/{$styleName}.css\" />{/if}\r\n</head>\r\n<body style=\"margin:0px;background-image:none;\">\r\n\r\n{if $smarty.request.compId}\r\n	{assign var=\"compId\" value=\"comp\"|cat:$smarty.request.compId}\r\n{/if}\r\n{assign var=\"type\" value=$smarty.request.type}\r\n{assign var=\"fillPrevious\" value=$smarty.request.fillPrevious|default:\"1\"}\r\n{assign var=\"precision\" value=$smarty.request.precision|default:\"0\"}\r\n{assign var=\"stars\" value=$smarty.request.stars|default:\"\"}\r\n{assign var=\"totalChange\" value=$smarty.request.totalChange|default:\"0\"}\r\n{assign var=\"userIds\" value=$smarty.request.userIds|default:\"\"}\r\n{assign var=\"esId\" value=$smarty.request.esId}\r\n{if $smarty.request.gParams}{include_php file=\"shared_handle:assignGraphParams\"}{/if}\r\n{if $smarty.request.format eq \"small\"}\r\n	{assign var=\"url\" value=$skinFolder|cat:\"/flash/grapher_sm.swf?id=\":$compId:\"!\":$type:\"!\":$fillPrevious:\"!\":$precision:\"!\":$stars:\"!\":$totalChange:\"!\":$userIds:\"!\":$esId:\"&session_id=\":$smarty.session.session_id}\r\n{elseif $smarty.request.format eq \"wide\"}\r\n	{assign var=\"url\" value=$skinFolder|cat:\"/flash/grapher_wide.swf?id=\":$compId:\"!\":$type:\"!\":$fillPrevious:\"!\":$precision:\"!\":$stars:\"!\":$totalChange:\"!\":$userIds:\"!\":$esId:\"&session_id=\":$smarty.session.session_id}\r\n{else}\r\n	{assign var=\"url\" value=$skinFolder|cat:\"/flash/grapher.swf?id=\":$compId:\"!\":$type:\"!\":$fillPrevious:\"!\":$precision:\"!\":$stars:\"!\":$totalChange:\"!\":$userIds:\"!\":$esId:\"&session_id=\":$smarty.session.session_id}\r\n{/if}\r\n\r\n{* assign var=\"url\" value=$skinFolder|cat:\"/flash/grapher{if $smarty.request.format eq \"small\"}_sm{elseif $smarty.request.format eq \"wide\"}_wide{/if}.swf?id=comp1!weight!1!0!!1&session_id=\":$smarty.session.session_id\" *}\r\n\r\n<h3 class=\"underline\">&nbsp; {if $userIds}Showing{else}Comparing{/if} {if $totalChange}Change in {/if}{$type|niceText} Over Time</h3>\r\n{if $user->username eq \"trave\" AND ($type OR $smarty.get.esId)}\r\n	{if $smarty.request.format eq \"small\"}\r\n		{swf src=$url width=\"425\" height=\"195\" bgcolor=\"#FFFFFF\" wmode=\"transparent\"}\r\n	{elseif $smarty.request.format eq \"wide\"}\r\n		{swf src=$url width=\"595\" height=\"195\" bgcolor=\"#FFFFFF\" wmode=\"transparent\"}\r\n	{else}\r\n		{swf src=$url width=\"555\" height=\"195\" bgcolor=\"#FFFFFF\" wmode=\"transparent\"}\r\n	{/if}\r\n{elseif $user->username eq \"trave\"}\r\n	{if $smarty.request.format eq \"small\"}\r\n		<img src=\"{$systemFolder}images/choose_graph_small.gif\" width=\"421\" height=\"187\" />\r\n	{else}\r\n		<img src=\"{$systemFolder}images/choose_graph_wide.gif\" width=\"588\" height=\"180\" />\r\n	{/if}\r\n{else}\r\n<ul>\r\n	<li>The eHealthCompete graphing engine is temporarily unavailable due to upgrades.</li>\r\n</ul>\r\n{/if}\r\n\r\n{if $acm->isDomainAdmin()}\r\n	{$smarty.request.gParams}\r\n	{assign var=\"debugUrl\" value=$url|regex_replace:\"/.*\\?/\":\"?pg=flashgraph&\"}\r\n	Debug this graph: <a href=\"{$debugUrl}\" target=\"_blank\">Source</a> | <a href=\"{$debugUrl}&debug=1\" target=\"_blank\">Debugger</a>\r\n{/if}\r\n\r\n</body></html>'),