/* Do nothing at this stage in an empty basket */
  var thisItems;
  var thisSubtotal;
  var thisUser;


 if (document.cookie != ""){

        /* At least one cookie has been found!
        Split them up and look for the basket cookie */

        thisCookie = document.cookie.split("; ")
        for (i=0; i<thisCookie.length; i++){
              if (thisCookie[i].split("=")[0] == "basket"){

                /* The BASKET cookie was FOUND!
                HIVE off its CONTENTS into "cookieContent" */

                  var cookieName =  thisCookie[i].split("=")[0];

                  var cookieContent = thisCookie[i].split('=')[1];


                 if (cookieContent.length > 6)
                        {

                        /* It's not an empty one. get values*/



                          /* SPLIT down the "cookieContent" further into keyValues - a list of keys, value, key, value... */

                            keyValues = cookieContent.split("&")

                         /* FIND the LENGTH of this content list */

                            var length = keyValues.length;

                         /* SPLIT OFF each key/ value in turn */

                            for (i=0; i<keyValues.length; i++){

                                      /* ASSIGN the piece of data to "thisData" */

                                      var thisData = keyValues[i].split('&')[0];

                                      /*run a PATTERN MATCH against all the KEYS */

                                      if (thisData.match(/items/i))
                                          {
                                           /* If MATCH then next data is the "Items" value, so assign */
                                           var thisItems = keyValues[i+1].split('&')[0];
                                          }

                                      else if (thisData.match(/subtotal/i))
                                          {
                                           /* If MATCH then next data is the "Subtotal" value, so assign */
                                           var thisSubtotal = keyValues[i+1].split('&')[0];
                                          }

                                      else if (thisData.match(/user/i))
                                          {
                                           /* If MATCH then next data is the "User" value, so assign */
                                           var thisUser = keyValues[i+1].split('&')[0];
                                          }

                                      }

                            }

                  }

             }

        }


  if (thisUser == null)
                  {
                   thisItems = 0;
                   thisUser = 0;
                   thisSubtotal = 0;
                   }

  document.write("<a href=\'/cgi-bin/basket_contents.pl?u="+thisUser+"\'>Items</a>:&nbsp;"+thisItems+"&nbsp;&nbsp;")
  document.write("<a href=\'/cgi-bin/basket_contents.pl?u="+thisUser+"\'>Amount</a>:&nbsp;&#163;"+thisSubtotal+"&nbsp;&nbsp;")
  document.write("<br/><a href=\'http://www.safebuy.org.uk/members/flowers/member603033.htm\'><img src=\'/HTML_images/logosafebuy-sm.gif\' border=\'0\' style=\'width:50px;height:40px;margin:5px 0px 0px 3px;vertical-align:top;\' alt=\'Accredited Member of The SafeBuy Assurance Scheme\'/></a>")
  document.write("<a href=\'/cgi-bin/check_out.pl?u="+thisUser+"\'><img src=\'/HTML_images/check-out-sm.gif\' border=\'0\' style=\'width:78px;height:28px;margin:5px 3px 0px 0px;vertical-align:top;\' alt=\'check out now!\'/></a>")

