// JavaScript Document
<!--

// variaveis globais
  var g_cdlinha;
  var g_direstampa;
  var g_dirproduto;
  var g_dirbotoes;
// tabela de produtos
  var produtos;
  var qtprod;


String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g,"");
}


function MM_prepareTable( xcodigo ) { //v1.0
// Pode ser g_cdlinha - informar a letra correspondente a linha de produto ( C L M T H )
// Pode ser xcdestampa - informar XXXX para a estampa

// Tamanho das imagens no menu
  var ImgA = "60";
  var ImgL = "60";

// Qtde Máxima de Colunas na Tabela.
  var ColMax = 5;

  // Obter dados de produto para  g_estampa especifica
  if ( xcodigo.length > 1 ) {
    var kSel = 0;
    for ( k = 0; k < QtProd; k++ ) {
	   g_estampa = produtos[k].substring( 0, 4 );
      if (  g_estampa.indexOf( xcodigo ) >=0 ) { kSel = k  };
      } // for
    return produtos[kSel];
    } ;

  // carregar tabelas de produtos
  produtos = new Array();
  if      ( xcodigo == 'P' ) MM_prepml( produtos )
  else if ( xcodigo == 'B' ) MM_preprk( produtos )
  else MM_prepcart ( produtos ) ;
  QtProd = produtos.length;

// tratamento das importadas !
  var BaseCartNacional = 'MXU' ;
  var CartImport = 0 ;
  if ( xcodigo == 'I' ) { xcodigo = 'C'; CartImport = 1 } ;
  g_cdlinha = xcodigo ;

// diretorio de imagens
  g_dirbotoes = 'imagens/estampas/';
  if ( g_cdlinha == 'P' ) {
     g_direstampa = 'imagens/ml/';
	 g_dirproduto = 'imagens/ml/'; }
  else if ( g_cdlinha == 'B' ) {
     g_direstampa = 'imagens/rk/';
	 g_dirproduto = 'imagens/rk/'; }
  else {
     g_direstampa = 'imagens/estampas/';
	 g_dirproduto = 'imagens/produtos/'; };

// Váriaveis para definir a tabela
  var mxC = ColMax;   // Máximo de Colunas
  var ixK ;           // Preparar a tabela
  var ixC ;           // Preparar a tabela
  var tabela = "";
  var trecho;
  var TecImport;
  var xtemprod;
  var xcdpreco;
  var xestampa;

// Texto daTabela
  tabela = tabela + '<table border="0" align="left">';
  ixC = 0;
  for ( ixK = 0; ixK < QtProd; ixK++ ) {
    xtemprod = produtos[ixK].substring( 7, 11 );
    xcdpreco = produtos[ixK].substring( 5,  6 );
    TecImport = ( BaseCartNacional.indexOf (xcdpreco) >= 0 ) ? 0 : 1 ;
    //if ( ixK < 5 ) { alert ( 'xtemprod:' + xtemprod + ': xcdpreco:' + xcdpreco + ': tecimp:' + TecImport + ': CI:' + CartImport) };
    if ( g_cdlinha != 'P' && g_cdlinha != 'B' && xtemprod.indexOf( g_cdlinha ) < 0 ) continue ;
    if ( g_cdlinha == 'C' ) { if ( CartImport != TecImport ) { continue } };

	// inicialia linha
	if ( ixC == 0 ) { tabela += '<tr>' };

    // incluir picture
	xestampa = produtos[ixK].substring( 0, 4 ) ;
    xlitestampa = "'" + MM_litEstampa( xestampa, 'S' ) + "'";
    trecho = '<td>' ;
    trecho += '<img src="' + g_direstampa +  xestampa + '.jpg"';

    if ( g_cdlinha == 'P' || g_cdlinha == 'B') {
       trecho += ' onClick="MM_prepareML(' + "'" + xestampa + "'" + ')"' }
    else {
       trecho += ' onClick="MM_prepareProd(' + "'" + xestampa + "'" + ')"' } ;

    trecho += ' onMouseOver="MM_statusProd(' + xlitestampa + ')"' ;
    trecho += ' alt="' + MM_litEstampa( xestampa, 'S' ) + '"';
	trecho += ' width=' + ImgL + ' height=' + ImgA + ' border=0>';
    trecho += '</td>' ;
	//alert( trecho );

    tabela = tabela + trecho;
    //alert( tabela );
	ixC++;
	if ( ixC >= mxC || ixK >= QtProd ) { ixC = 0 ; tabela += '</tr>'; };
    }; // for ixK

  tabela += '</table>';
  //alert( tabela );
  return tabela;
}

function MM_statusProd( xEstampa ) { //v1.0
  status = ( " Thais Kato - ORIGAMI em TECIDO - " + xEstampa );
  document.MM_returnValue = true;
}

function MM_litEstampa( xcdestampa, flag ) { //v1.0
  var xLit = (flag == 'S')? 'Estampa ' : '';
  xLit += xcdestampa;
  if ( g_cdlinha == 'P' || g_cdlinha == 'B') {
    var xlittipo = MM_litVariado( xcdestampa );
    xLit += ( xlittipo == '' ) ? '' : ': ' + xlittipo;
    }
  return xLit;
}

function MM_litVariado( xcdestampa ) { //v1.0
  var xLit = '';
  if ( g_cdlinha == 'P' || g_cdlinha == 'B') {
    var xSufixo = xcdestampa.substr(2);
    if      ( xSufixo == 'IM' ) xLit += 'Importadas'
    else if ( xSufixo == 'MS' ) xLit += 'Variadas'
    else if ( xSufixo == 'AM' ) xLit += 'Tons Amarelos'
    else if ( xSufixo == 'AZ' ) xLit += 'Tons Azuis'
    else if ( xSufixo == 'LI' ) xLit += 'Tons Lilases'
    else if ( xSufixo == 'PB' ) xLit += 'Tons Brancos e Pretos'
    else if ( xSufixo == 'RS' ) xLit += 'Tons de Rosa'
    else if ( xSufixo == 'VM' ) xLit += 'Tons Vermelhos'
    else if ( xSufixo == 'VD' ) xLit += 'Tons Verdes'
    }
  return xLit;
}


function MM_prepareProd( xcdestampa ) { //v1.0
  var xrecprod = MM_prepareTable( xcdestampa + '' ) ;
  var xtemprod = xrecprod.substring( 7, 11 );
  var xcdpreco = xrecprod.substring( 5,  6 );

  var ordem = 'CMHLTK' ;
  if      ( g_cdlinha == 'C' ) { ordem = 'CMHLTK' }
  else if ( g_cdlinha == 'M' ) { ordem = 'MCHLTK' }
  else if ( g_cdlinha == 'H' ) { ordem = 'HMCLTK' }
  else if ( g_cdlinha == 'L' ) { ordem = 'LCHMTK' }
  else if ( g_cdlinha == 'T' ) { ordem = 'TMCHLK' }
  var qtordem = ordem.length ;

  var itens = '';
  itens += '<table border="2" cellspacing="10">'

  var ixZ = 0;
  var ixC = 0;
  var xcdlinha ;
  for ( ixZ = 0 ; ixZ < qtordem ; ixZ ++ ) {
    xcdlinha = ordem.substr(ixZ,1);
    if ( xtemprod.indexOf(xcdlinha) >= 0 ) {
	   if ( ixC == 0 ) { itens += '<tr>' };
	   itens += MM_prepareItem( xcdlinha,xcdpreco,xtemprod,xcdestampa );
  	   ixC ++ ;
	   if ( ixC > 1 || ixZ >= qtordem) { itens += '</tr>'; ixC = 0 }
	   };
     }; // for
  itens += '</table>'
  //alert('ITENS:'+itens);
  document.getElementById("itens").innerHTML=itens;
  window.scrollTo(0,0);
}

function MM_prepareItem( xcdlinha,xcdpreco,xtemprod,xcdestampa ) { //v1.0
//  alert( '1 PrepareItem:' + xcdlinha + ':' + xg_cdpreco ) ;
  var LinItem = '' ; // inclusive o K
  var tipojpg = '';
  LinItem += '<td align="left" width="300">'
  LinItem += '<div class="produtonome">';
  LinItem += xcdlinha + '-' +  xcdestampa + ' ' ;
  LinItem += MM_ObterNome( xcdlinha, xtemprod, true );
  LinItem += '</div>';

  if      ( xcdlinha == 'C' ) { tipojpg = '33' }
  else if ( xcdlinha == 'T' ) { tipojpg = '44' } 
  else if ( xcdlinha == 'M' ) { tipojpg = '55' } ;

  var nomejpg = g_dirproduto + xcdestampa + tipojpg + '.jpg';
  var vg = "','";
  //alert ('2 '+xcdlinha+'-'+nomejpg);

  aspProd  =  "'" + xcdlinha + "'" ;
  aspParm1 =  "'" + xcdestampa + vg + xcdlinha + vg + xcdpreco + vg + xtemprod + "',''" ;

  LinItem += '<div style="margin:0; padding-top:2; padding-bottom:6">' ;
  if ( tipojpg !== '' ) { LinItem += '<img src="' + nomejpg + '">' };
  LinItem += '</div>' ;

  LinItem += '<div style="display:block; padding-top:2px;">' ;  // Preço e Btn
  LinItem += '<div style="float:right">' ;  // Preço e Descricao
  LinItem += '<div class="btncomprar">' ;

  LinItem += '<img src="' + g_dirbotoes + 'BtnComprar.jpg" width="110" height="28" ' ;
  LinItem += 'id="BtnComp' + xcdlinha + '" ';
  LinItem += 'onMouseOver="return MM_upBtn(' + aspProd + ')" ' ;
  LinItem += 'onMouseOut="return MM_Btn(' + aspProd + ')" ' ;
  LinItem += 'onMouseDown="return MM_downBtn(' + aspProd + ')" ' ;
  LinItem += 'onMouseUp="return MM_Btn(' + aspProd + ')" ' ;
  LinItem += 'onClick="return MM_Form(' + aspParm1 + ')">' ;

  LinItem += '</div>' ;
  LinItem += '</div>' ;
  LinItem += '</div>' ;

  LinItem += '<div class="produtosubtit">Pre&ccedil;o: </div>' ;
  LinItem += '<div class="produtodescr">';
  var Preco = MM_Preco( xcdlinha, xcdpreco, xtemprod, '', 'S' ) ;
  if ( Preco == '' ) { LinItem = LinItem + 'Favor consultar o Atendimento' ; }
  else { LinItem = LinItem + 'R$ ' + Preco ; }
  LinItem += '</div>' ;

  LinItem += '<div class="produtosubtit">';
  LinItem += 'Material</div>';
  LinItem += '<div class="produtodescr">';
  if      ( xcdpreco == 'I' ) { LinItem += 'algod&atilde;o nacional' }
  else if ( xcdpreco == 'B' ) { LinItem += 'algod&atilde;o nacional tradicional' }
  else if ( xcdpreco == 'L' ) { LinItem += 'algod&atilde;o nacional de padr&otilde;es selecionados' }
  else if ( xcdpreco == 'M' ) { LinItem += 'algod&atilde;o nacional de padr&otilde;es selecionados' }
  else if ( xcdpreco == 'X' ) { LinItem += 'algod&atilde;o nacional com texturas e padr&otilde;es selecionados' }
  else if ( xcdpreco == 'U' ) { LinItem += 'algod&atilde;o nacional com texturas e padr&otilde;es especiais' }
  else if ( xcdpreco == 'S' ) { LinItem += 'algod&atilde;o importado.' }
  else if ( xcdpreco == 'T' ) { LinItem += 'algod&atilde;o proveniente do Jap&atilde;o, EUA ou Europa' }
  else if ( xcdpreco == 'H' ) { LinItem += 'algod&atilde;o selecionado proveniente do Jap&atilde;o, EUA ou Europa' }
  else if ( xcdpreco == 'J' ) { LinItem += 'algod&atilde;o proveniente do Jap&atilde;o ou Inglaterra' }
  else if ( xcdpreco == 'E' ) { LinItem += 'algod&atilde;o proveniente do Jap&atilde;o ou Inglaterra' }
  else if ( xcdpreco == 'P' ) { LinItem += 'algod&atilde;o proveniente do Jap&atilde;o ou Inglaterra' }
  else if ( xcdpreco == 'G' ) { LinItem += 'algod&atilde;o proveniente do Jap&atilde;o ou Inglaterra' }
  LinItem += '</div>' ;

  LinItem += '<div class="produtosubtit">';
  LinItem += 'Tamanho (LxA)</div>';
  LinItem += '<div class="produtodescr">';
  if      ( xcdlinha == 'C' ) { LinItem += '100 mm x 90 mm (Carteira Fechada)' }
  else if ( xcdlinha == 'M' ) { LinItem += '70 mm x 70 mm' }
  else if ( xcdlinha == 'H' ) { LinItem += 'Em caixa com 100 mm x 100 mm x 40mm' }
  else if ( xcdlinha == 'L' ) { LinItem += '85 mm x 120 mm' }
  else if ( xcdlinha == 'T' ) { LinItem += '100 mm x 80 mm' }
  else if ( xcdlinha == 'K' ) { LinItem += 'Ver itens individuais' } ;
  LinItem += '</div>' ;
  LinItem += '<br>'
  LinItem += '</td>'
  // alert(LinItem);
return LinItem ;
}

function MM_prepareML( xcdestampa ) { //v1.0
  var xrecprod = MM_prepareTable( xcdestampa + '' ) ;
  var xqualkit = xrecprod.substring( 7, 12 );
  var xcdpreco = xrecprod.substring( 5,  6 );
  //alert( xcdestampa );

  var LinML = '' ;
  LinML += '<table border="2" cellspacing="10">';
  LinML += '<tr>';
  LinML += '<td align="left" valign="top" width="300">'

  LinML += '<div class="produtonome">';
  LinML += g_cdlinha + '-' +  xcdestampa + ' ' ;
  LinML += MM_ObterNome( g_cdlinha, xqualkit, true );
  LinML += '</div>';

  var tipojpg = '';
  if      ( g_cdlinha == 'P' ) { tipojpg = '77' }
  else if ( g_cdlinha == 'B' ) { tipojpg = '88' } ;

  var nomejpg = g_dirproduto + xcdestampa + tipojpg + '.jpg';
  var vg = "','";
  //alert ('2 '+xProduto+'-'+nomejpg);

  LinML += '<div style="margin:0; text-align:center; padding-top:2; padding-bottom:6">' ;
  if ( tipojpg !== '' ) { LinML += '<img src="' + nomejpg + '">' };
  LinML += '</div>' ;

  LinML += '</td>' ;

  LinML += '<td align="left" valign="top" width="300">'


  LinML += '<div class="produtosubtit">';
  LinML += 'Foto Ilustrativa</div>';
  LinML += '<div class="produtodescr">';
  LinML += 'Diferen&ccedil;as de tecido, corte e sentido da dobra criam pe&ccedil;as similares e &uacute;nicas, com realces distintos.' ;
  LinML += '</div>' ;


  LinML += '<div class="produtosubtit">';
  LinML += 'Material</div>';
  LinML += '<div class="produtodescr">';

  var xTk = 'Tha&iacute;s Kato selecionar&aacute; especialmente para seu pedido';
  var xPr = '';

  if      ( g_cdlinha == 'P' ) { xPr = 'Marcadores de Livros elaborados '; }
  else if ( g_cdlinha == 'B' ) { xPr = 'Broches com Rosas de Kawasaki elaboradas '; } ;


  if      ( xcdpreco == 'I' ) {
            LinML += xTk + ' diversos ' + xPr;
            LinML += 'com tecidos de algod&atilde;o provenientes do   Jap&atilde;o, EUA e Europa.'
            }
  else if ( xcdpreco == 'T' ) {
            LinML += xTk + ' um dos ' + xPr;
            LinML += 'com tecidos nacionais de algod&atilde;o em ' + MM_litVariado( xcdestampa ) + '.'
            }
  else if ( xcdpreco == 'M' ) {
            LinML += xTk + ' um conjunto variado de ' + xPr;
            LinML += 'em diversos tecidos nacionais de algod&atilde;o.'
            }
  else if ( xcdpreco == 'U' ) {
            LinML += xPr;
            LinML += 'com tecido nacional artesanal em algod&atilde;o.'
            }
  else if ( xcdpreco == 'X' ) {
            LinML += xPr;
            LinML += 'com tecido importado de algod&atilde;o.'
            }

  LinML += '</div>' ;

  LinML += '<div class="produtosubtit">';
  LinML += 'Tamanho (LxA)</div>';
  LinML += '<div class="produtodescr">';
  if      ( g_cdlinha == 'P' ) { LinML += '90 mm x 90 mm' }
  else if ( g_cdlinha == 'B' ) { LinML += '40 mm x 40 mm' } ;
  LinML += '</div>' ;

  if ( g_cdlinha == 'P' ) {
    LinML += '<div class="produtosubtit">';
    LinML += 'Personaliza&ccedil;&atilde;o</div>';
    LinML += '<div class="produtodescr">';
    LinML += 'Para pedidos a partir de 10 Marcadores de Livro, Voc&ecirc; poder&aacute; nos enviar, por eMail, uma frase, um logo ou mesmo uma imagem a ser impressa no Cart&atilde;o de seus Marcadores de Livro.';
    LinML += '</div>' ;
    };

  var xKit = '1';

  aspProd  =  "'" + g_cdlinha + xKit + "'" ;
  aspParm1 =  "'" + xcdestampa + vg + g_cdlinha + vg + xcdpreco + vg + xqualkit + vg + xKit + "'";

  LinML += '<div style="display:block">' ;  // Preço e Btn
  LinML += '<div style="float:left display:block">' ;  // Preço e Descricao
  LinML += '<div class="btncomprar">' ;

  LinML += '<img src="' + g_dirbotoes + 'BtnComprar.jpg" width="110" height="28" ' ;
  LinML += 'id="BtnComp' + g_cdlinha + xKit + '" ';
  LinML += 'onMouseOver="return MM_upBtn(' + aspProd + ')" ' ;
  LinML += 'onMouseOut="return MM_Btn(' + aspProd + ')" ' ;
  LinML += 'onMouseDown="return MM_downBtn(' + aspProd + ')" ' ;
  LinML += 'onMouseUp="return MM_Btn(' + aspProd + ')" ' ;
  LinML += 'onClick="return MM_Form(' + aspParm1 + ')">' ;
  LinML += '</div>' ;
  LinML += '</div>' ;
  LinML += '</div>' ;

  LinML += '<div class="produtosubtit">Pre&ccedil;o: </div>' ;
  LinML += '<div class="produtodescr">';
  var Preco = MM_Preco( g_cdlinha, xcdpreco, xqualkit, xKit, 'S' ) ;
  if ( Preco == '' ) { LinML = LinML + 'Favor consultar o Atendimento' ; }
  else { LinML = LinML + 'R$ ' + Preco ; }
  LinML += '</div>' ;
  LinML += '<br>' ;

  LinML += '</tr>' ;
  LinML += '</table>' ;
  // alert(LinML);
  document.getElementById("itens").innerHTML=LinML;
  window.scrollTo(0,0);
}

function MM_nomeKit ( xKit, hifen ) {
  var xlitKit = ( hifen == 'S' ) ? ' - ': '' ;
  if      ( xKit == '1' ) { xlitKit += 'Kit Unitário' }
  else if ( xKit == '2' ) { xlitKit += 'Kit Com 2 Unidades' }
  else if ( xKit == '5' ) { xlitKit += 'Kit Com 5 Unidades' }
  else if ( xKit == 'A' ) { xlitKit += 'Kit Com 10 Unidades' }
  else if ( xKit == 'B' ) { xlitKit += 'Kit Com 20 Unidades' }
  else                    { xlitKit = '' } ;
  return xlitKit;
}

function MM_Form( xEstampa, xProduto, xcdpreco, xtemprod, xKit ) {
  //alert( xEstampa + ':' + xProduto + ':' + xcdpreco + ':' + xtemprod + ':' + xKit ) ;
  var cdprod = xProduto + xKit + '-' + MM_litEstampa( xEstampa, 'N' ) ;
  var descri = MM_ObterNome( xProduto, xtemprod, false ) + ' ' + cdprod + MM_nomeKit ( xKit, 'S' ); ;
  var valor  = MM_Preco( xProduto, xcdpreco, xtemprod, xKit,'N') ;
  document.myformdiv.item_id.value = cdprod;
  document.myformdiv.item_descr.value = descri;
  document.myformdiv.item_valor.value = valor;
  document.myformdiv.submit();
  return true;
}

function MM_ObterNome( xProduto, xtemprod, pagina ) {
  var xNome ;
  if      ( xProduto == 'C' ) { xNome = 'Carteira de Origami' }
  else if ( xProduto == 'M' ) { xNome = 'Porta-moeda de Origami' }
  else if ( xProduto == 'P' ) { xNome = 'Marcador de Livro de Origami' }
  else if ( xProduto == 'B' ) { xNome = 'Broche da Rosa de Kawasaki' }
  else if ( xProduto == 'L' ) { xNome = ( pagina ? 'Porta-len&ccedil;o de Origami' : 'Porta-lenço de Origami' ) }
  else if ( xProduto == 'T' ) { xNome = ( pagina ? 'Porta-cart&atilde;o de Origami' : 'Porta-cartão de Origami' ) }
  else if ( xProduto == 'K' ) { xNome = MM_CriaKit( xtemprod, pagina ) } ;
return xNome
}

function MM_CriaKit( xtemprod, pagina ) {
  xtemprod = xtemprod.trim();
  var ultqt = xtemprod.length - 1 ;
  var qt = 0 ;
  var texto = '' ;
  var rcTexto = '' ;

  if ( xtemprod.indexOf( 'C' ) >= 0 ) {
    qt++ ;
	if ( texto.length != 0 ) { texto += ( qt == ultqt ) ? ' e ' : ', ' ; } ;
	texto += 'Carteira' ;
    } ;
  if ( xtemprod.indexOf( 'M' ) >= 0 ) {
    qt++ ;
//	alert( 'list:' + xtemprod + ':' + texto + ':' + qt + '/' + ultqt );
	if ( texto.length != 0 ) { texto += ( qt == ultqt ) ? ' e ' : ', ' ; } ;
	texto += 'Porta-moeda' ;
//	alert( 'list:' + xtemprod + ':' + texto + ':' + qt );
    } ;
  if ( xtemprod.indexOf( 'B' ) >= 0 ) {
    qt++ ;
	if ( texto.length != 0 ) { texto += ( qt == ultqt ) ? ' e ' : ', ' ; } ;
	texto += 'Broche' ;
    } ;
  if ( xtemprod.indexOf( 'L' ) >= 0 ) {
    qt++ ;
	if ( texto.length != 0 ) { texto += ( qt == ultqt ) ? ' e ' : ', ' ; } ;
	texto += ( pagina ? 'Porta-len&ccedil;o' : 'Porta-lenço' ) ;
    } ;
  if ( xtemprod.indexOf( 'T' ) >= 0 ) {
    qt++ ;
	if ( texto.length != 0 ) { texto += ( qt == ultqt ) ? ' e ' : ', ' ; } ;
	texto += ( pagina ? 'Porta-cart&atilde;o' : 'Porta-cartão' ) ;
    } ;
  rcTexto = 'Kit ('  + texto + ') de Origami' ;
return rcTexto;
}

function MM_Preco( xcdlinha, xcdpreco, xtemprod, xkit, real ) {
  var tbp = new Array();
  if ( xcdlinha == 'P' ) {
    // TABELA DE PRECOS
    // 0123456789012
    // XP NNNNNN, onde
    //      X = cod de preco
    //      P = Quantidade do Kit
    //      NNNNNN = preco com centavos sem virgula

    // ML Importado
    tbp[tbp.length] = 'I1   1200'; //   1 Unid
    // ML Misto
    tbp[tbp.length] = 'M1   1000'; //   1 Unid
    // ML Tons
    tbp[tbp.length] = 'T1   1000'; //   1 Unid
    // ML Unicos
    tbp[tbp.length] = 'U1   1000'; //   1 Unid
    // ML Unicos Importados
    tbp[tbp.length] = 'X1   1200'; //   1 Unid
    }
  else if ( xcdlinha == 'B' ) {
    // TABELA DE PRECOS
    // 0123456789012
    // XP NNNNNN, onde
    //      X = cod de preco
    //      P = Quantidade do Kit
    //      NNNNNN = preco com centavos sem virgula

    // ML Importado
    tbp[tbp.length] = 'I1   1000'; //   1 Unid
    tbp[tbp.length] = 'I2   1800'; //   2 Unid
    tbp[tbp.length] = 'I5   4000'; //   5 Unid
    tbp[tbp.length] = 'IA   7500'; //  10 Unid
    tbp[tbp.length] = 'IB  14000'; //  20 Unid
    // ML Misto
    tbp[tbp.length] = 'M1   1000'; //   1 Unid
    tbp[tbp.length] = 'M2   1800'; //   2 Unid
    tbp[tbp.length] = 'M5   4000'; //   5 Unid
    tbp[tbp.length] = 'MA   7500'; //  10 Unid
    tbp[tbp.length] = 'MB  14000'; //  20 Unid
    // ML Tonds
    tbp[tbp.length] = 'T1   1000'; //   1 Unid
    tbp[tbp.length] = 'T2   1800'; //   2 Unid
    tbp[tbp.length] = 'T5   4000'; //   5 Unid
    tbp[tbp.length] = 'TA   7500'; //  10 Unid
    tbp[tbp.length] = 'TB  14000'; //  20 Unid
    // ML Unicos
    tbp[tbp.length] = 'U1   1000'; //   1 Unid
    tbp[tbp.length] = 'U2   1800'; //   2 Unid
    tbp[tbp.length] = 'U5   4000'; //   5 Unid
    tbp[tbp.length] = 'UA   7500'; //  10 Unid
    tbp[tbp.length] = 'UB  14000'; //  20 Unid
    }
  else {
    // xcdlinha pode ser um único ou um kit.
    // TABELA DE PRECOS
    // 0123456789012
    // XP NNNNNN, onde
    //      X = g_cdpreco de preço: (B)asico, (M)edio, Te(X)tura, (S)uperior, (T)op
    //      P = Produto: (C)arteira, porta(L)enço, porta(M)oeda, portacar(T)ão, c(H)aveiro.
    //      NNNNNN = preco com centavos sem virgula

    tbp[tbp.length] = 'MC   3500'; // Medium Carteira
    tbp[tbp.length] = 'ML   1000'; // Medium Porta-Lenco ***
    tbp[tbp.length] = 'MM   1600'; // Medium Porta-Moeda ***
    tbp[tbp.length] = 'MT   1600'; // Medium Porta-Cartao  ***
    tbp[tbp.length] = 'MH   1000'; // Medium Chaveiro ***

    tbp[tbp.length] = 'XC   4200'; // Top Carteira
    tbp[tbp.length] = 'XL   1000'; // Top Porta-Lenco ***
    tbp[tbp.length] = 'XM   1600'; // Top Porta-Moeda ***
    tbp[tbp.length] = 'XT   1600'; // Top Porta-Cartao ***
    tbp[tbp.length] = 'XH   1000'; // Top Chaveiro ***

    tbp[tbp.length] = 'UC   4900'; // Top Carteira
    tbp[tbp.length] = 'UL   1000'; // Top Porta-Lenco ***
    tbp[tbp.length] = 'UM   1600'; // Top Porta-Moeda ***
    tbp[tbp.length] = 'UT   1600'; // Top Porta-Cartao ***
    tbp[tbp.length] = 'UH   1000'; // Top Chaveiro ***

    tbp[tbp.length] = 'SC   5700'; // Superior Carteira
    tbp[tbp.length] = 'SL   1000'; // Superior Porta-Lenco  ***
    tbp[tbp.length] = 'SM   1900'; // Superior Porta-Moeda ***
    tbp[tbp.length] = 'ST   1900'; // Superior Porta-Cartao ***
    tbp[tbp.length] = 'SH   1000'; // Superior Chaveiro ***

    tbp[tbp.length] = 'TC   6400'; // Top Carteira
    tbp[tbp.length] = 'TL   1000'; // Top Porta-Lenco ***
    tbp[tbp.length] = 'TM   1900'; // Top Porta-Moeda ***
    tbp[tbp.length] = 'TT   1900'; // Top Porta-Cartao ***
    tbp[tbp.length] = 'TH   1000'; // Top Chaveiro ***

    tbp[tbp.length] = 'HC   7200'; // High Carteira
    tbp[tbp.length] = 'HL   1000'; // High Porta-Lenco ***
    tbp[tbp.length] = 'HM   1900'; // High Porta-Moeda ***
    tbp[tbp.length] = 'HT   1900'; // High Porta-Cartao ***
    tbp[tbp.length] = 'HH   1000'; // High Chaveiro ***

    tbp[tbp.length] = 'JC   8300'; // Jow Carteira
    tbp[tbp.length] = 'JL   1000'; // Jow Porta-Lenco ***
    tbp[tbp.length] = 'JM   2500'; // Jow Porta-Moeda ***
    tbp[tbp.length] = 'JT   2500'; // Jow Porta-Cartao ***
    tbp[tbp.length] = 'JH   1000'; // Jow Chaveiro ***

    tbp[tbp.length] = 'EC   9800'; // Eagle Carteira
    tbp[tbp.length] = 'EL   1000'; // Eagle Porta-Lenco ***
    tbp[tbp.length] = 'EM   2500'; // Eagle Porta-Moeda ***
    tbp[tbp.length] = 'ET   2500'; // Eagle Porta-Cartao ***
    tbp[tbp.length] = 'EH   1000'; // Eagle Chaveiro ***

    tbp[tbp.length] = 'PC  10500'; // Power Carteira
    tbp[tbp.length] = 'PL   1000'; // Power Porta-Lenco ***
    tbp[tbp.length] = 'PM   2500'; // Power Porta-Moeda ***
    tbp[tbp.length] = 'PT   2500'; // Power Porta-Cartao ***
    tbp[tbp.length] = 'PH   1000'; // Power Chaveiro ***

    tbp[tbp.length] = 'GC  14000'; // Giant Carteira
    tbp[tbp.length] = 'GL   1000'; // Giant Porta-Lenco ***
    tbp[tbp.length] = 'GM   2500'; // Giant Porta-Moeda ***
    tbp[tbp.length] = 'GT   2500'; // Giant Porta-Cartao ***
    tbp[tbp.length] = 'GH   1000'; // Giant Chaveiro ***
  };

 //alert( 'linha(' + xcdlinha + ') preco(' + xcdpreco + ') temprod(' + xtemprod + ') kit(' + xkit + ') real(' + real + ')'  ) ;

if ( xcdlinha == 'K' ) { xcdlinha = xtemprod.trim() } ;
var qt = xcdlinha.length ;
var letra ;
var Preco = 0 ;

for ( j = 0; j < qt; j++ ) {
  letra = xcdlinha.substring(j,j+1);
  if ( letra != 'K' ) {
    var Argumento = ( xcdlinha == 'P' || xcdlinha == 'B' ) ? ( xcdpreco + xkit ) : ( xcdpreco + letra ) ;
    var Chave
    for ( k = 0; k < tbp.length; k++ ) {
      Chave = tbp[k].substring( 0, 2 ) ;
//      alert( 'Arg:' + Argumento + ' Chv:'  + Chave + ' Preço:' + Preco );
      if ( Argumento == Chave ) {
	     Preco += parseInt( tbp[k].substring( 3, 9 ) ) ;
//		 alert( Preco ) ;
         break ;
         } ; // if
      } // for k
	} // if K
  } // for j
// alert('FindPreco:' + Argumento + ':' + Preco + ':' );

// Preco = '01234567' ;
var rcPreco, xPreco
if ( Preco == 0 ) { rcPreco = '' }
else {
  rcPreco = Preco + '';
  if ( real == 'S' ) {
    xPreco = rcPreco;
    rcPreco =  xPreco.substring ( 0, xPreco.length - 2 ) + ','  ;
	rcPreco += xPreco.substring ( xPreco.length - 2 , xPreco.length ) ;
    } ;
  } ; // else
// alert( rcPreco );
return rcPreco ;
}

function MM_upBtn(Let) {
//  alert('Up:'+Let);
  document.getElementById('BtnComp'+Let).src = "./" + g_dirbotoes + "BtnCompraru.jpg" ;
  return true;
}
function MM_Btn(Let) {
//  alert('Normal:'+Let);
  document.getElementById('BtnComp'+Let).src = "./" + g_dirbotoes + "BtnComprar.jpg" ;
  return true;
}
function MM_downBtn(Let) {
//   alert('Down:'+Let);
  document.getElementById('BtnComp'+Let).src = "./" + g_dirbotoes + "BtnComprard.jpg" ;
  return true;
}

function MM_prepcart ( a ) {
// TABELA DE PRODUTOS
// 12345678901234567890
// NNNN X XXXXXCCCCCCCCCC, onde
//      NNNN =  g_estampa
//      X = g_cdpreco de preço
//      XXXXX = Quais produtos (C)arteira, porta(L)enço, porta(M)oeda, portacar(T)ão, marca(P)agina.
//      CCCCCCCCCC = Cores: 0 Preto, 1 Azul, 2 Verde, 3 Amarelo, 4 Vermelho, 5 Laranja,
//                          6 Roxo, 7 Rosa, 8 Marron.
//a[a.length] = "7139 J C    "
  a[a.length] = "7143 J C    "
  a[a.length] = "7153 H C    "
  a[a.length] = "7163 E C    "
  a[a.length] = "7173 E C    "
//a[a.length] = "7247 E C    "
//a[a.length] = "7263 H C    "
  a[a.length] = "7264 J C    "
  a[a.length] = "7272 G C    "
//a[a.length] = "7275 G C    "
//a[a.length] = "7290 J C    "
  a[a.length] = "7313 J C    "
  a[a.length] = "7322 U KCM  "
//a[a.length] = "7326 U C    "
  a[a.length] = "7344 J C    "
  a[a.length] = "7348 J C    "
  a[a.length] = "7350 G C    "
//a[a.length] = "7353 E C    "
  a[a.length] = "7354 P C    "
//a[a.length] = "7358 E C    "
  a[a.length] = "7361 G C    "
//a[a.length] = "7364 P C    "
//a[a.length] = "7365 P C    "
  a[a.length] = "7367 E C    "
  a[a.length] = "7368 P C    "
  a[a.length] = "7369 G C    "
  a[a.length] = "7377 P C    "
//a[a.length] = "7388 U C    "
//a[a.length] = "7400 U C    "
  a[a.length] = "7417 G C    "
  a[a.length] = "7418 E C    "
  a[a.length] = "7419 E C    "
  a[a.length] = "7420 J C    "
  a[a.length] = "7422 E C    "
//a[a.length] = "7424 J C    "
  a[a.length] = "7426 H C    "
//a[a.length] = "7427 G C    "
  a[a.length] = "7428 P C    "
  a[a.length] = "7429 P C    "
  a[a.length] = "7430 G C    "
  a[a.length] = "7436 J C    "
//a[a.length] = "7438 G C    "
  a[a.length] = "7439 U M    "
  a[a.length] = "7442 U M    "
  a[a.length] = "7555 U KCT  "
//a[a.length] = "7557 U C    "
  a[a.length] = "7558 U C    "
//a[a.length] = "7559 U C    "
  a[a.length] = "7561 U M    "
//a[a.length] = "7562 U C    "
//a[a.length] = "7563 U C    "
  a[a.length] = "7564 U C    "
  a[a.length] = "7566 U KCT  "
//a[a.length] = "7570 U C    "
//a[a.length] = "7571 U C    "
  a[a.length] = "7579 J C    "
  a[a.length] = "7581 U C    "
//a[a.length] = "7582 J C    "
  a[a.length] = "7584 J C    "
  a[a.length] = "7585 P C    "
  a[a.length] = "7589 G C    "
  a[a.length] = "7590 U C    " 
  a[a.length] = "7591 P C    " 
  a[a.length] = "7593 S C    "
  a[a.length] = "7594 U C    "
//a[a.length] = "7595 X KCM  " 
//a[a.length] = "7599 G KCM  "
//a[a.length] = "7601 U C    "
  a[a.length] = "7602 U C    "
  a[a.length] = "7604 U KCM  "
//a[a.length] = "7607 J M    " 
  a[a.length] = "7608 U M    " 
//a[a.length] = "7609 J M    "
//a[a.length] = "7610 J M    "
//a[a.length] = "7611 J M    "
//a[a.length] = "7612 J M    " 
//a[a.length] = "7613 U KCM  " 
  a[a.length] = "7614 U KCMT "
  a[a.length] = "7615 U C    "
//a[a.length] = "7616 U C  "
//a[a.length] = "7617 U KCT  "
//a[a.length] = "7618 U KCM  "
  a[a.length] = "7619 S C    "
//a[a.length] = "7620 U KCM  "
//a[a.length] = "7621 U C    "
//a[a.length] = "7622 U C    "
//a[a.length] = "7623 U C    "
  a[a.length] = "7624 U C    "
//a[a.length] = "7625 U C    "
//a[a.length] = "7626 U KCM  "
//a[a.length] = "7627 U KCM  "
  a[a.length] = "7628 U C    "
//a[a.length] = "7629 U KCT  "
  a[a.length] = "7630 U C    "
//a[a.length] = "7631 U KCT  "
//a[a.length] = "7632 U C    "
//a[a.length] = "7633 U KCMT "
  a[a.length] = "7634 U KCT  "
//a[a.length] = "7635 U C    "
  a[a.length] = "7636 U C    "
  a[a.length] = "7637 S C    "
  a[a.length] = "7638 U KCM  "
  a[a.length] = "7639 U C    "
  a[a.length] = "7640 U C    "
  a[a.length] = "7641 G C    "
  a[a.length] = "7642 G C    "
  a[a.length] = "7643 G C    "
  a[a.length] = "7644 G C    "
  a[a.length] = "7645 G C    "
//a[a.length] = "7646 G C    "
//a[a.length] = "7647 G C    "
  a[a.length] = "7648 G C    "
  a[a.length] = "7649 G C    "
//a[a.length] = "7650 J C    "
//a[a.length] = "7651 G C    "
  a[a.length] = "7653 U T    "
//a[a.length] = "7654 S T    "
//a[a.length] = "7655 U T    "
//a[a.length] = "7656 U KMT  "
  a[a.length] = "7657 U KMT  "
//a[a.length] = "7658 U T    "
//a[a.length] = "7659 U T    "
  a[a.length] = "7660 S KMT  "
//a[a.length] = "7661 G M    "
//a[a.length] = "7662 U T    "
  a[a.length] = "7663 U T    "
//a[a.length] = "7664 U M    "
//a[a.length] = "7665 U M    "
  a[a.length] = "7666 U M    "
//a[a.length] = "7667 U KCM  "
//a[a.length] = "7668 U M    "
//a[a.length] = "7669 U M    "
  a[a.length] = "7670 U M    "
//a[a.length] = "7671 U M    "
//a[a.length] = "7672 U M    "
//a[a.length] = "7673 U M    "
//a[a.length] = "7674 U M    "
//a[a.length] = "7675 U M    "
}

function MM_prepml ( a ) {
// TABELA DE MARCADORES DE LIVRO
// 12345678901234567890
// NNNN X XXXXXCCCCCCCCCC, onde
//      8NNN =  g_estampa
//      80IM = Importada
//      8002 = Mista
//      81xx = Tons de Cores
//      82nn = Individuais
//      X = g_cdpreco de preço
//      XXXXX = Quais kits 1, 2, 5, A=10, B=20.

  a[a.length] = '80IM I 1     '
  a[a.length] = '80MS M 1     '
  a[a.length] = '81AM T 1     '
  a[a.length] = '81AZ T 1     '
  a[a.length] = '81LI T 1     '
  a[a.length] = '81PB T 1     '
  a[a.length] = '81RS T 1     '
  a[a.length] = '81VM T 1     '
//  a[a.length] = '8202 U 1     '
//  a[a.length] = '8205 U 1     '
//  a[a.length] = '8206 U 1     '
//  a[a.length] = '8208 U 1     '
//  a[a.length] = '8209 U 1     '
//  a[a.length] = '8210 U 1     '
//  a[a.length] = '8211 U 1     '
//  a[a.length] = '8212 U 1     '
//  a[a.length] = '8213 U 1     '
//  a[a.length] = '8214 U 1     '
//  a[a.length] = '8217 U 1     '
//  a[a.length] = '8220 U 1     '
//  a[a.length] = '8231 X 1     '
}

function MM_preprk ( a ) {
// TABELA DE ROSAS DE KAWASAKI
// 12345678901234567890
// NNNN X XXXXXCCCCCCCCCC, onde
//      8NNN =  g_estampa
//      80IM = Importada
//      8002 = Mista
//      81xx = Tons de Cores
//      82nn = Individuais
//      X = g_cdpreco de preço
//      XXXXX = Quais kits 1, 2, 5, A=10, B=20.

  a[a.length] = '70MS M 1     '
  a[a.length] = '71AZ T 1     '
  a[a.length] = '71RS T 1     '
  a[a.length] = '71VD T 1     '
  a[a.length] = '71VM T 1     '
  a[a.length] = '71PB T 1     '
//  a[a.length] = '7279 U 1     '
//  a[a.length] = '7304 U 1     '
//  a[a.length] = '7311 U 1     '
//  a[a.length] = '7327 U 1     '
//  a[a.length] = '7339 U 1     '
//  a[a.length] = '7369 U 1     '
//  a[a.length] = '7380 U 1     '
//  a[a.length] = '7384 U 1     '
//  a[a.length] = '7393 U 1     '
//  a[a.length] = '7409 U 1     '
//  a[a.length] = '7456 U 1     '
//  a[a.length] = '7457 U 1     '
//  a[a.length] = '7458 U 1     '
//  a[a.length] = '7459 U 1     '
//  a[a.length] = '7462 U 1     '

}


-->

