<?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>
<h3><?php _e( 'Amazilon', 'amazilon' ); echo ' '; _e( 'Amazon PartnerNet', 'amazilon' ); echo ' - '; _e( 'Statistics', 'amazilon' ); ?></h3>
<div class="block">
	<h2 class="nav-tab-wrapper">
		<p class="amazilon-tabs">
			<a class="nav-tab nav-tab" id="amazilon-tab-errors" href="<?php echo admin_url('admin.php?page=amazilon-statistics'); ?>#errors"><?php _e( 'Errors', 'amazilon' ); ?></a>
			<a class="nav-tab nav-tab-active" id="amazilon-tab-clicks" href="<?php echo admin_url('admin.php?page=amazilon-statistics-clicks'); ?>#clicks"><?php _e( 'Clicks', 'amazilon' ); ?></a>
		</p>
	</h2>
	<div class="amazilon-tabcontent nav-tabcontent-active" id="amazilon-tabcontent-clicks" style="padding: 1em;"><?php require( dirname(__FILE__) . '/pages/statistics-clicks.php' ); ?></div>
</div>
