{if $smarty.session.company.preferences.hide_home eq "yes"}{include file="file:layouts/hiddenPageRedirector.tpl"}{/if}
{include file="layouts/forceLoggedIn.tpl"}
{include_php file="shared_handle:myHome"}
{include_php file="shared_handle:getProfile"}
{assign var="pgLayout" value="layouts/withLeftNav.tpl"}
<h1>{$page.title} - {$userProfile.firstName} {$userProfile.lastName} ({$userProfile.username})</h1>

{select_query return="row" assign="aHRA"}
	dateTaken, pointsEarned FROM surveys_taken
		WHERE userId = {$user->id}
		AND surveyId = 8
		ORDER BY dateTaken DESC
		LIMIT 1
{/select_query}

<table width="700">
<tr>
	<td>
	<div id="statsContainer" style="overflow:hidden;">
		<a name="updateStats"></a>
		<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>
	</div>
	</td>
</tr>
</table>

<table width="700">
<tr><td>
<h2 class="withBG">
	<div class="topRight hideShow">
		<a href="javascript:toggle('profileGraphTable', '', 'showHide');"><img id="profileGraphTable_img" src="blank.gif" class="showHide_on" alt="show/hide" border="0" /></a>
	</div>User Profile &amp; Graphs</h2>
</td></tr></table>

<table id="profileGraphTable" width="700">
<tr><td width="205" valign="top">
	<div id="UserProfileColumn" class="contentColumn">
	<h2 class="withBG">Your Profile</h2>
		<span class="cellHeadLarge">Age:</span><span class="cellSmall">{$userProfile.age|default:"-"}</span><br />
		<span class="cellHeadLarge">Height:</span><span class="cellSmall">{$userProfile.heightFeet|default:"-"}'{$userProfile.heightInches|default:"-"}&quot;</span><br />
		<span class="cellHeadLarge">Start BMI:</span><span class="cellSmall">{$userProfile.startBMI|default:"-"}</span><br />
		<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 />
		<span class="cellHeadLarge">Current Weight:</span><span class="cellSmall">{$userProfile.currentWeight|default:"-"}</span><br />
		<span class="cellHeadLarge">HRA Score:</span><span class="cellSmall">{$aHRA.pointsEarned|default:"-"}</span><br />

		<a href="?pg=my_profile" class="link"><img src="{$skinFolder}images/btn_profile.gif" border="0" alt="Update Profile" vspace="10" /></a><br />
		<a href="?pg=my_settings" class="link"><img src="{$skinFolder}images/btn_settings.gif" border="0" alt="Account Settings" vspace="0" /></a>
	</div>
</td><td valign="top" align="center">	
	<div id="graphContainer">
	<iframe name="graphwindow" src="?pg=flashgraph-frame&compId={$compData.id}&format=small" frameborder="0" width="425" height="240" scrollbars="no"></iframe></div>
	{if true OR $user->username eq "chad" OR $user->username eq "trave"}
	{include_php file="shared_handle:estats/getEstatsInfo"}
	<div id="graphLinksDiv">
		<table width="100%">
		<tr>
			<td width="100%" align="center"><small>
			{foreach from=$aEstats item="es" name="loopEstats"}
				<a href="?pg=flashgraph-frame&format=small&userIds={$userProfile.id}&esId={$es.id}&type={$es.name|niceText|htmlspecialchars}&fillPrevious={if $es.assumeConstantValues eq "yes"}1{else}0{/if}&precision={$es.units.decimalPlaces|default:1}" target="graphwindow">{$es.name|niceText|replace:" ":"&nbsp;"}</a> {if !$smarty.foreach.loopEstats.last}|{/if}
			{foreachelse}
				<b>No Available eStat Graphs</b>
			{/foreach}
			</small></td>
		</tr>
		</table>
	</div>
	{else} {* OLD GRAPH LISTINGS *}
	<small>
		<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> |
		<a href="?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=weight&fillPrevious=1&precision=1" target="graphwindow">Weight</a> |
		<a href="?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=fat&fillPrevious=0&precision=1" target="graphwindow">Fat Intake</a> |
		<a href="?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=calories&fillPrevious=0&precision=1" target="graphwindow">Calorie Intake</a> |
		<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 />
		<a href="?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=water&fillPrevious=0&precision=1" target="graphwindow">Water Intake</a> |
		<a href="?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=minutesExercise&fillPrevious=0&precision=1" target="graphwindow">Exercise Min</a> |
		<a href="?pg=flashgraph-frame&compId={$compData.id}&format=small&userIds={$userProfile.id}&type=distanceExercised&fillPrevious=0&precision=1" target="graphwindow">Distance Exercised</a>
	</small>
	{/if}
</td></tr>
</table>
<br />
<table width="700">
<tr><td colspan="2">
<h2 class="withBG">
	<div class="topRight hideShow">
		<a href="javascript:toggle('goalsMottosBlock', '', 'showHide');"><img id="goalsMottosBlock_img" src="blank.gif" class="showHide_on" alt="show/hide" border="0" /></a>
	</div>
	Goals &amp; Mottos</h2>
<blockquote id="goalsMottosBlock" style="display:block;">
<dl>
	<dt>Motto:</dt>
	<dd>{$userProfile.personalSaying|default:"- Not Set - <a href=\"http://partners.ehealthcompete.com/index.php?pg=my_profile\">Click here to update now</a>"}</dd>
	<dt>Nutrition Goal:</dt>
	<dd>{$userProfile.nutritionGoal|default:"- Not Set - <a href=\"http://partners.ehealthcompete.com/index.php?pg=my_profile\">Click here to update now</a>"}</dd>
	<dt>Fitness Goal:</dt>
	<dd>{$userProfile.fitnessGoal|default:"- Not Set - <a href=\"http://partners.ehealthcompete.com/index.php?pg=my_profile\">Click here to update now</a>"}</dd>
	<dt>Lifestyle Goal:</dt>
	<dd>{$userProfile.lifestyleGoal|default:"- Not Set - <a href=\"http://partners.ehealthcompete.com/index.php?pg=my_profile\">Click here to update now</a>"}</dd>
</dl>
</blockquote>
</td></tr>
</table>

<script type="text/javascript">
	function updateGraphLinks(s) {ldelim}
		//s.replace(/\[userId\]/gi, '{$userProfile.id}'); 
		document.getElementById('graphLinksDiv').innerHTML = s;
	{rdelim}
</script>