function formatLeft(n_cast, n_orig){
	//Regresa el estilo del color indicado justificando a las izquierda
	if(n_orig.indexOf('<!--01-->') > 1)
		return 'alza';
	if(n_orig.indexOf('<!--02-->') > 1)
		return 'baja';
	if(n_orig.indexOf('<!--00-->') > 1)
		return 'igual';
	if(n_orig.indexOf('<!--11-->') > 1)
		return 'cierrealza';
	if(n_orig.indexOf('<!--12-->') > 1)
		return 'cierrebaja';
	if(n_orig.indexOf('<!--10-->') > 1)
		return 'cierreigual';
	if(n_orig.indexOf('<!--04-->') > 1)
		return 'sinoperar';	
	if(n_orig.indexOf('<!--05-->') > 1)
		return 'postura';	
	return null;	
}

function formatRight(n_cast, n_orig){
	//Regresa el estilo del color indicado justificando a las izquierda
	if(n_orig.indexOf('<!--01-->') > 1)
		return 'alzar';
	if(n_orig.indexOf('<!--02-->') > 1)
		return 'bajar';
	if(n_orig.indexOf('<!--00-->') > 1)
		return 'igualr';
	if(n_orig.indexOf('<!--11-->') > 1)
		return 'cierrealzar';
	if(n_orig.indexOf('<!--12-->') > 1)
		return 'cierrebajar';
	if(n_orig.indexOf('<!--10-->') > 1)
		return 'cierreigualr';
	if(n_orig.indexOf('<!--04-->') > 1)
		return 'sinoperarr';	
	if(n_orig.indexOf('<!--05-->') > 1)
		return 'posturar';	
	return null;	
}

function sortByQuality (a){
	//Regresa la prioridad del estado
	if(a.indexOf('status01') > 1)
		return 0;
	if(a.indexOf('status00') > 1)
		return 1;
	if(a.indexOf('status02') > 1)
		return 2;
	if(a.indexOf('status11') > 1)
		return 3;
	if(a.indexOf('status10') > 1)
		return 4;
	if(a.indexOf('status12') > 1)
		return 5;
	if(a.indexOf('status04') > 1)
		return 6;
	if(a.indexOf('status05') > 1)
		return 7;
	return null;	
}

var TABLE_MUESTRA_IPC = [
	{
		'name' : 'Instrumento', // columns titles
		'type' : STR, // standard types (STR, NUM) or custom compare function		
		'format' : formatLeft
	},
	{
		'name' : ' ', // columns titles
		'type' : sortByQuality // standard types (STR, NUM) or custom compare function		
	},
	{
		'name' : 'Hora', // columns titles
		'type' : DATE, // standard types (STR, NUM) or custom compare function		
		'format' : formatRight
	},
	{
		'name' : '&Uacute;ltimo', // columns titles
		'type' : CURRENCY, // standard types (STR, NUM) or custom compare function		
		'format' : formatRight
	},
	{
		'name' : 'Anterior', // columns titles
		'type' : CURRENCY, // standard types (STR, NUM) or custom compare function		
		'format' : formatRight
	},	
	{
		'name' : 'Variaci&oacute;n', // columns titles
		'type' : CURRENCY, // standard types (STR, NUM) or custom compare function		
		'format' : formatRight
	},
	{
		'name' : 'Var&#37;', // columns titles
		'type' : CURRENCY, // standard types (STR, NUM) or custom compare function		
		'format' : formatRight
	},
	{
		'name' : 'M&aacute;ximo', // columns titles
		'type' : CURRENCY, // standard types (STR, NUM) or custom compare function		
		'format' : formatRight
	},
	{
		'name' : 'M&iacute;nimo', // columns titles
		'type' : CURRENCY, // standard types (STR, NUM) or custom compare function		
		'format' : formatRight
	},
	{
		'name' : 'Volumen', // columns titles
		'type' : CURRENCY, // standard types (STR, NUM) or custom compare function		
		'format' : formatRight
	}
	
];

var TABLE_MAYORES_CAMBIOS = [
	{
		'name' : 'Instrumento', // columns titles
		'type' : STR, // standard types (STR, NUM) or custom compare function		
		'format' : formatLeft
	},	
	{
		'name' : ' ', // columns titles
		'type' : sortByQuality // standard types (STR, NUM) or custom compare function				
	},
	{
		'name' : '&Uacute;ltimo', // columns titles
		'type' : CURRENCY, // standard types (STR, NUM) or custom compare function		
		'format' : formatRight
	},
	{
		'name' : 'Anterior', // columns titles
		'type' : CURRENCY, // standard types (STR, NUM) or custom compare function		
		'format' : formatRight
	},
	{
		'name' : 'Variaci&oacute;n', // columns titles
		'type' : CURRENCY, // standard types (STR, NUM) or custom compare function	
		'format' : formatRight
	},
	{
		'name' : 'Var&#37;', // columns titles
		'type' : CURRENCY, // standard types (STR, NUM) or custom compare function		
		'format' : formatRight
	}
];


var TABLE_MAS_NEGOCIADAS = [
	{
		'name' : 'Instrumento', // columns titles
		'type' : STR, // standard types (STR, NUM) or custom compare function		
		'format' : formatLeft
	},	
	{
		'name' : ' ', // columns titles
		'type' : sortByQuality // standard types (STR, NUM) or custom compare function		
	},
	{
		'name' : 'Volumen', // columns titles
		'type' : CURRENCY, // standard types (STR, NUM) or custom compare function
		'format' : formatRight
	},
	{
		'name' : 'Importe', // columns titles
		'type' : CURRENCY, // standard types (STR, NUM) or custom compare function
		'format' : formatRight
	}
];

var TABLE_INDICES_INTERNACIONALES_SD = [
	{
		'name' : 'Instrumento', // columns titles
		'type' : STR, // standard types (STR, NUM) or custom compare function
		'format' : formatLeft
	},	
	{
		'name' : ' ', // columns titles
		'type' : sortByQuality // standard types (STR, NUM) or custom compare function		
	},
	{
		'name' : 'Hora', // columns titles
		'type' : DATE, // standard types (STR, NUM) or custom compare function
		'format' : formatRight
	},
	{
		'name' : '&Uacute;ltimo', // columns titles
		'type' : CURRENCY, // standard types (STR, NUM) or custom compare function
		'format' : formatRight
	},
	{
		'name' : 'Variaci&oacute;n', // columns titles
		'type' : CURRENCY, // standard types (STR, NUM) or custom compare function
		'format' : formatRight
	}
];

var TABLE_DOLAR_INTERBANCARIO_SD = [
	{
		'name' : 'Instrumento', // columns titles
		'type' : STR, // standard types (STR, NUM) or custom compare function		
		'format' : formatLeft
	},
	{
		'name' : ' ', // columns titles
		'type' : sortByQuality // standard types (STR, NUM) or custom compare function		
	},
	{
		'name' : 'Hora', // columns titles
		'type' : DATE, // standard types (STR, NUM) or custom compare function		
		'format' : formatRight,
		'format_output': 'HH:ii'
	},
	{
		'name' : 'Compra', // columns titles
		'type' : CURRENCY, // standard types (STR, NUM) or custom compare function		
		'format' : formatRight
	},
	{
		'name' : 'Venta', // columns titles
		'type' : CURRENCY, // standard types (STR, NUM) or custom compare function		
		'format' : formatRight
	}
];


// structure that describes visual aspects of the table
var TABLE_LOOK = {
	// 0 - caption,
	// 1 - header rows to be skipped at the top when applying effects,
	// 2 - body,
	// 3 - footer rows to be skipped at the bottom when applying effects,
	// 4 - paging,
	// 5 - filters
	'onclick' : function (a_row, a_marked) {		
		var o_form = document.forms.myForm
		o_form.row.value = a_row.join(', ')
		o_form.ind.value = a_marked.join(', ')
	},
	'key' : 0,
	'multy_mark' : true,
	'structure' : [0, 1, 2, 3, 4, 5],
	'params' : [1, 0], // [cellpadding,cellspacing]
	'colors' : {
		'even'    : 'white',
		'odd'     : '#f1f5e1',
		'hovered' : '#f0f0f0',
		'marked'  : '#ffcc66'
	},
	'freeze' : [0, 0], // how many rows to skip [at_the_top, at_the_bottom] when applying effects
	'paging' : {
		'by' : 10, // page size (0 - no paging)
		'tt' : '&nbsp;P&aacute;gina %ind de %pgs&nbsp;' /* in this line you can use the following variables 1-bazed:
													%pgs total pages index
													%ind current page index
													%rcs total records found
												*/
	},
	'sorting' : {
		// HTML for ascending sorted state icon
		//'as' : '<img src=http://impreso.elfinanciero.com.mx/WebV4Data/tables/scripts/ttp_files/img/asc.gif border=0 height=4 width=8 alt="sort descending">',
		// HTML for descending sorted state icon
		//'ds' : '<img src=http://impreso.elfinanciero.com.mx/WebV4Data/tables/scripts/ttp_files/img/desc.gif border=0 height=4 width=8 alt="sort ascending">',
		//'no' : '<img src=http://impreso.elfinanciero.com.mx/WebV4Data/tables/scripts/ttp_files/img/asds.gif border=0 height=9 width=8 alt="sort ascending">'
	},
	'filter' : {
		// filter 0 - off, 1 - substring, 2 - match, 4 - regexp filter, 8 - substring case insensitive (e.g. 1 + 2 + 4 + 8 means all filters on)
		'type' : 15, 
		'btn_ok' : '&nbsp;<img src=http://impreso.elfinanciero.com.mx/WebV4Data/tables/scripts/ttp_files/img/yes.gif width="16" height="16" border=0 alt="Aplicar filtro" align="absmiddle">',
		'btn_no' : '<img src=http://impreso.elfinanciero.com.mx/WebV4Data/tables/scripts/ttp_files/img/no.gif width="16" height="16" border=0 alt="Limpiar filtro" align="absmiddle">'
	},
	'css' : {
		'main'     : 'tabTable',
		'body'     : ['tabBodyCol0','tabBodyCol1','tabBodyCol2','tabBodyCol3','tabBodyCol4','tabBodyCol5','tabBodyCol6','tabBodyCol7','tabBodyCol8','tabBodyCol9'],
		'captCell' : 'tabCaptionCell',
		'captText' : 'tabCaptionLink',
		'head'     : 'tabHeadCell',
		'foot'     : 'tabFootCell',
		'pagnCell' : 'tabPaging',
		'pagnText' : 'tabPagingText',
		'pagnPict' : 'tabPagingArrowCell',
		'filtCell' : 'tabFilter',
		'filtPatt' : 'tabFilterPattern',
		'filtSelc' : 'tabFilterSelect'
	}
};

// structure that describes visual aspects of the table
var TABLE_LOOK_SMALL = {
	// 0 - caption,
	// 1 - header rows to be skipped at the top when applying effects,
	// 2 - body,
	// 3 - footer rows to be skipped at the bottom when applying effects,
	// 4 - paging,
	// 5 - filters
	'onclick' : function (a_row, a_marked) {		
		var o_form = document.forms.myForm
		o_form.row.value = a_row.join(', ')
		o_form.ind.value = a_marked.join(', ')
	},
	'key' : 0,
	'multy_mark' : true,
	'structure' : [0, 1, 2, 3, 4],
	'params' : [1, 0], // [cellpadding,cellspacing]
	'colors' : {
		'even'    : 'white',
		'odd'     : '#f1f5e1',
		'hovered' : '#f0f0f0',
		'marked'  : '#ffcc66'
	},
	'freeze' : [0, 0], // how many rows to skip [at_the_top, at_the_bottom] when applying effects
	'paging' : {
		'by' : 20, // page size (0 - no paging)
		'tt' : '&nbsp;P&aacute;gina %ind de %pgs&nbsp;' /* in this line you can use the following variables 1-bazed:
													%pgs total pages index
													%ind current page index
													%rcs total records found
												*/
	},
	'sorting' : {
		// HTML for ascending sorted state icon
		//'as' : '<img src=http://impreso.elfinanciero.com.mx/WebV4Data/tables/scripts/ttp_files/img/asc.gif border=0 height=4 width=8 alt="sort descending">',
		// HTML for descending sorted state icon
		//'ds' : '<img src=http://impreso.elfinanciero.com.mx/WebV4Data/tables/scripts/ttp_files/img/desc.gif border=0 height=4 width=8 alt="sort ascending">',
		//'no' : '<img src=http://impreso.elfinanciero.com.mx/WebV4Data/tables/scripts/ttp_files/img/asds.gif border=0 height=9 width=8 alt="sort ascending">'
	},
	'filter' : {
		// filter 0 - off, 1 - substring, 2 - match, 4 - regexp filter, 8 - substring case insensitive (e.g. 1 + 2 + 4 + 8 means all filters on)
		'type' : 15, 
		'btn_ok' : '&nbsp;<img src=http://impreso.elfinanciero.com.mx/WebV4Data/tables/scripts/ttp_files/img/yes.gif width="16" height="16" border=0 alt="Aplicar filtro" align="absmiddle">',
		'btn_no' : '<img src=http://impreso.elfinanciero.com.mx/WebV4Data/tables/scripts/ttp_files/img/no.gif width="16" height="16" border=0 alt="Limpiar filtro" align="absmiddle">'
	},
	'css' : {
		'main'     : 'tabTableSmall',
		'body'     : ['tabBodyCol0','tabBodyCol1','tabBodyCol2','tabBodyCol3','tabBodyCol4','tabBodyCol5','tabBodyCol6','tabBodyCol7','tabBodyCol8','tabBodyCol9'],
		'captCell' : 'tabCaptionCell',
		'captText' : 'tabCaptionLink',
		'head'     : 'tabHeadCell',
		'foot'     : 'tabFootCell',
		'pagnCell' : 'tabPaging',
		'pagnText' : 'tabPagingText',
		'pagnPict' : 'tabPagingArrowCell',
		'filtCell' : 'tabFilter',
		'filtPatt' : 'tabFilterPattern',
		'filtSelc' : 'tabFilterSelect'
	}
};

// structure that describes visual aspects of the table
var TABLE_LOOK_MEDIUM = {
	// 0 - caption,
	// 1 - header rows to be skipped at the top when applying effects,
	// 2 - body,
	// 3 - footer rows to be skipped at the bottom when applying effects,
	// 4 - paging,
	// 5 - filters
	'onclick' : function (a_row, a_marked) {		
		var o_form = document.forms.myForm
		//o_form.row.value = a_row.join(', ')
		//o_form.ind.value = a_marked.join(', ')
	},
	'key' : 0,
	'multy_mark' : true,
	'structure' : [0, 1, 2, 3, 4],
	'params' : [1, 0], // [cellpadding,cellspacing]
	'colors' : {
		'even'    : 'white',
		'odd'     : '#f1f5e1',
		'hovered' : '#f0f0f0',
		'marked'  : '#ffcc66'
	},
	'freeze' : [0, 0], // how many rows to skip [at_the_top, at_the_bottom] when applying effects
	'paging' : {
		'by' : 20, // page size (0 - no paging)
		'tt' : '&nbsp;P&aacute;gina %ind de %pgs&nbsp;' /* in this line you can use the following variables 1-bazed:
													%pgs total pages index
													%ind current page index
													%rcs total records found
												*/
	},
	'sorting' : {
		// HTML for ascending sorted state icon
		//'as' : '<img src=http://impreso.elfinanciero.com.mx/WebV4Data/tables/scripts/ttp_files/img/asc.gif border=0 height=4 width=8 alt="sort descending">',
		// HTML for descending sorted state icon
		//'ds' : '<img src=http://impreso.elfinanciero.com.mx/WebV4Data/tables/scripts/ttp_files/img/desc.gif border=0 height=4 width=8 alt="sort ascending">',
		//'no' : '<img src=http://impreso.elfinanciero.com.mx/WebV4Data/tables/scripts/ttp_files/img/asds.gif border=0 height=9 width=8 alt="sort ascending">'
	},
	'filter' : {
		// filter 0 - off, 1 - substring, 2 - match, 4 - regexp filter, 8 - substring case insensitive (e.g. 1 + 2 + 4 + 8 means all filters on)
		'type' : 1, 
		'btn_ok' : '&nbsp;<img src=http://impreso.elfinanciero.com.mx/WebV4Data/tables/scripts/ttp_files/img/yes.gif width="16" height="16" border=0 alt="Aplicar filtro" align="absmiddle">',
		'btn_no' : '<img src=http://impreso.elfinanciero.com.mx/WebV4Data/tables/scripts/ttp_files/img/no.gif width="16" height="16" border=0 alt="Limpiar filtro" align="absmiddle">'
	},
	'css' : {
		'main'     : 'tabTableMedium',
		'body'     : ['tabBodyCol0','tabBodyCol1','tabBodyCol2','tabBodyCol3','tabBodyCol4','tabBodyCol5','tabBodyCol6','tabBodyCol7','tabBodyCol8','tabBodyCol9'],
		'captCell' : 'tabCaptionCell',
		'captText' : 'tabCaptionLink',
		'head'     : 'tabHeadCell',
		'foot'     : 'tabFootCell',
		'pagnCell' : 'tabPaging',
		'pagnText' : 'tabPagingText',
		'pagnPict' : 'tabPagingArrowCell',
		'filtCell' : 'tabFilter',
		'filtPatt' : 'tabFilterPattern',
		'filtSelc' : 'tabFilterSelect'
	}
};
