{assign var="pgLayout" value="layouts/withLeftNav.tpl"}

{if $smarty.request.showNewMenu eq "true"}
<div class="rightSideMenu">
	<div class="rightMenuBox">
	<h3>EHC News</h3>
		<div class="rightMenuItem">
		<span class="floatLeft iconNew"></span>
		<small><a href="#">Portion Control Article in the nutrition corner. Click here to read</a></small>
		</div>
		<div class="rightMenuItem">
		<small><a href="#">Learn more about carbohydrates and how they affect your body.</a></small>
		</div>	
	</div>
	<div class="rightMenuBox">
	<h3>Product Highlight</h3>
		<div class="rightMenuItem">
		<img src="{$skinFolder}images/rypHeartMonitor_small.jpg" align="right" class="img1" alt="" height="120" width="91" /><br />
		<small><a href="#">Reebok's Heart Rate Monitor.  Click here.</a></small>
		</div>
	</div>
	<div class="rightMenuBox">
	<h3>To Do List:</h3>
		<div class="rightMenuItem">
		<small><a href="#">Update your progress</a><br />
		<a href="#">Earn more incentive points</a><br />
		<a href="#">Check out the competition</a><br />
		<a href="#">Read New Articles</a></small>
		</div>
	</div>
</div>
{/if}

{if $user->isLoggedIn()}
	<img src="{if $smarty.session.company.preferences.landing_logo_url}{$smarty.session.company.preferences.landing_logo_url}{else}{$skinFolder}images/ehc/corporateBuilding_sm.jpg{/if}" style="margin-right:10px; float:left; border:#CCC 1px solid;" />

	{include_php file="shared_handle:company/announcements"}
	<h2 class="uline">Company Announcements:</h2>

	<blockquote>
		<dl>
		{foreach from=$announcements item="current"}
			<dt><div style="float:right;"><small><i>{$current.postedDate|date_format2:"D, M j"}</i></small></div>
			    {$current.title}</dt>
			<dd>{$current.description}</dd>
		{foreachelse}
			<dt>No announcements at this time</dt>
		{/foreach}
		</dl>
	</blockquote>

	{include_php file="shared_handle:company/companySurveyList"}
	{if $landingSurveyText OR $surveys|@count gt 0}
		<h2 class="uline">Company Surveys:</h2>
		<blockquote>
		{$landingSurveyText}
		{if $surveys|@count gt 0}
			<table>
			<tr><td colspan="2">
				<h3>Available Surveys:</h3></td>
			    <td valign="middle"></td></tr>
			{foreach from=$surveys item=item name="loopSurveys"}<tr><td nowrap>
			<tr><td valign="top" nowrap="nowrap">
				{if $item.dateAvailable gt 0}
					<img class="icoSurvey" src="blank.gif" width="1" height="1" alt="" border="0" /></td>
				   <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 />
					{$item.feedbackTitle|default:"No feedback available."}<br />
					<a href="?pg=my_feedback&surveyId={$item.id}&amp;feedbackId={$item.feedbackId}">Click here to learn more<b><i>!</i></b></a><br />
					<br /></td>
				   <td valign="middle" align="right"><em>{$item.pointsEarned}</em></td></tr>
				{else}
					<a href="javascript://" onclick="openSurvey({$item.id});"><img class="icoSurvey" src="blank.gif" width="1" height="1" alt="" border="0" /></a></td>
				   <td valign="top" nowrap="nowrap"><b><u>{$item.surveyName}</u>:</b> <a href="javascript://" onclick="openSurvey({$item.id});">Available Now</a><br />
					{$item.feedbackTitle|default:"No feedback available."}<br />
					<a href="?pg=my_feedback&surveyId={$item.id}&amp;feedbackId={$item.feedbackId}">Click here to learn more<b><i>!</i></b></a><br />
					<br /></td>
				   <td valign="middle" align="right"><em>{$item.pointsEarned}</em></td></tr>
				{/if}
			{foreachelse}
			<tr><td valign="top" colspan="3">
				None found.</td></tr>
			{/foreach}
			</table>
		{/if}
		</blockquote>
	{/if}
	{if $smarty.session.company.preferences.hide_shop neq "yes"}
		<h2 class="uline">eHealthCompete Highlights:</h2>
		
		<table>
		<tr><td valign="middle">
		<blockquote>
		<dl>	
			<dt>Pedometer Deal</dt>
			<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>
			
		</dl>
		</blockquote></td>
		<td valign="top" align="center">
			<a href="?pg=my_shop&sub=&tma=VIEW&eids=9">
			<img id="pedometerDealImg" src="blank.gif" width="1" height="1" alt="" border="0" /><br />
			Buy one now</a>
		</td></tr></table>
	{/if}
{else}
	{assign var="hideLogin" value="true"}
		<script language="JavaScript">{literal}
			function doForgotPassword(boxId, formName) {
				if (!formName) formName = 'loginForm';
				if (!boxId) boxId = 'usernameBox';

				var df = document.forms[formName];
				var obj = document.getElementById(boxId);
		
				if (obj.value == '') {
					obj.value = prompt('Enter your username:', '');
				}
				

				df.forgotPassword.value = 'true';
				df.submit();	
			}

		{/literal}</script>
	<table align="center" width="305" cellpadding="0" cellspacing="0">
	<tr><td align="center">
		<h2>{$smarty.session.company.companyName}</h2>
	</td></tr>
	<tr><td>
		{if $smarty.session.company.preferences.hide_login eq "yes"}
			<p><b>You have either logged out or your session has expired.</b><br /><br />If you would like to log back in now, you will need to close this window and log in from the company website.  If you have any questions please contact our support department.</p>
		{else}
		<div align="center" class="chunk300">
			<form name="loginForm2" method="post" action="index.php" style="margin:3px;">
			<input type="hidden" name="pg" value="{$smarty.request.return|default:$signup.return|default:"my_login"}" />
			<input type="hidden" name="cid" value="{$smarty.request.cid}" />
			<input type="hidden" name="no_expire" value="true" />
			<input type="hidden" name="no_expire_keep_alive" value="pg cid" />
			<input type="hidden" name="forgotPassword" value="" />
		
			<h2 class="withBG">Log In:</h2>
				Username: <input id="usernameBox2" type="text" name="username" value="{$smarty.request.username}" class="textInput" size="12" /><br />
				Password: <input type="password" name="password" class="textInput" size="12" /><br />
				<div class="underline">&nbsp;</div>
				<a href="javascript:document.forms['loginForm2'].submit();">Submit</a> | <a href="javascript:doForgotPassword('usernameBox2', 'loginForm2');">Forgot Password?</a>
				<input type="submit" name="loginSubmit" value="Submit" style="position:absolute; top:-300px; left:-300px;" />
			</form>
			<script language="javascript">
				document.forms.loginForm2.username.focus();
			</script>
		</div>
		{/if}		
	</td></tr>
	<tr><td align="right">
		<br />
		{if $smarty.session.company.companyName && $smarty.session.company.preferences.hide_login neq "yes"}
			<small>Not registered yet?</small> <a href="?pg=signup/begin">Sign Up Now!</a> &nbsp;
		{else}
			<!-- Place holder for sign up info content. -->
		{/if}
	</td></tr>
	</table>
{/if}