
$(function(){var newNoteTrigger=$('#createnewnote a').overlay({expose:{color:'#333',loadSpeed:100,opacity:0.5},closeOnClick:false});$('#newnote form').submit(function(e){if($.todo.checkFields('newnote')){var noteText=$('#newNoteText');var noteDate=$('#newNoteDate');$.post('http://'+window.location.host+'/simpletasks/main/addnote',{n_text:noteText.val(),n_date:noteDate.val()},function(reply){if(reply.status=='OK'){newNoteTrigger.overlay().close();var nonotes=$('h2.nonotes');if(nonotes.length>0){var table=$('<table id="noteslist"> '
+'<tr class="table_header">'
+'<th scope="col" class="noteState">'+$.td.nnState+'</th>'
+'<th scope="col" class="noteText">'+$.td.nnText+'</th>'
+'<th scope="col" class="noteDate">'+$.td.nnDate+'</th>'
+'<th scope="col" class="noteUpdate"></th>'
+'<th scope="col" class="noteDelete"></th>'
+'</tr>'
+'</table>');table.insertAfter(nonotes);nonotes.remove();}
var newNote=$('<tr id="note_'+reply.id+'">'
+'<td><img class="note_state" src="'+reply.state_img_url+'" alt="'+reply.state+'" /></td>'
+'<td class="note_text"><pre id="note_text_'+reply.id+'">'+reply.text+'</pre></td>'
+'<td class="note_date" id="note_date_'+reply.id+'">'+reply.date+'</td>'
+'<td><a href="#" rel="#updatenote" class="updateNote" title="'+$.td.nnUpdate+'">'+$.td.nnUpdate+'</a></td>'
+'<td><a href="#" rel="#removenote" class="removeNote" title="'+$.td.nnDelete+'">'+$.td.nnDelete+'</a></td>'
+'</tr>');newNote.todonote();newNote.insertAfter($('.table_header'));}
else{$('#newnote div.error_message').html(reply.message);}},'json');}
return e.preventDefault();});});