
      /**********

          file:     help_texas_holdem.js
          created:  27 oct 2005
          topic:    support ftns for user choosing colors
          text:     Mastering JavaScript
          author:   James Jaworski
          pages:    <none>

          updates:
            05 nov 2005  Moved this file to texas_box
              
      **********/

                     var expiration_date = "Tuesday, 10-Nov-20 23:12:40 GMT" ; // cookie valid until 10 nov 2020


                     function name_is_defined ( ck, nam )
                        {
                           var ss    = remove_blanks( ck ) ;
                           var pairs = ss.split( ";" ) ;
                           for( var j=0; j<pairs.length; j++ )
                              {
                                  var pair_split = pairs[j].split( "=" ) ;
                                  if ( pair_split[0] == nam ) 
                                     {
                                        return true ;
                                     }
                              }
                           return false ;

                        } // name_is_defined
        
                     function remove_blanks ( ss )
                        {
                          var temp = "" ;
                          for( var j=0; j<ss.length; j++ ) 
                             {
                                var cc = ss.charAt( j ) ;
                                if ( cc != " " )
                                   {
                                      temp += cc ;
                                   }
                             }
                          return temp ;
        
                       } // remove_blanks
       
                   function get_cookie_value ( kk, n )
                      {
                         var ss = remove_blanks( kk ) ;
                         var pairs = ss.split( ";" ) ;
                         for( var j=0; j<pairs.length; j++ )
                            {
                               var pair_split = pairs[j].split( "=" ) ;
                               if ( pair_split[0] == n )
                                  {
                                      return pair_split[ 1 ] ;
                                  }
                            }
                         return "" ;
       
                     } // get_cookie_value

                  function read_cookie() 
                     {
                        var cookie = document.cookie ;

                        texas_text_color = "black" ;

                        if ( name_is_defined( cookie, "texas_background" )) 
                            {
                                texas_background = get_cookie_value ( cookie, "texas_background" ) ;
                            }
                        else
                            {
                                texas_background = "white" ;  // added on 02 march 2005
                            }
       
                        if ( name_is_defined( cookie, "texas_text_color" )) 
                            {
                                texas_text_color = get_cookie_value ( cookie, "texas_text_color" ) ;
                            }
                        else
                            {
                                texas_text_color = "black" ;  // added on 03 april 2005
                            }

       
                     } // read_cookie


                      function setCookie() 
                         {
        
                            var new_cookie_1 = "texas_background=" + texas_background ;

                            new_cookie_1 += "; expires="  +  expiration_date ; 
       
                            window.document.cookie = new_cookie_1 ;
       
                            var new_cookie_2 = "texas_text_color=" + texas_text_color ;
       
                            new_cookie_2 += "; expires="  +  expiration_date ; 
         
                            window.document.cookie = new_cookie_2 ;
       
                            window.location="texas_holdem_r4.htm"

                         } // setCookie


                      function set_prefs() 
                         {
                            //// alert( "Hello from top of set_prefs " ) ;
        
                            bg_field     = window.document.my_prefs_form.my_bg ;
                            bg_index     = bg_field.selectedIndex ;
       
                            if ( bg_field.options[bg_index].text == "light gray" )     
                               {
                                   texas_background = "#eeeeee" ;  // smooth light gray
                               }
                            else if ( bg_field.options[bg_index].text == "blanched almond" )
                               {
                                   texas_background = "blanchedalmond" ; 
                               }
                            else
                               {
                                   texas_background  = bg_field.options[bg_index].text ;
                               }
     
                            fg_field     = window.document.my_prefs_form.my_fg ;
                            fg_index     = fg_field.selectedIndex ;
                            texas_text_color  = fg_field.options[fg_index].text ;
                            setCookie() ;
       
                         } // set_prefs

                      function create_prefs_form() 
                         {
                             document.writeln( '<form   name="my_prefs_form">' ) ;

                             document.writeln( "<span  class='gmt_choose_color' >"  +
                                               "&nbsp;&nbsp;&nbsp;&nbsp; "          +  
                                               "Background color: </span>" ) ;

                             document.writeln( '<select  name="my_bg" size="1" >' ) ;
                             document.writeln( ' <option> aqua' ) ;
                             document.writeln( ' <option> blanched almond' ) ;
                             document.writeln( ' <option> blue' ) ;
                             document.writeln( ' <option> black' ) ;
                             //// document.writeln( ' <option> rough_gray' ) ;
                             document.writeln( ' <option> light gray' ) ;              
                             document.writeln( ' <option> lime' ) ;
                             document.writeln( ' <option> orange' ) ;
                             document.writeln( ' <option> red' ) ;
                             document.writeln( ' <option> tan' ) ;
                             document.writeln( ' <option SELECTED >white' ) ;  
                             document.writeln( ' <option> yellow' ) ;        
                             document.writeln( '</select >' ) ;
        
                             document.write( ' &nbsp; ' ) ;        
        
                             document.writeln( "<span  class='gmt_choose_color' >"  +
                                               "&nbsp Text color: </span>" ) ;

                             document.writeln( '<select  name="my_fg" size="1" >' ) ;
                             document.writeln( ' <option> ' ) ;        
                             document.writeln( ' <option SELECTED >black' ) ;
                             document.writeln( ' <option> blue' ) ;  
                             document.writeln( ' <option> gray' ) ;  
                             document.writeln( ' <option> green' ) ; 
                             document.writeln( ' <option> lime' ) ;        
                             document.writeln( ' <option> orange' ) ;
                             document.writeln( ' <option> red' ) ;
                             document.writeln( ' <option> silver' ) ;                    
                             document.writeln( ' <option> tan' ) ;
                             document.writeln( ' <option> white' ) ;
                             document.writeln( ' <option> yellow' ) ;        
                             document.writeln( '</select >' ) ;

                             document.write( ' &nbsp;&nbsp; ' ) ;

                             document.writeln( "<input   "                  +
                                               "class='gmt_set_color_btn'"  +
                                               "type='button'"              +
                                               "value='Set Colors'"         +
                                               "onClick='set_prefs()'" ) ;

                             document.writeln( '</form>' ) ;

                         } // create_prefs_form

