<script type="text/javascript" src="includes/jscript/statesdropdown.js"></script>

{include file="$template/clientareadetailslinks.tpl"}

		<div class="bigheader">
			<h2>{$LANG.clientareanavdetails}</h2>
		</div><!-- .bigheader -->

{if $successful}
	<div class="notice notice-success">
		<div class="inside">
			<p>{$LANG.changessavedsuccessfully}</p>
		</div>
	</div>
{/if}

{if $errormessage}
	<div class="notice notice-error">
		<div class="inside">
			<p>{$errormessage}</p>
		</div>
	</div>
{/if}

<form method="post" action="{$smarty.server.PHP_SELF}?action=details">
  <input type="hidden" name="save" value="true" />
  
  		<div class="feildset">
		
			<div class="col2">
			
				<div>
					<label>
						<span>{$LANG.clientareafirstname}:</span>						
						{if in_array('firstname',$uneditablefields)}{$clientfirstname}{else}<input type="text" name="firstname" value="{$clientfirstname}" autofocus="autofocus" />{/if}
					</label>
				</div>
				
				<div>
					<label>
						<span>{$LANG.clientareaemail}:</span>						
						{if in_array('email',$uneditablefields)}{$clientemail}{else}<input type="text" name="email" value="{$clientemail}" />{/if}
					</label>
				</div>
				
				<div>
					<label>
						<span>{$LANG.clientareacountry}:</span>						
						{if in_array('country',$uneditablefields)}{$clientcountry}{else}{$clientcountriesdropdown}{/if}
					</label>
				</div>				
				
				<div>
					<label>
						<span>{$LANG.clientareaaddress1}:</span>						
						{if in_array('address1',$uneditablefields)}{$clientaddress1}{else}<input type="text" name="address1" value="{$clientaddress1}" />{/if}
					</label>
				</div>
				
				<div>
					<label>
						<span>{$LANG.clientareacity}:</span>						
						{if in_array('city',$uneditablefields)}{$clientcity}{else}<input type="text" name="city" value="{$clientcity}" />{/if}
					</label>
				</div>				
				
				
				<div>
					<label>
						<span>{$LANG.clientareapostcode}:</span>						
						{if in_array('postcode',$uneditablefields)}{$clientpostcode}{else}<input type="text" name="postcode" value="{$clientpostcode}" />{/if}
					</label>
				</div>																										
			
			</div><!-- .col2 --> 
			
			
			<div class="col2 nomarginright">

				<div>
					<label>
						<span>{$LANG.clientarealastname}:</span>						
						{if in_array('lastname',$uneditablefields)}{$clientlastname}{else}<input type="text" name="lastname" value="{$clientlastname}" size="25" />{/if}
					</label>
				</div>
				
				<div>
					<label>
						<span>{$LANG.clientareacompanyname}:</span>						
						{if in_array('companyname',$uneditablefields)}{$clientcompanyname}{else}<input type="text" name="companyname" value="{$clientcompanyname}" />{/if}
					</label>
				</div>
				
				<div>
					<label>
						<span>{$LANG.clientareaaddress2}:</span>						
						{if in_array('address2',$uneditablefields)}{$clientaddress2}{else}<input type="text" name="address2" value="{$clientaddress2}" />{/if}
					</label>
				</div>
				
				<div>
					<label>
						<span>{$LANG.clientareastate}:</span>						
						{if in_array('state',$uneditablefields)}{$clientstate}{else}<input type="text" name="state" value="{$clientstate}" />{/if}
					</label>
				</div>									

				
				<div>
					<label>
						<span>{$LANG.clientareaphonenumber}:</span>						
						{if in_array('phonenumber',$uneditablefields)}{$clientphonenumber}{else}<input type="text" name="phonenumber" value="{$clientphonenumber}" />{/if}
					</label>
				</div>											
			
			</div><!-- .col2 -->
			
			<div class="clear">&nbsp;</div>
			
			
		</div>
  

 		<div class="feildset">
		
			<div class="col1">
			
				<div>
					<label>
						<span>{$LANG.paymentmethod}:</span>						
						<select name="paymentmethod">
                <option value="none">{$LANG.paymentmethoddefault}</option>
{foreach from=$paymentmethods item=method}
                <option value="{$method.sysname}"{if $method.sysname eq $defaultpaymentmethod} selected="selected"{/if}>{$method.name}</option>
{/foreach}
              </select>
					</label>
				</div>
				
				<div>
					<label>
						<span>{$LANG.defaultbillingcontact}:</span>						
						<select name="billingcid">
                <option value="0">{$LANG.usedefaultcontact}</option>
{foreach key=num item=contact from=$contacts}
                <option value="{$contact.id}"{if $contact.id eq $billingcid} selected="selected"{/if}>{$contact.name}</option>
{/foreach}
              </select>
					</label>
				</div>
				
				
				{if $emailoptoutenabled}
				<div>
					<label>
						<span>{$LANG.emailoptout}:</span>						
						<input type="checkbox" value="1" name="emailoptout" id="emailoptout" {if $emailoptout} checked{/if} /> {$LANG.emailoptoutdesc}
					</label>
				</div>	
				{/if}										
			
			
			</div>
			
		</div>	


 {if $customfields}

 		<div class="feildset">
		
			<div class="col1">
			
			{foreach key=num item=customfield from=$customfields}
				<div>
					<label>
						<span>{$customfield.name}:</span>						
						{$customfield.input} {$customfield.required} {$customfield.description}
					</label>
				</div>			
			 {/foreach}
			 
			</div>
			
		</div>

  {/if}
  
  <p class="center">
    <input type="submit" value="{$LANG.clientareasavechanges}" class="button1 color2" />
    <input type="reset" value="{$LANG.clientareacancel}" class="button1 color1" />
  </p>
</form>