it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
// Functions to be used in templates
include 'more-fields-template-functions.php';
include 'more-fields-object.php';
$mf0 = new more_fields_object();
$mf0->init();
$mf0->init_field_types();
// Load admin components
if (is_admin()) {
    include 'more-fields-manage-object.php';
    $mfo = new more_fields_manage();
    $mfo->init($mf0);
}
function mf_add_meta_box($title, $fields, $context = array(), $position = '')
{
    global $more_fields_boxes;
    if (!$position) {
        $position = 'left';
    }
    if (!is_array($context)) {
<?php

require_once dirname(__FILE__) . '/../../../wp-load.php';
require_once dirname(__FILE__) . '/../../../wp-admin/admin.php';
header("Content-Type: text/javascript");
// Need to initalize a new instance as this is a separate instance
$mf0 = new more_fields_object();
$mf0->init();
//	do_action('');
$type = attribute_escape($_GET['type']);
$pages = $mf0->get_pages();
$option = $mf0->get_option('options');
// If the page type does not exist, then stop!
// if (!array_key_exists($type, $pages)) exit();
if ($_GET['action'] == 'get_file_list') {
    $post_id = attribute_escape($_GET['post_id']);
    $attachments['data'] = get_children(array('post_parent' => $post_id, 'post_type' => 'attachment', 'orderby' => 'menu_order ASC, ID', 'order' => 'DESC'));
    $attachments['clicked'] = attribute_escape($_GET['clicked']);
    echo json_encode($attachments);
    exit;
}
?>

jQuery(document).ready(function(){	
	if (jQuery("#titlediv")) {

	<?php 
if ($option['show_page_type_select']) {
    ?>
		var html = '<p><strong><label for="mf_page_type"><?php 
    _e('Page Type', 'more-fields');