function powerpress_admin_basic()
{
    $FeedAttribs = array('type' => 'general', 'feed_slug' => '', 'category_id' => 0, 'term_taxonomy_id' => 0, 'term_id' => 0, 'taxonomy_type' => '', 'post_type' => '');
    // feed_slug = channel
    $General = powerpress_get_settings('powerpress_general');
    $General = powerpress_default_settings($General, 'basic');
    if (!isset($General['advanced_mode_2'])) {
        $General['advanced_mode_2'] = true;
    }
    $FeedSettings = powerpress_get_settings('powerpress_feed');
    $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed');
    $CustomFeed = get_option('powerpress_feed_' . 'podcast');
    // Get the custom podcast feed settings saved in the database
    if ($CustomFeed) {
        $FeedSettings = powerpress_merge_empty_feed_settings($CustomFeed, $FeedSettings);
        $FeedAttribs['channel_podcast'] = true;
    }
    $MultiSiteServiceSettings = false;
    if (is_multisite()) {
        $MultiSiteSettings = get_site_option('powerpress_multisite');
        if (!empty($MultiSiteSettings['services_multisite_only'])) {
            $MultiSiteServiceSettings = true;
        }
    }
    ?>
<script type="text/javascript"><!--
function CheckRedirect(obj)
{
	if( obj.value )
	{
		if( obj.value.indexOf('rawvoice') == -1 && obj.value.indexOf('techpodcasts') == -1 && 
			obj.value.indexOf('blubrry') == -1 && obj.value.indexOf('podtrac') == -1 )
		{
			if( !confirm('<?php 
    echo __('The redirect entered is not recongized as a supported statistics redirect service.', 'powerpress');
    ?>
\n\n<?php 
    echo __('Are you sure you wish to continue with this redirect url?', 'powerpress');
    ?>
') )
			{
				obj.value = '';
				return false;
			}
		}
	}
	return true;
}

function SelectEmbedField(checked)
{
	if( checked )
		jQuery('#embed_replace_player').removeAttr("disabled");
	else
		jQuery('#embed_replace_player').attr("disabled","disabled");
}

jQuery(document).ready(function($) {
	
	jQuery('#powerpress_advanced_mode_button').click( function(event) {
		event.preventDefault();
		jQuery('#powerpress_advanced_mode').val('0');
		jQuery(this).closest("form").submit();
	});
	
	jQuery('#episode_box_player_links_options').change(function () {
		
		var objectChecked = jQuery('#episode_box_player_links_options').attr('checked');
		if(typeof jQuery.prop === 'function') {
			objectChecked = jQuery('#episode_box_player_links_options').prop('checked');
		}
		
		if( objectChecked == true ) {
			jQuery('#episode_box_player_links_options_div').css("display", 'block' );
		}
		else {
			jQuery('#episode_box_player_links_options_div').css("display", 'none' );
			jQuery('.episode_box_no_player_or_links').attr("checked", false );
			jQuery('#episode_box_no_player_and_links').attr("checked", false );
			if(typeof jQuery.prop === 'function') {
				jQuery('.episode_box_no_player_or_links').prop("checked", false );
				jQuery('#episode_box_no_player_and_links').prop("checked", false );
			}
		}
	} );
	
	jQuery('#episode_box_no_player_and_links').change(function () {
		
		var objectChecked = jQuery(this).attr("checked");
		if(typeof jQuery.prop === 'function') {
			objectChecked = jQuery(this).prop("checked");
		}
		
		if( objectChecked == true ) {
			jQuery('.episode_box_no_player_or_links').attr("checked", false );
			if(typeof jQuery.prop === 'function') {
				jQuery('.episode_box_no_player_or_links').prop("checked", false );
			}
		}
	} );

	jQuery('.episode_box_no_player_or_links').change(function () {
		var objectChecked = jQuery(this).attr("checked");
		if(typeof jQuery.prop === 'function') {
			objectChecked = jQuery(this).prop("checked");
		}
		
		if( objectChecked == true) {
			jQuery('#episode_box_no_player_and_links').attr("checked", false );
			if(typeof jQuery.prop === 'function') {
				jQuery('#episode_box_no_player_and_links').prop("checked", false );
			}
		}
	} );
	
	jQuery('#episode_box_feature_in_itunes').change( function() {
		var objectChecked = jQuery('#episode_box_feature_in_itunes').attr('checked');
		if(typeof jQuery.prop === 'function') {
			objectChecked = jQuery('#episode_box_feature_in_itunes').prop('checked');
		}
		if( objectChecked ) {
			$("#episode_box_order").attr("disabled", true);
		} else {
			$("#episode_box_order").removeAttr("disabled");
		}
	});

} );
//-->
</script>

<input type="hidden" name="action" value="powerpress-save-settings" />


<input type="hidden" id="powerpress_advanced_mode" name="General[advanced_mode_2]" value="1" />
<input type="hidden" id="save_tab_pos" name="tab" value="<?php 
    echo empty($_POST['tab']) ? 0 : intval($_POST['tab']);
    ?>
" />

<div id="powerpress_admin_header">
<h2><?php 
    echo __('Blubrry PowerPress Settings', 'powerpress');
    ?>
</h2> 
	<span class="powerpress-mode"><?php 
    echo __('Advanced Mode', 'powerpress');
    ?>
		&nbsp; <a href="<?php 
    echo admin_url("admin.php?page=powerpress/powerpressadmin_basic.php&amp;mode=simple");
    ?>
" id="powerpress_advanced_mode_button" class="button-primary"><?php 
    echo __('Switch to Simple Mode', 'powerpress');
    ?>
</a>
	</span>
</div>

<div id="powerpress_settings_page" class="powerpress_tabbed_content"> 
  <ul class="powerpress_settings_tabs">
		<li><a href="#tab0"><span><?php 
    echo htmlspecialchars(__('Welcome', 'powerpress'));
    ?>
</span></a></li> 
		<li><a href="#tab1"><span><?php 
    echo htmlspecialchars(__('Basic Settings', 'powerpress'));
    ?>
</span></a></li> 
		<li><a href="#tab2"><span><?php 
    echo htmlspecialchars(__('Services & Stats', 'powerpress'));
    ?>
</span></a></li>
		<li><a href="#tab3"><span><?php 
    echo htmlspecialchars(__('Media Appearance', 'powerpress'));
    ?>
</span></a></li>
		<li><a href="#tab4"><span><?php 
    echo htmlspecialchars(__('Feeds', 'powerpress'));
    ?>
</span></a></li>
		<li><a href="#tab5"><span><?php 
    echo htmlspecialchars(__('iTunes', 'powerpress'));
    ?>
</span></a></li>
		<li><a href="#tab6"><span><?php 
    echo htmlspecialchars(__('Artwork', 'powerpress'));
    ?>
</span></a></li>
  </ul>
	
	<div id="tab0" class="powerpress_tab">
	<?php 
    powerpressadmin_welcome($General);
    ?>
	</div>
	
  <div id="tab1" class="powerpress_tab">
		<?php 
    powerpressadmin_edit_entry_options($General);
    powerpressadmin_edit_podpress_options($General);
    ?>
	</div>
	
	<div id="tab2" class="powerpress_tab">
		<?php 
    if ($MultiSiteServiceSettings && defined('POWERPRESS_MULTISITE_VERSION')) {
        PowerPressMultiSitePlugin::edit_blubrry_services($General);
    } else {
        powerpressadmin_edit_blubrry_services($General);
        powerpressadmin_edit_media_statistics($General);
    }
    ?>
	</div>
	
	<div id="tab3" class="powerpress_tab">
		<?php 
    powerpressadmin_appearance($General, $FeedSettings);
    ?>
	</div>
	
	<div id="tab4" class="powerpress_tab">
		<?php 
    powerpressadmin_edit_feed_general($FeedSettings, $General);
    powerpressadmin_edit_feed_settings($FeedSettings, $General, $FeedAttribs);
    powerpressadmin_edit_tv($FeedSettings);
    ?>
	</div>
	
	<div id="tab5" class="powerpress_tab">
		<?php 
    powerpressadmin_edit_itunes_general($FeedSettings, $General, $FeedAttribs);
    powerpressadmin_edit_itunes_feed($FeedSettings, $General, $FeedAttribs);
    ?>
	</div>
	
	<div id="tab6" class="powerpress_tab">
		<?php 
    powerpressadmin_edit_artwork($FeedSettings, $General);
    ?>
	</div>
	
</div>
<div class="clear"></div>

<?php 
    powerpressadmin_advanced_options($General);
}
function powerpress_admin_defaults()
{
    $FeedAttribs = array('type' => 'general', 'feed_slug' => '', 'category_id' => 0, 'term_taxonomy_id' => 0, 'term_id' => 0, 'taxonomy_type' => '', 'post_type' => '');
    $General = powerpress_get_settings('powerpress_general');
    $General = powerpress_default_settings($General, 'basic');
    $FeedSettings = powerpress_get_settings('powerpress_feed');
    $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed');
    // Make sure variables are set
    if (empty($FeedSettings['title'])) {
        $FeedSettings['title'] = '';
    }
    $Step = 0;
    if (!empty($FeedSettings['itunes_cat_1']) && !empty($FeedSettings['email']) && !empty($FeedSettings['itunes_image'])) {
        $Step = 1;
    }
    $episode_total = 0;
    if ($Step == 1) {
        $episode_total = powerpress_admin_episodes_per_feed('podcast');
        if ($episode_total > 0) {
            $Step = 2;
        }
    }
    if ($Step == 2 && !empty($FeedSettings['itunes_url'])) {
        $Step = 3;
    }
    $MultiSiteServiceSettings = false;
    if (is_multisite()) {
        $MultiSiteSettings = get_site_option('powerpress_multisite');
        if (!empty($MultiSiteSettings['services_multisite_only'])) {
            $MultiSiteServiceSettings = true;
        }
    }
    ?>
<script type="text/javascript"><!--


jQuery(document).ready(function($) {
	jQuery('#powerpress_advanced_mode_button').click( function(event) {
		event.preventDefault();
		jQuery('#powerpress_advanced_mode').val('1');
		jQuery(this).closest("form").submit();
	} );
} );
//-->
</script>
<input type="hidden" name="action" value="powerpress-save-defaults" />
<input type="hidden" id="powerpress_advanced_mode" name="General[advanced_mode_2]" value="0" />

<div id="powerpress_admin_header">
<h2><?php 
    echo __('Blubrry PowerPress Settings', 'powerpress');
    ?>
</h2> 
<span class="powerpress-mode"><?php 
    echo __('Simple Mode', 'powerpress');
    ?>
	&nbsp; <a href="<?php 
    echo admin_url("admin.php?page=powerpress/powerpressadmin_basic.php&amp;mode=advanced");
    ?>
" id="powerpress_advanced_mode_button" class="button-primary"><?php 
    echo __('Switch to Advanced Mode', 'powerpress');
    ?>
</a>
</span>
</div>

<?php 
    powerpressadmin_default_steps($FeedSettings, $General, $Step);
    if ($MultiSiteServiceSettings && defined('POWERPRESS_MULTISITE_VERSION')) {
        PowerPressMultiSitePlugin::edit_blubrry_services($General);
    } else {
        powerpressadmin_edit_blubrry_services($General);
    }
    ?>
<h3><?php 
    echo __('Podcast Settings', 'powerpress');
    ?>
</h3>
<table class="form-table">
<tr valign="top">
<th scope="row">
<?php 
    echo __('Program Title', 'powerpress');
    ?>
</th>
<td>
<input type="text" name="Feed[title]" style="width: 60%;"  value="<?php 
    echo esc_attr($FeedSettings['title']);
    ?>
" maxlength="255" />
(<?php 
    echo __('leave blank to use blog title', 'powerpress');
    ?>
)
<p><?php 
    echo __('Blog title:', 'powerpress') . ' ' . get_bloginfo_rss('name');
    ?>
</p>
</td>
</tr>
</table>
<?php 
    if ($Step > 1) {
        // Only display if we have episdoes in the feed!
        powerpressadmin_edit_itunes_general($FeedSettings, $General, $FeedAttribs);
    }
    // iTunes settings (in simple mode of course)
    powerpressadmin_edit_itunes_feed($FeedSettings, $General, $FeedAttribs);
    powerpressadmin_edit_artwork($FeedSettings, $General);
    powerpressadmin_appearance($General, $FeedSettings);
    powerpressadmin_advanced_options($General);
}