$(function() {
    $("input.datepicker").datepicker({dateFormat:$.datepicker.W3C, constrainInput: false});

    date_obj = new Date();
    date_obj_hours = date_obj.getHours();
    date_obj_mins = date_obj.getMinutes();

    if (date_obj_mins < 10) {
        date_obj_mins = "0" + date_obj_mins;
    }

    date_obj_time = "' " + date_obj_hours + ":" + date_obj_mins + ":00'";

    $('input.datetimepicker').datepicker({
        dateFormat:$.datepicker.W3C,
        duration: '',
        showTime: true,
        constrainInput: false,
        time24h: true
     });

    $('textarea.rte').tinymce({
        // Location of TinyMCE script
        script_url : '/cui/js/plugins/tinymce/tiny_mce.js',

        // General options
        theme : "advanced",
        plugins : "advlink,inlinepopups,media,xhtmlxtras,paste",
        width : '100%',

        // Theme options
        theme_advanced_buttons1 : "undo,redo,separator,bold,italic,underline,forecolor,formatselect,separator,bullist,numlist,link,unlink,image,sparator,code",
        theme_advanced_buttons2 : "",
        theme_advanced_buttons3 : "",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_resizing : true,
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_path : false,
        relative_urls: false,
        remove_script_host : false,
        paste_auto_cleanup_on_paste : true,

        // Example content CSS (should be your site CSS)
        content_css : "/cui/themes/default/css/tinymce.css",

        // Drop lists for link/image/media/template dialogs
        template_external_list_url : "lists/template_list.js",
        external_link_list_url : "lists/link_list.js",
        external_image_list_url : "lists/image_list.js",
        media_external_list_url : "lists/media_list.js",

        // Replace values for the template plugin
        template_replace_values : {
            username : "Some User",
            staffid : "991234"
        }
    });

//    $('select[multiple=multiple]').nicyform({'type': 'multiselect'});
})