﻿/* ------------------------------------------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------------------------------------------ */

$(function(){
    $( '.btn' ).click(
      function() {
       $( this ).parents( '.btn-block' ).find( '.btn' ).each(
        function() {
         $( '.' + $( this ).attr( 'id' ) ).hide();
         $( this ).removeClass( 'current' );
        }
       );
       $( '.' + $( this ).attr( 'id' ) ).show();
       $( this ).addClass( 'current' );
      }
    );

	$( '.tab-content' ).find('.btn:first').click();

	$('.tab-content a.link').each(function() { 
		if( $(this).parents( '.inner' ).html() != null ) {
			var className = $(this).parents( '.inner' ).attr( 'class' ).replace( /(\ )*inner(\ )*/, '');
			link = $(this).attr( 'href' ) + '&btn=' + className;
			$(this).attr('href', link);
		}
	})
});

PageStatus.ActionData.AddAction( 'btn', function( id ) { $( '#' + id ).click(); });
/* ------------------------------------------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------------------------------------------ */
/*
function spreadSort( a, b ) {
 var aS = a.innerHTML;
 var bS = b.innerHTML;
 if( !aS || !bS ) return 0;

 function clearValue( value ) {
  value = Number( value.replace( /[\s\*]+/gi , '' ) );
  return value;
 }

 function clearArrayValues( array ) {
  if( !( array instanceof Array ) ) return array;
  var result = new Array();
  for( var i = 0; i < array.length; i++ ) {
   result[ i ] = clearValue( array[ i ] );
  }
  return result;
 }
 
 var aP = clearArrayValues( aS.split( 'вЂ“' ) );
 var bP = clearArrayValues( bS.split( 'вЂ“' ) );
 
 if ( aP[ 0 ] < bP[ 0 ] ) return -1 * order;
 if ( aP[ 0 ] > bP[ 0 ] ) return 1 * order;
 
 if( bP[ 1 ] == undefined ) return -1 * order;
 if( aP[ 1 ] == undefined ) return 1 * order;
 
 if ( aP[ 1 ] < bP[ 1 ] ) return -1 * order;
 if ( aP[ 1 ] > bP[ 1 ] ) return 1 * order;

 return 0;
}
*/
/* ------------------------------------------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------------------------------------------ */
/*
$(function(){
 new TableSortable( 'tradersStats1', [
  { 'idx': 0, 'type': 'string' },
  { 'idx': 1, 'handler': spreadSort },
  { 'idx': 2, 'type': 'string' },
  { 'idx': 3, 'type': 'string' },
  { 'idx': 4, 'type': 'int' },
  { 'idx': 5, 'type': 'int' },
  { 'idx': 6, 'type': 'int' },
  { 'idx': 7, 'type': 'int' }
 ]);
  
 new TableSortable( 'tradersStats2', [
  { 'idx': 0, 'type': 'string' },
  { 'idx': 1, 'handler': 'string' },
  { 'idx': 2, 'type': spreadSort },
  { 'idx': 3, 'type': 'float' },
  { 'idx': 4, 'type': 'int' },
  { 'idx': 5, 'type': 'int' },
  { 'idx': 6, 'type': 'int' },
  { 'idx': 7, 'type': 'int' }
 ]);

 new TableSortable( 'tradersStats4', [
  { 'idx': 0, 'type': 'string' },
  { 'idx': 1, 'handler': spreadSort },
  { 'idx': 2, 'type': 'string' },
  { 'idx': 3, 'type': 'int' },
  { 'idx': 4, 'type': 'int' },
  { 'idx': 5, 'type': 'int' },
  { 'idx': 6, 'type': 'int' },
  { 'idx': 7, 'type': 'int' },
  { 'idx': 8, 'type': 'int' }
 ]);
  
 new TableSortable( 'tradersStats102', [
  { 'idx': 0, 'type': 'string' },
  { 'idx': 1, 'handler': spreadSort },
  { 'idx': 2, 'type': 'string' },
  { 'idx': 3, 'type': 'int' },
  { 'idx': 4, 'type': 'int' },
  { 'idx': 5, 'type': 'int' },
  { 'idx': 6, 'type': 'int' },
  { 'idx': 7, 'type': 'int' },
  { 'idx': 8, 'type': 'int' }
 ]);
  
 new TableSortable( 'tradersStats202', [
  { 'idx': 0, 'type': 'string' },
  { 'idx': 1, 'handler': spreadSort },
  { 'idx': 2, 'type': 'string' },
  { 'idx': 3, 'type': 'int' },
  { 'idx': 4, 'type': 'int' },
  { 'idx': 5, 'type': 'int' },
  { 'idx': 6, 'type': 'int' },
  { 'idx': 7, 'type': 'int' },
  { 'idx': 8, 'type': 'int' }
 ]);
  
 new TableSortable( 'tradersStats11', [
  { 'idx': 0, 'type': 'string' },
  { 'idx': 1, 'handler': spreadSort },
  { 'idx': 2, 'type': 'int' },
  { 'idx': 3, 'type': 'int' },
  { 'idx': 4, 'type': 'int' },
  { 'idx': 5, 'type': 'int' },
  { 'idx': 6, 'type': 'int' },
  { 'idx': 7, 'type': 'float' },
  { 'idx': 8, 'type': 'float' }
 ]);
  
 new TableSortable( 'tradersStats12', [
  { 'idx': 0, 'type': 'string' },
  { 'idx': 1, 'handler': spreadSort },
  { 'idx': 2, 'type': 'int' },
  { 'idx': 3, 'type': 'int' },
  { 'idx': 4, 'type': 'int' },
  { 'idx': 5, 'type': 'int' },
  { 'idx': 6, 'type': 'int' },
  { 'idx': 7, 'type': 'float' },
  { 'idx': 8, 'type': 'float' }
 ]);

});
*/
