// Copyright (c) 1996-1999 twenty-one@geocities.com All rights reserved
//
// BJC Chart Maker
//   http://www.geocities.com/TimesSquare/Realm/2009/BJC/BJC-Chart.js
//
// When you use this javascript on your web page, you must have a
// permission from twenty-one@geocities.com


function newpage(sb,ar,fs,deck,s17,dd,das,sr,hc) {

  function genText() {

    document.write("<pre>");
    document.write("</pre>");

    document.write("</BODY></HTML>");
  }

  function th(item) {
    if (fs!="-") {
      document.write("<th><font size="+fs+">"+item+"</font></th>");
    } else {
      document.write("<th>"+item+"</th>");
    }
  }
  function td(item,color) {
    if (fs!="-") {
      document.write("<td bgcolor="+color+"><font size="+fs+">"+item+"</font></td>");
    } else {
      document.write("<td bgcolor="+color+">"+item+"</td>");
    }
  }
  function lineHead(item) {
    if (sb=="T") {
      document.write("<tr>");
      th(item);
    } else {
      document.write(item+"|");
    }
  }
  function lineTail() {
    if (sb=="T") {
      document.writeln("</tr>");
    } else {
      document.writeln(" |");
    }
  }
  function S() {
    if (sb=="T") {
      td("S","#00ff00");
    } else {
      document.write(" S");
    }
  }
  function H() {
    if (sb=="T") {
      td("H","#FFFF00");
    } else {
      document.write(" H");
    }
  }
  function allH() {
    H();H();H();H();H();H();H();H();H();H();
  }
  function D() {
    if (sb=="T") {
     td("D","#FF0000");
    } else {
     document.write(" D");
    }
  }

  function P() {
    if (sb=="T") {
      td("P","#00CCFF");
    } else {
      document.write(" P");
    }
  }

  function R() {
    if (sb=="T") {
      td("$","#FF00FF");
    } else {
      document.write(" $");
    }
  }



  function tableDU () {
   if (sb=="T") {
     document.writeln("<tr>");
     th("");
     td("2","#ffffff");td("3","#ffffff");td("4","#ffffff");
     td("5","#ffffff");td("6","#ffffff");td("7","#ffffff");
     td("8","#ffffff");td("9","#ffffff");td("T","#ffffff");
     td("A","#ffffff");
     document.writeln("</tr>");
   } else {
      line();
      document.writeln("   | 2 3 4 5 6 7 8 9 T A |");
   }
  }

  function tableTop () {
    document.write ("<table CELLSPACING=0 border>");
  }
  function genTable(table) {

   if ((ar=="H")&&(sb=="T")) {
     document.write ("<table><tr valign=top> <td>");
   }
   if (sb=="T") {
     tableTop(); 
   } else {
     document.write ("<pre>");
   }
   tableDU();


   if (sb=="P") {
     lineHard();
   }

   // 18
   lineHead("H18");
   S();S();S();S();S();S();S();S();S();S();
   lineTail();

   // 17
   lineHead("H17");
   S();S();S();S();S();S();S();S();S();
   if ((sr!="-")&&(s17=="H")) R(); else S();
   lineTail();

   // 16
   lineHead("H16");
   S();S();S();S();S();H();H();
   if (sr!="-") {
     if (deck> 2) {
      R();R();R();
     } else {
      H();R();R();
     }
   } else {
    H();H();H();
   }
   lineTail();

   // 15
   lineHead("H15");
   S();S();S();S();S();H();H();H();
   if (sr!="-") R(); else H();
   if ((sr!="-")&&(s17=="H")) R(); else H();
   lineTail();

   // 14
   lineHead("H14");
   S();S();S();S();S();H();H();H();H();H();
   lineTail();

   // 13
   lineHead("H13");
   S();S();S();S();S();H();H();H();H();H();
   lineTail();

   // 12
   lineHead("H12");
   H();H();S();S();S();H();H();H();H();H();
   lineTail();

   // 11
   lineHead("H11");
   D();D();D();D();D();D();D();D();
   if (hc!="0") {
    H();
   } else {
    D();
   }
   if ((hc=="1")||((deck>2)&&(s17=="S"))) {
    H();
   } else {
    D();
   }
   lineTail();

   // 10
   lineHead("H10");
   if ((dd=="DOA")||(dd=="D9")||(dd=="D10")) {
     D();D();D();D();D();D();D();D();H();H();
   } else {
     allH();
   }
   lineTail();

   // 9
   lineHead("H9 ");
   if ((dd=="DOA")||(dd=="D9")) {
     if (deck>3) {H();} else {D();}
     D();D();D();D();H();H();H();H();H();
   } else {
     allH();
   }
   lineTail();


   // 8
   lineHead("H8 ");
   if ((dd=="DOA")&&(deck==1)) {
     H();H();H();D();D();H();H();H();H();H();
   } else {
    allH();
   }
   lineTail();


   // 7
   lineHead("H7 ");
   H();H();H();H();H();H();H();H();H();H();   
   lineTail();

   tableDU();

   if ((ar=="H")&&(sb=="T")) {
     document.writeln ("</table> </td> <td>");
     tableTop(); 

     tableDU();
   }

   //
   // Soft Hand
   //

   if (sb=="P") {
     lineSoft();
   }


   // A,9
   lineHead("A,9");
   S();S();S();S();S();S();S();S();S();S();
   lineTail();

   // A,8
   lineHead("A,8");
   S();S();S();S();
   if (dd!="DOA") {
     S();
   } else if ((deck>1)&&(s17=="S")) {
     S();
   } else {
     D();
   }
   S();S();S();S();S();
   lineTail();

   // A,7
   lineHead("A,7");
   if (dd=="DOA") {
     if ((s17=="H")&&(deck>1)) {
       D();
     } else {
       S();
     }
     D();D();D();D();
   } else {
    S();S();S();S();S();
   }
   S();S();H();H();
   if ((deck==1)&&(s17=="S"))
     S();
   else
     H();
   lineTail();


   // A,6
   lineHead("A,6");
   if (dd=="DOA") {
     if (deck<2) {
       D();
     } else {
       H();
     }
     D();D();D();D();H();H();H();H();H();
   } else {
     allH();
   }
   lineTail();

   // A,5
   lineHead("A,5");
   if (dd=="DOA") {
     H();H();D();D();D();H();H();H();H();H();
   } else {
     allH();
   }
   lineTail();

   // A,4
   lineHead("A,4");
   if (dd=="DOA") {
     H();H();D();D();D();H();H();H();H();H();
   } else {
     allH();
   }
   lineTail();

   // A,3
   lineHead("A,3");
   if (dd=="DOA") {
     H();H();
     if (deck > 2) {
       H();
     } else if ((deck==2)&&(s17=="S")) {
       H();
     } else {
       D();
     }
     D();D();H();H();H();H();H();
   } else {
     allH();
   }
   lineTail();

   // A,2
   lineHead("A,2");
   if (dd=="DOA") {
     H();H();
     if (deck<2) D(); else H();
     D();D();H();H();H();H();H();
   } else {
     allH();
   }
   lineTail();

   tableDU();

   if ((ar=="H")&&(sb=="T")) {
     document.write ("</table> </td> <td>");
     tableTop(); 
     tableDU();
   }
   //
   // Pair Hand
   //

   if (sb=="P") {
     linePair();
   }
   // A,A
   lineHead("A,A");
   P();P();P();P();P();P();P();P();P();
   if (hc=="1") {
     H();
   } else {
     P();
   }
   lineTail();

   // T,T
   lineHead("T,T");
   S();S();S();S();S();S();S();S();S();S();
   lineTail();

   // 9,9
   lineHead("9,9");
   P();P();P();P();P();S();P();P();S();
   if ((deck==1)&&(das=="T")&&(s17=="H")&&(hc!="1")) {
     P();
   } else {
     S();
   }
   lineTail();

   // 8,8
   lineHead("8,8");
   P();P();P();P();P();P();P();P();
   if (hc!="0") {
     H();
   } else {
     P();
   }
   if (hc=="1") {
     H();
   } else {
     if ((sr=="L")&&(s17=="H")&&(deck>2)) {
       R();
     } else {
       P();
     }
   }
   lineTail();

   // 7,7
   lineHead("7,7");
   P();P();P();P();P();P();
   if ((das=="T")&&(deck <4)) {
     P();
   } else {
     H();
   }
   H();
   if (deck<2) {
     if (sr!="-") {
       R();
     } else {
       S();
     }
   } else {
     H();
   }
   if ((sr!="-")&&(s17=="H")) {
     R();
   } else {
     H();
   }
   lineTail();

   // 6,6
   lineHead("6,6");
   if ((deck>2)&&(das=="F")) {
     H();
   } else {
     P();
   }
   P();P();P();P();
   if ((deck < 4)&&(das=="T")){
     P();
   } else {
     H();
   }
   H();H();H();H();
   lineTail();

   // 5,5
   lineHead("5,5");
   if (dd == "D11") {
     H();H();H();H();H();H();H();H();H();H();
   } else {
     D();D();D();D();D();D();D();D();H();H();
   }
   lineTail();

   // 4,4
   lineHead("4,4");
   H();H();
   if ((das=="T")&&(deck<2)) {
     P();
   } else {
     H();
   }
   if ((dd=="DOA")&&(deck<2)&&(das!="T")) {
     D(); D();
   }else if (das=="T") {
     P(); P();
   } else {
     H(); H();
   }
   H();H();H();H();H();
   lineTail();

   // 3,3
   lineHead("3,3");
   if (das=="T") {P();P();} else {H();H();}
   P();P();P();P();
   if ((das=="T")&&(deck<2))
     P();
   else
     H();
   H();H();H();
   lineTail();

   // 2,2
   lineHead("2,2");
   if (das=="T") {
     P();P();
   }else {
     if (deck<2){
       H();P();
     } else {
       H();H();
     }
   }
   P();P();P();P();H();H();H();H();
   lineTail();

   tableDU();
   if (sb=="T") { 
     document.write ("</table>");
     if (ar=="H") {
       document.write ("</td></tr></table>");
     }
   } else {
     line();
   }

  }


  function line() {
    document.writeln("---+---------------------+"); 
  }
  function lineHard() {
    document.writeln("---+------ Duras --------+"); 
  }
  function lineSoft() {
    document.writeln("---+----- Blandas -------+"); 
  }
  function linePair() {
    document.writeln("---+------ Pares --------+"); 
  }


  function writeCond(){
    document.write("<b>");
    document.write(deck+" Mazos : S17 ");
    if (s17=="H") document.write("pide : "); else document.write("se planta : ");
    switch(dd) {
      case "DOA":
        document.write("DOA :");
        break;
      case "D9":
        document.write("D9 :");
        break;
      case "D10":
        document.write("D10 :");
        break;
      case "D1":
        document.write("D11 :");
        break;
    }
   if (das!="T") {
     document.write(" no");
   }
   document.write(" DAS :");
   switch(sr) {
     case "-":
       document.write(" no hay rendicion ");
       break;
     case "L":
       document.write(" Rendicion tardia ");
       break;
     case "E":
       document.write(" Rendicion temprana ");
       break;
   }
   document.write(": Carta tapada ");
   switch(hc) {
     case "0":
      document.write("Normal");
      break;
     case "1":
      document.write("Europea");
      break;
     case "2":
      document.write("No mira con 10");
      break;
   }
   document.write("</b><p>");
  }
  function genGraph() {
   document.write("<h1> No esta soportado todavia </h1>");
  }
  document.open();
  document.write("<HTML><HEAD>");
  document.write("<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">");
  document.write("<TITLE>Tabla para la Estrategia Basica</TITLE>");
  document.write("</HEAD>");

 

  document.write("<body background=\"../imagenes/fondotres.gif\">");
  
  // document.writeln("<H1>Tabla para la Estrategia Basica</H1>");


//  document.write("<a href=\"http://member.linkexchange.com/cgi-bin/fc/fastcounter-login?1527993\" target=\"_top\">");
//  document.write("<img border=\"0\" src=\"http://fastcounter.linkexchange.com/fastcounter?1527993+3055993\"></a>"); 
//  document.write("people generated chart<br>");


//  document.write("Esta tabla fue generada por <a href=\"http://www.geocities.com/TimesSquare/Realm/2009/BJC/Chart.html\">BJC Chart Maker</a>. ");

  document.write("Todos los calculos estan basados en <a href=\"http://www.geocities.com/TimesSquare/Realm/2009/BJC/\">BlackJack Calculator (BJC)</a>");





    document.write("<p align=\"center\"><font size=\"4\" face=\"Arial, Helvetica, sans-serif\">Nomenclatura</font><br>");
    document.write("<hr>");

    document.write("<table width=\"19%\" border=\"1\" align=\"center\">");
    document.write("  <tr bgcolor=\"#00ccff\"> ");
    document.write("    <td width=\"2%\" height=\"24\">P</td>");
    document.write("    <td width=\"98%\" height=\"24\">Dividir pares</td>");
    document.write("  </tr>");
    document.write("  <tr bgcolor=\"#ffff00\"> ");
    document.write("    <td width=\"2%\">H</td>");
    document.write("    <td width=\"98%\">Pedir carta</td>");
    document.write("  </tr>");
    document.write("  <tr bgcolor=\"#00ff00\"> ");
    document.write("    <td width=\"2%\">S</td>");
    document.write("    <td width=\"98%\">Plantarse</td>");
    document.write("  </tr>");
    document.write("  <tr bgcolor=\"#ff00ff\">");
    document.write("    <td width=\"2%\" bgcolor=\"#FF0000\">D</td>");
    document.write("    <td width=\"98%\" bgcolor=\"#FF0000\">Doblar</td>");
    document.write("  </tr>");
    document.write("  <tr bgcolor=\"#ff00ff\"> ");
    document.write("    <td width=\"2%\">$</td>");
    document.write("    <td width=\"98%\">Rendirse</td>");
    document.write("  </tr>");
    document.write("</table>");
    document.write("<hr>");











  writeCond();

  switch (sb) {
  case "T":
   genTable();
   break;
  case "P":
   genTable();
   break;
  case "G":
   genGraph();
   break;
  }
  document.close();
}
