<!--many_many_contacts
	<div class="contacts-fat-list">
        <ul>
        [%
            for(index=0;index<contacts.length;index++){
                var _contact = contacts[index];
                if (!_contact.tag) _contact.tag=[];
                var _index=index;

                with(_contact){

                
                %]
                    <li class="contact-card" rel="[%=id%]" title="[%=firstName%] [%=lastName%]">
                        <dl >
                            <dt><img class="photo" alt="photo" src="/api/contacts/[%=id%]/avatar" style="float: left;width:4em;"/></dt>
                            <dd><strong class="contact_name">[%=firstName%] [%=lastName%]</strong>&nbsp;</dd>
                            <dd>[%=title%]&nbsp;</dd>
                            [%
                            if(phoneNumbers!=null){
                            %]<dd>[%=phoneNumbers.phoneNumber[0].number%]&nbsp;</dd>[%
                            }
                            %]
                            [%if(emailAddresses!=null){%]
                            <dd><a href="mailto:[%=emailAddresses.emailAddress[0].email%]">[%=emailAddresses.emailAddress[0].email%]</a></dd>
                            [%}%]
                            &nbsp;<dd class="many-tags">
                                [%=render_partial('many_contacts_tags',{tag:tag,contact:_contact,index:_index})%]
                            </dd>
                        </dl>
                    </li>
                [% }
             }
            %]

        </ul>
    </div>
-->

<!--many_contacts_tags
	<ul class="tags-list">
    [% for(i=0;i<tag.tag.length;i++){%]
        <li class='tag'><a href="[%=tag.tag[i].id%]" rel="[%=index%]" title=" '[%=tag.tag[i].label%]'">[%=tag.tag[i].label%]</a></li>
    [%}%]
   </ul>


-->
<div class="contact-list-holder">
    <div class="gen-toolbar toolbar">
      <ul>
        <li class="export-ui">
			<a title="Export" href="#" id="link-contact-export">Export</a>
			<span class="exporting-field hide">
				<ul>
					<li><a id="download-as-csv" href="/export?exportIds=[%=selected.toString()%]&format=csv">CSV</a></li>
					<li><a id="cancel-export" href="#cancel-export">Cancel</a></li>
				</ul>
	        </span>
		</li>
        <li class="tag-ui">
          <a title="Tag" href="#" id="link-contact-tag">Tag</a>
		<span class="tagging-field hide">
          <ul>
			<li>
            <input type="text" id="multi-tag-field"/></li>
			<li><a id="add-tag" href="#">Add</a></li>
            <li><a id="cancel-tag" href="#">Cancel</a></li>
          </ul>
</span>
        </li>
        <li><a title="Delete" href="#" id="link-contact-delete">Delete</a></li>
        <li class="merge-ui">
          <a title="Merge" href="#" id="link-contact-merge">Merge</a>
          <span class="merging-confirm hide">
            <p class="merge-message" style="float:left;margin:0;">Select a destination contact</p>
            <p class="merge-confirm-message" style="float:left;margin:0;">This will merge [NUM] contacts into [NAME]</p>
            <input type="submit" id="confirm-merge" value="Confirm"/>
            <a id="cancel-merge" href="#">Cancel</a>
          </span>
        </li>
      </ul>
    </div>

    [%=render_partial('many_many_contacts',{contacts:contacts})%]

</div>