
<dl>

[%
var _current_letter='_';
var _alt=false;

for(index=0;index<model.contact.length;index++){
    var _contact=model.contact[index];

    with(model.contact[index]){
        fn=firstName;
        ln=lastName;
        var flag=false;


        if(fn=='' || ln==''){
            flag=true;
            if(fn=='' && ln==''){
                fn = 'No';
                ln = 'Name';
            }
        }


        try{
            if(lastName.length > 0) {
                var _this_letter=lastName.substring(0,1).toUpperCase();
            } else {
                var _this_letter=firstName.substring(0,1).toUpperCase();
            }

            if(_this_letter!='' && _current_letter!=_this_letter){
			_alt=false;
            %]
                <dt rel="[%=_this_letter%]">[%=_this_letter%]&nbsp;</dt>

            [%
                _current_letter=_this_letter;
            }
        }catch(e){
            
        }

		var u='';

		if(fn && ln){
			u='&nbsp;';
		}

        if(fn || ln){
        var s='';
		var t='';
		
		if(selected[index]==true){
			t='checked=checked';
		}
		
        if(flag==true){
            s='color:red';
        }else{
            s='';
        }

        %]
        <dd rel="[%=index%]" letter="" class="[%=(_alt==true)?'alternate':''%]"><input rel="[%=index%]" type="checkbox" [%=t%]/><a style="[%=s%]" rel="[%=index%]" href="#[%=id%]">[%=fn%]<strong>[%=u%][%=ln%]</strong></a></dd>
        [%

			_alt=!_alt;
		}
    }


} %]
</dl>



