<!--types_dropdown
	<select name="[%=name%]" class="[%=css%]">

    [%
    $.each(types,function(i,n){
    %]
        <option [%=(type==n.id)?'selected=""':''%] rel="[%=n.id%]" value="[%=i%]">[%=n.value%]</option>

    [%
    });
    %]

    </select>
-->

<!--company_field
	<span class="Field  company_field Cleared">
        <input type="text" name="company" value="[%=name%]"/>
        <a class="remove_action" href="#remove">[%=resource_string('action.contacts.index.edit.remove')%]</a>
    </span>
-->

<!--email_field
	<span class="Field dualField email_field Cleared">
        <input type="text" name="email" value="[%=model.email%]"/>

        [%=render_partial('types_dropdown',{name:'type',types:types,css:'',type:model.type.id})%]

        <a class="remove_action"  href="#remove">[%=resource_string('action.contacts.index.edit.remove')%]</a>
    </span>
-->

<!--telephone_field
	<span class="Field dualField phone_field Cleared">
        <input type="text" value="[%=model.number%]" name="number"/>
        [%=render_partial('types_dropdown',{name:'type',types:types,css:'',type:model.type.id})%]
        <a class="remove_action"  href="#remove">[%=resource_string('action.contacts.index.edit.remove')%]</a>
    </span>
-->

<!--address_field
	<span class="Field address-field Cleared">


        <span>
            <label>Street</label>
            <input type="text" value="[%=model.street%]" name="street"/>

            <span class="dual">
                <label>City</label>
                <input type="text" value="[%=model.city%]" name="city"/>
            </span>

            <span class="dual">
                <label>State</label>
                <input type="text" value="[%=model.state%]" name="state"/>
            </span>

            <span class="dual">
                <label>Postcode</label
                <input type="text" value="[%=model.zip%]" name="zip"/>

            </span>

            <span class="dual">
                <label>Country</label
                <input type="text" value="[%=model.country%]" name="country"/>

            </span>
        </span>

        [%=render_partial('types_dropdown',{name:'type',types:types,css:'address-type',type:model.type.id})%]


            <a class="remove_action"  href="#remove">[%=resource_string('action.contacts.index.edit.remove')%]</a>
    </span>
-->

<!--website_field
	<span class="Field dualField website_field Cleared">
        <input type="text" name="url" value="[%=model.url%]"/>
        [%=render_partial('types_dropdown',{name:'type',types:types,css:'',type:model.type.id})%]
        <a class="remove_action"  href="#remove">[%=resource_string('action.contacts.index.edit.remove')%]</a>
    </span>
-->

<!--instantMessengers_field
	<span class="Field dualField instantMessenger_field Cleared">
        <input type="text" name="" value="[%=address%]"/>
        <select>
            <option>Home</option>
            <option>Work</option>
            <option>Other</option>
        </select>
        <a class="remove_action"  href="#remove">[%=resource_string('action.contacts.index.edit.remove')%]</a>
    </span>
-->

<div class="gen-toolbar toolbar ">
	
    <ul id="edit_toolbar">
  
	<li><input id="link-contact-confirm" type="submit" value="[%=resource_string('action.contacts.index.done')%]"/></li>
    </ul>
<h2 style="background:none!important;color:#fff;"><span>[%
	if(contact.id==null){
		%]New Contact[%
	} else { 
		%]Editing <span class="contact-name">[%=contact.firstName%]&nbsp;[%=contact.lastName%]</span>[% 
	} 
	%]</span></h2>
</div>
<div class=" ScrollPane">

    <div class="" id="contact-edit-form">
    <form action="${ctx}/snippets/contacts/${contact.id}" method="post">
        <input type="hidden" name="_method" value="put"/>
        <div class="field-block" style="border-top:none">
            <span class="Field Cleared">
                <label>[%=resource_string('label.contacts.index.edit.firstname')%]</label>
                <input type="text" value="[%=contact.firstName%]" name="firstName"/>
            </span>

            <span class="Field Cleared">
                <label>[%=resource_string('label.contacts.index.edit.lastname')%]</label>
                <input type="text" value="[%=contact.lastName%]" name="lastName"/>
            </span>

            <span class="Field Cleared">
                <label>[%=resource_string('label.contacts.index.edit.title')%]</label>
                <input type="text" value="[%=contact.title%]" name="title"/>
            </span>

            <span class="Field Cleared MediumField">
                <label>[%=resource_string('label.contacts.index.edit.information')%]</label>
                <textarea name="info">[%=contact.info%]</textarea>
            </span>
        </div>
<hr/>
        <div class="field-block">
            <h2><span>[%=resource_string('label.contacts.index.edit.company')%]</span></h2>
            <div class="fields-container">
            <div id="companies">
            [%
              if(contact.companies!=null){
                $.each(contact.companies.company,function(i,n){%]
                  [%=render_partial('company_field',n)%][%
                });
              }
            %]
            </div>
            <span class="SingleAction"><a id="add_company" href="#">[%=resource_string('action.contacts.index.edit.addcompany')%]</a></span>
            </div>
        </div>
<hr/>
        <div class="field-block">
            <h2><span>[%=resource_string('label.contacts.index.edit.email')%]</span></h2>
            <div class="fields-container">
            <div class="" id="email_addresses">
            [%


              if(contact.emailAddresses!=null){
                $.each(contact.emailAddresses.emailAddress,function(i,n){%]
                  [%=render_partial('email_field',{model:n,types:emailTypes.emailType})%]
                [%
                });
              }
            %]
            </div>
            <span class="SingleAction"><a id="add_email_address" href="#">[%=resource_string('action.contacts.index.edit.addemail')%]</a></span>
            </div>
        </div>
<hr/>
        <div class="field-block">
            <h2><span>[%=resource_string('label.contacts.index.edit.telephone')%]</span></h2>
        <div class="fields-container">
             <div id="telephone_numbers">
            [%
              if(contact.phoneNumbers!=null){
                $.each(contact.phoneNumbers.phoneNumber,function(i,n){%]
                  [%=render_partial('telephone_field',{model:n,types:emailTypes.emailType})%][%
                });
              }
            %]
            </div>
            <span class="SingleAction"><a id="add_telephone_number" href="#">[%=resource_string('action.contacts.index.edit.addphone')%]</a></span>
            </div>
        </div>
<hr/>

        <div class="field-block">
            <h2><span>[%=resource_string('label.contacts.index.edit.address')%]</span></h2>
            <div class="fields-container">
            <div id="addresses">
            [%
              if(contact.addresses!=null){
                $.each(contact.addresses.address,function(i,n){%]
                  [%=render_partial('address_field',{model:n,types:addressTypes.addressType})%][%
                });
              }
            %]
            </div>
            <span class="SingleAction"><a id="add_address" href="#">[%=resource_string('action.contacts.index.edit.addaddress')%]</a></span>
            </div>
        </div>
<hr/>
        <div class="field-block">
            <h2><span>[%=resource_string('label.contacts.index.edit.website')%]</span></h2>
            <div class="fields-container" >
            <div id="websites">
            [%
              if(contact.websites!=null){
                $.each(contact.websites.website,function(i,n){%]
                  [%=render_partial('website_field',{model:n,types:websiteTypes.websiteType})%][%
                });
              }
            %]
            </div>
            <span class="SingleAction"><a id="add_website" href="#">[%=resource_string('action.contacts.index.edit.addwebsite')%]</a></span>
            </div>
        </div>


    </form>
    </div>

</div>