function editNote(c,b){if($("#noteInput_"+c).length){$("#noteInput_"+c).slideDown("fast");}else{if($("#note_"+c).length){var a=jQuery.trim($("#note_"+c).html());note=a.replace(/<br>/g,"\n");$("#genericNoteInput .noteOriginal").html(a);$("#genericNoteInput textarea").html(note);$("#note_"+c).html($("#genericNoteInput .note").html());
$("#noteelement_"+c+" .noteEntry").attr("id","noteInput_"+c);bindInput(c,b);resetGenericNote();}else{$("#genericNoteInput .noteEntry").attr("id","noteInput_"+c);$("#genericNoteInput .note").attr("id","note_"+c);$("#noteelement_"+c).append($("#genericNoteInput").html());$("#noteInput_"+c).slideDown("fast");
bindInput(c,b);resetGenericNote();}}}function resetGenericNote(){$("#genericNoteInput .noteEntry").attr("id","");$("#genericNoteInput .note").attr("id","");$("#genericNoteInput .noteOriginal").html("");$("#genericNoteInput textarea").html("");}function bindInput(b,a){$("#noteInput_"+b+" .cancel").click(function(){cancelNote(b);
});$("#noteInput_"+b+" .save").click(function(){saveNote(b,a);});}function cancelNote(a){if($("#noteInput_"+a+" .noteOriginal").html().length>0){$("#note_"+a).html($("#noteInput_"+a+" .noteOriginal").html());$("#noteInput_"+a).attr("id","");}else{$("#noteInput_"+a+" textarea").val("");$("#noteInput_"+a).hide();
}}function saveNote(c,b){var a=$("#noteInput_"+c+" textarea").val();$("#note_"+c).html('<span id="contactLoader"><img src="/images/ajax-loader.gif" /> Loading...</span>');$.ajax({async:false,type:"POST",url:"/userSearch/saveNote?noDecorator",data:"listingId="+c+"&noteBody="+a+"&noteId="+b,success:function(d){$("#note_"+c).text(a);
$("#note_"+c).html($("#note_"+c).html().replace(/\n/g,"<br/>"));$("#noteInput_"+c).attr("id","");if(d.length<5){$("#noteCount").text(d);}}});}