var $,seteditor;$=jQuery;seteditor=function(){var editor;if($('#signature_type').val()==="1"){editor=$("#signature_content").cleditor()[0];editor.$area.insertBefore(editor.$main);editor.$area.removeData("cleditor");editor.$main.remove();$('#signature_content').val('');$('#signature_content').show();}else $('#signature_content').cleditor({width:"100%",height:"100%"});return 1;};$(document).ready(function(){var csrf,uploadform;csrf=$('#csrf_token').val();uploadform="<form enctype=\"multipart/form-data\" method=\"post\" action=\""+fm_url+"?action=upload\">                 <p><input type=\"file\" name=\"handle\" /><br>                 <input type=\"text\" name=\"newName\" style=\"width:250px; border:solid 1px !important;\" /><br>                 <input type=\"hidden\" value=\""+csrf+"\" name=\"csrf_token\">                 <input type=\"submit\" name=\"submit\" value=\"Upload\" /></p>                 </form>                 ";$('#signature_type').change(seteditor);if($('#signature_type').val()===2)$('#signature_content').cleditor({width:"100%",height:"100%"});$('#currimgs .wysiwyg-dialog-close-button').click(function(e){e.preventDefault();return $('#currimgs').hide();});$('#imgupload .wysiwyg-dialog-close-button').click(function(e){e.preventDefault();$('#currimgs').hide();return $('#imgupload').hide();});$(".wysiwyg-files-action-upload").click(function(e){$('#imgupload .wysiwyg-dialog-content').empty();$("<iframe/>",{"class":"wysiwyg-files-upload"}).load(function(){var $doc;$doc=$(this).contents();$doc.find("body").append(uploadform);return $doc.find("input[type=file]").change(function(){var $val;$val=$(this).val();$val=$val.replace(/.*[\\\/]/,'');return $doc.find("input[name=newName]").val($val);});}).appendTo($('#imgupload .wysiwyg-dialog-content'));return $('#imgupload').show();});return 1;});