{assign var="pgLayout" value="layouts/default.tpl"}
{stored_object name=$smarty.session.session_id|truncate:10:"" type="signup" from="signup" assign="signup"}

{if $smarty.request.confirmReset}{stored_object name=$smarty.session.session_id|truncate:10:"" type="signup" destroy="true"}{/if}
{assign var="return" value=$smarty.request.return|default:$signup.return|default:"home"}
<!-- {$return} -->
{if $user->isLoggedIn() and $return neq ""}
	{if $return eq "home"}
		{message type="error" value="You cannot sign up for a membership when you are already logged in."}
	{/if}
	{store_messages}
	{redirect href="?pg=`$return`"}
{/if}

<h1 class="underline">Sign Up - Step 1</h1>
Creating your <em>FREE</em> membership is simple.  Just fill out the forms below and click Next.
<br />

<table cellpadding="0" cellspacing="0"><tr><td>

<div class="chunk300">
	<form name="loginForm2" method="post" action="index.php" style="margin:3px;">
	<input type="hidden" name="pg" value="{$page.name}" />
	<input type="hidden" name="return" value="{$smarty.request.return|default:$signup.returndefault:"home"}" />
	<input type="hidden" name="no_expire" value="true" />
	<h2 class="withBG">Already a Member?</h2>
		<b>Log in now.</b><br />
		Username: <input type="text" name="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.loginForm2.submit();">Submit</a> | <a href="javascript:doForgotPassword();">Forgot Password?</a>
	</form>
</div>
<div class="underline" style="clear:left;"></div>
<p><b>* indicates a required field</b></p>
{toc_next assign="next"}
{toc_prev assign="prev"}
<form name="signup" method="post" action="index.php" style="margin:0px;">
<input type="hidden" name="pg" value="{$next.pageName}">
<input type="hidden" name="no_expire" value="true">
<input type="hidden" id="signupReturn" name="signup[return]" value="{$return}">

<table><tr><td>

<div class="chunk300 h150 w300">
<h2 class="withBG">Create your Membership </h2>
	*First Name:
	<input type="text" name="signup[firstName]" class="textInput" size="20" /><br />

	*Last Name:
	<input type="text" name="signup[lastName]" class="textInput" size="20" /><br />

	*E-mail:
	<input type="text" name="signup[email]" class="textInput" size="30" /><br />

	*Desired Username:
	<input type="text" name="signup[username]" class="textInput" size="12"><br />
</div>

<div class="chunk300">
<h2 class="withBG">Password</h2>
{if $signup.password}
	<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 />
{/if}
	*Choose Your Password:
	<input type="password" name="signupSecure[password]" size="12" class="textInput"><br />
	<small>(Password must be at least 8 characters long)</small><br />

	*Confirm Your Password:
	<input type="password" name="signupSecure[passwordConfirm]" size="12" class="textInput"><br />
</div>

</td><td valign="top">

<div class="chunk300 w300">
	<h2 class="withBG">Shipping &amp; Contact Address</h2>
	
	<div id="addressInfo" style="display:block;">
	*Address:
	<input type="text" name="signup[address1]" value="{$smarty.request.signup.address1}" class="textInput" style="width:200px;" /><br />
	Line 2:
	<input type="text" name="signup[address2]" value="{$smarty.request.signup.address2}" class="textInput" style="width:200px;" /><br />

	*City:
	<input type="text" name="signup[city]" value="{$smarty.request.signup.city}" class="textInput" style="width:200px;" /><br />

	*State, *Zip:
	<input type="text" name="signup[state]" value="{$smarty.request.signup.state}" class="textInput" style="width:30px;" maxlength="2" />
	<input type="text" name="signup[zip]" value="{$smarty.request.signup.zip}" class="textInput" style="width:50px;" /><br />

	<div style="float:left;">*Country:</div>
	<div id="signupcountry" style="float:right; border:1px solid black;"><input type="text" name="signup[country]" value="{$smarty.request.signup.country}" class="textInput" style="width:200px;" maxlength="30" /></div>

	Phone:
	<input type="text" name="signup[phone1]" value="{$smarty.request.signup.phone1}" class="textInput" style="width:200px;" maxlength="80" /><br />

	Phone 2:
	<input type="text" name="signup[phone2]" value="{$smarty.request.signup.phone2}" class="textInput" style="width:200px;" maxlength="80" /><br />

	</div>
</div>

</td></tr></table>

<div id="fMatches" class="xFloat" style="padding:3px; background-color:#FFFFFF; border:#666666 1px solid;">
</div>

{if $modules.spadeAutoComplete}
	{* <script language="javascript" src="{$modules.x}"></script> *}
	<script language="javascript" src="{$modules.spadeAutoComplete}"></script>
	<script language="javascript" src="js/auto-complete_states.js"></script>
	<script language="javascript" src="js/auto-complete_countries.js"></script>
	<script language="javascript">
		initAutoComplete('signup[state]', states, true);
		initAutoComplete('signup[country]', countries, true);
	</script>
{/if}
</td></tr></table>

<div class="hBox" align="right">
	<br />
	{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}
	{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}
</div>

{stored_object_fill_form object=$signup name="signup"}
<script language="javascript">document.getElementById('signupReturn').value = '{$return}';</script>

</form>