public function load_js_css_base()
 {
     global $mf_domain;
     wp_enqueue_style('mf_field_base', MF_BASENAME . 'css/mf_field_base.css');
     wp_enqueue_script('tmpl', MF_BASENAME . 'js/third_party/jquery.tmpl.js');
     wp_enqueue_script('mf_field_base', MF_BASENAME . 'js/mf_field_base.js');
     wp_enqueue_script('mf_sortable_groups', MF_BASENAME . 'js/mf_sortable_groups.js', array('jquery-ui-sortable'));
     $mceAddString = "mceAddControl";
     $mceRemoveString = "mceRemoveControl";
     if (is_wp39()) {
         $mceAddString = "mceAddEditor";
         $mceRemoveString = "mceRemoveEditor";
     }
     //global mf js
     $js_vars = array('mf_url' => MF_BASENAME, 'mf_player_url' => MF_BASENAME . 'js/singlemp3player.swf', 'mf_validation_error_msg' => __('Sorry, some required fields are missing. Please provide values for any highlighted fields and try again.', $mf_domain), 'mf_image_media_set' => __('Insert into field', $mf_domain), 'mf_mceAddString' => $mceAddString, 'mf_mceRemoveString' => $mceRemoveString);
     wp_localize_script('mf_field_base', 'mf_js', $js_vars);
 }
    public static function CustomFieldsJavascript()
    {
        global $CUSTOM_WRITE_PANEL;
        ?>
	<script type="text/javascript">
		var mf_path = "<?php 
        echo MF_URI;
        ?>
" ;
		<?php 
        $nonce_ajax_upload = wp_create_nonce('once_ajax_uplooad');
        $nonce_ajax_duplicate = wp_create_nonce('nonce_ajax_duplicate');
        if (!(is_user_logged_in() && current_user_can('upload_files'))) {
            $nonce_ajax_upload = 'Ah ah ah, you didn\'t say the magic word';
            $nonce_ajax_duplicate = 'Ah ah ah, you didn\'t say the magic word';
        }
        ?>
        var nonce_ajax_upload = "<?php 
        echo $nonce_ajax_upload;
        ?>
";
        var nonce_ajax_duplicate = "<?php 
        echo $nonce_ajax_duplicate;
        ?>
";
        <?php 
        $mceString = 'Control';
        if (is_wp39()) {
            $mceString = 'Editor';
        }
        ?>
        var mceString = "<?php 
        echo $mceString;
        ?>
";
	</script>
	<?php 
        wp_enqueue_script('jquery-ui-sortable');
        //loading  jquery ui datepicker
        wp_enqueue_script('datepicker', MF_URI . 'js/ui.datepicker.js', array('jquery', 'jquery-ui-core'));
        //loading core of the datepicker
        wp_enqueue_script('mf_datepicker', MF_URI . 'js/custom_fields/datepicker.js');
        $slider_js = MF_URI . 'js/ui.slider.js';
        //load slider for wp31
        if (is_wp31()) {
            $slider_js = MF_URI . 'js/jquery.ui.slider.js';
        }
        //loading  jquery ui slider
        wp_enqueue_script('slider', $slider_js, array('jquery', 'jquery-ui-core'), NULL, true);
        //loading the code for delete images
        wp_enqueue_script('mf_colorpicker', MF_URI . 'js/custom_fields/colorpicker.js');
        //loading the code for delete images
        wp_enqueue_script('mf_image', MF_URI . 'js/custom_fields/image.js');
        //loading handler for upload files
        wp_enqueue_script('mf_upload', MF_URI . 'js/upload.js');
        //loading handler for metadata
        wp_enqueue_script('mf_metadata', MF_URI . 'js/jquery.metadata.js');
        ///loading handler for validate
        wp_enqueue_script('mf_validate', MF_URI . 'js/jquery.validate.pack.js');
        //loading the code for validation
        wp_enqueue_script('mf_validate_fields', MF_URI . 'js/custom_fields/validate.js');
        //loading jquery scrollpane (group summaries)
        wp_enqueue_script('jscrollpane', MF_URI . 'js/jquery.jscrollpane.js');
        //loading jquery scrollpane (group summaries)
        wp_enqueue_script('windowopen', MF_URI . 'js/jquery.windowopen.min.js');
        //loading jquery template plugin
        wp_enqueue_script('tmpl', MF_URI . 'js/jquery.tmpl.js');
        //loading jquery colorpicker plugin
        wp_enqueue_script('jquerycolorpicker', MF_URI . 'js/jquery.colorpicker.js');
        //load affix plugin (for tooltips)
        wp_enqueue_script('jqueryaffix', MF_URI . 'js/jquery.affix.min.js');
        //load reveal plugin (for tooltips)
        wp_enqueue_script('jqueryreveal', MF_URI . 'js/jquery.reveal.min.js');
        $hide_visual_editor = RCCWP_Options::Get('hide-visual-editor');
        if ($hide_visual_editor == '' || $hide_visual_editor == 0) {
            //loading the code for textarea in validation
            wp_enqueue_script('mf_editor_validate', MF_URI . 'js/custom_fields/editor_validate.js');
        }
        //markitup
        wp_enqueue_script('markitup', MF_URI . 'js/markitup/jquery.markitup.js', array('jquery'));
        wp_enqueue_script('markitup_set_markdown', MF_URI . 'js/markitup/sets/html/set.js', array('markitup'));
        wp_enqueue_script('valums_file_uploader', MF_URI . 'js/valumsfileuploader.js');
        wp_enqueue_script('markitup_setup', MF_URI . 'js/markitup/jquery.markitup.setup.js', array('markitup'));
        //load script for custom magicfields
        if (file_exists(MF_UPLOAD_FILES_DIR . DIRECTORY_SEPARATOR . "js" . DIRECTORY_SEPARATOR . "magic_fields.js")) {
            wp_enqueue_script('custom_magic_fields', MF_FILES_URI . 'js/magic_fields.js');
        }
        //load script for custom write panel
        if (file_exists(MF_UPLOAD_FILES_DIR . DIRECTORY_SEPARATOR . "js" . DIRECTORY_SEPARATOR . $CUSTOM_WRITE_PANEL->capability_name . ".js")) {
            wp_enqueue_script('custom_wp' . $CUSTOM_WRITE_PANEL->capability_name, MF_FILES_URI . 'js/' . $CUSTOM_WRITE_PANEL->capability_name . '.js');
        }
    }