<?php

if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

?>
<style type="text/css">
.nav-tabcontent-active
{
    display: block;
}
.nav-tabcontent-inactive
{
    display: none;
}
</style>
<script type="text/javascript">
jQuery(document).ready(function () {
	var sHash = window.location.hash.substr(1);
<?php
	if ( isset( $_GET['jumpTo'] ) && !empty( $_GET['jumpTo'] ) )
	{
		echo '	sHash = "' . urlencode( $_GET['jumpTo'] ) . '";' . "\n";
	}
?>
    if ( sHash != '' )
    {
        amazilonToTab( sHash );
    }
});

amazilonToTab = function ( activate )
{
    jQuery( '.amazilon-tabs .nav-tab-active' ).removeClass( 'nav-tab-active' );
    jQuery( '.amazilon-tabs #amazilon-tab-' + activate ).addClass( 'nav-tab-active' ).blur();

    jQuery( '.amazilon-tabcontent.nav-tabcontent-active' ).removeClass( 'nav-tabcontent-active' ).addClass( 'nav-tabcontent-inactive' );
    jQuery( '.amazilon-tabcontent#amazilon-tabcontent-' + activate ).addClass( 'nav-tabcontent-active' ).removeClass( 'nav-tabcontent-inactive' );

    window.location.hash = '#' + activate;
    return false;
}
</script>
  <div class="block">
<?php
    if ( isset( $_GET['m'] ) )
    {
        switch ( $_GET['m'] )
        {
            case '1':
                    echo '<div class="notice notice-success"><p>' . __( 'The selected rows where successfully deleted.', 'amazilon' ) . '</p></div>';
                break;
            case '2':
                    echo '<div class="notice notice-success"><p>' . __( 'Please enter ASIN to replace and ASIN to use instead.', 'amazilon' ) . '</p></div>';
                break;
            case '3':
                    echo '<div class="notice notice-success"><p>' . __( 'The new ASIN replacement got activated.', 'amazilon' ) . '</p></div>';
                break;
        }
    }
?>
    <h2 class="nav-tab-wrapper">
        <p class="amazilon-tabs">
            <a class="nav-tab nav-tab-active" id="amazilon-tab-xchangelist" href="#xchangelist" onclick="return amazilonToTab('xchangelist');"><?php _e( 'Replacements list', 'amazilon' ); ?></a>
			<a class="nav-tab" id="amazilon-tab-xchangenew" href="#xchangenew" onclick="return amazilonToTab('xchangenew');"><?php _e( 'New Replacement', 'amazilon' ); ?></a>
        </p>
    </h2>
    <div class="amazilon-tabcontent nav-tabcontent-active" id="amazilon-tabcontent-xchangelist" style="max-width: 50em; padding: 1em;"><?php require dirname( __FILE__ ) . '/pages/xchange-list.php'; ?></div>
    <div class="amazilon-tabcontent nav-tabcontent-inactive" id="amazilon-tabcontent-xchangenew" style="padding: 1em;"><?php require dirname( __FILE__ ) . '/pages/xchange-new.php'; ?></div>
</div>
