(function(){tinymce.create("tinymce.plugins.InsertDateTime",{init:function(b,c){var a=this;a.editor=b;b.addCommand("mceInsertDate",function(){var d=a._getDateTime(new Date(),b.getParam("plugin_insertdate_dateFormat",b.getLang("insertdatetime.date_fmt")));b.execCommand("mceInsertContent",false,d)});b.addCommand("mceInsertTime",function(){var d=a._getDateTime(new Date(),b.getParam("plugin_insertdate_timeFormat",b.getLang("insertdatetime.time_fmt")));b.execCommand("mceInsertContent",false,d)});b.addButton("insertdate",{title:"insertdatetime.insertdate_desc",cmd:"mceInsertDate"});b.addButton("inserttime",{title:"insertdatetime.inserttime_desc",cmd:"mceInsertTime"})},getInfo:function(){return{longname:"Insert date/time",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/insertdatetime",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_getDateTime:function(b,c){var a=this.editor;function e(f,g){f=""+f;if(f.length<g){for(var d=0;d<(g-f.length);d++){f="0"+f}}return f}c=c.replace("%D","%m/%d/%y");c=c.replace("%r","%I:%M:%S %p");c=c.replace("%Y",""+b.getFullYear());c=c.replace("%y",""+b.getYear());c=c.replace("%m",e(b.getMonth()+1,2));c=c.replace("%d",e(b.getDate(),2));c=c.replace("%H",""+e(b.getHours(),2));c=c.replace("%M",""+e(b.getMinutes(),2));c=c.replace("%S",""+e(b.getSeconds(),2));c=c.replace("%I",""+((b.getHours()+11)%12+1));c=c.replace("%p",""+(b.getHours()<12?"AM":"PM"));c=c.replace("%B",""+a.getLang("insertdatetime.months_long").split(",")[b.getMonth()]);c=c.replace("%b",""+a.getLang("insertdatetime.months_short").split(",")[b.getMonth()]);c=c.replace("%A",""+a.getLang("insertdatetime.day_long").split(",")[b.getDay()]);c=c.replace("%a",""+a.getLang("insertdatetime.day_short").split(",")[b.getDay()]);c=c.replace("%%","%");return c}});tinymce.PluginManager.add("insertdatetime",tinymce.plugins.InsertDateTime)})();