//method to display tickets browsed

         function showTicketsBrowsed()
         {

                            var cookieSets = document.cookie.split("; "); // break cookie into array
                            var notPrinted=1;
                            for(i=cookieSets.length-1;i>-1;i--)
                            {
                                var cookieNameValue=cookieSets[i].split("=");
                                if(cookieNameValue[0]=="lastViewed1")
                                {
                                  var vals = unescape(cookieNameValue[1]).split("^");

                                  while(vals[0].indexOf("+") != -1)
                                  vals[0] = vals[0].replace("+"," ");

                                  if(notPrinted){
                                  document.write("<h3>Check out our special prices for these events</h3><ul><li style=\"text-align: center;\"><img src=\"/i/hand.gif\" /></li>");
                                  notPrinted=0;
                                  }

                                  document.write("<li><a href=\"/searchTickets.php?eventID1=" + vals[1] + "&forDate=" + vals[3] + "&tr=csid\">" + vals[0] + " on " + vals[2] + "</a></li>");
                                }

                                if(cookieNameValue[0]=="lastViewed")
                                {
                                  var vals = unescape(cookieNameValue[1]).split("^");

                                  while(vals[0].indexOf("+") != -1)
                                  vals[0] = vals[0].replace("+"," ");

                                  if(notPrinted){
                                  document.write("<h3>Check out our special prices for these events</h3><ul><li style=\"text-align: center;\"><img src=\"/i/hand.gif\" /></li>");
                                  notPrinted=0;
                                  }

                                  document.write("<li><a href=\"/searchTickets.php?eventID1=" + vals[1] + "&forDate=" + vals[3] + "&tr=csid\">" + vals[0] + " on " + vals[2] + "</a></li>");
                                }
                            }

                            document.write("</ul>");
         }


                            function addToCompare(n,v)
                            {
                                  //alert('hee');
                                  //alert(n);
                                  //alert(v);
                                  //alert(document.cookie);

                                  document.cookie=n + "=" +v;

                                  //alert(document.cookie);
                            }

                            function removeFromCompare(n)
                            {
                                  //alert('hee');
                                  //alert(n);
                                  //alert(v);

                                  //alert(document.cookie);

                                  var cookieSets = document.cookie.split("; "); // break cookie into array

                                  for(i=0;i<cookieSets.length;i++)
                                  {
                                    var cookieNameValue=cookieSets[i].split("=");
                                    if(cookieNameValue[0]==n){
                                       var today = new Date();
                                       var expired = new Date(today.getTime() - 28 * 24 * 60 * 60 * 1000); // less 28 days
                                       document.cookie=n + "=null; expires=" + expired.toGMTString(); // delete cookie
                                       break;
                                    }
                                  }
                            }

                            function displayTicketsToCompare()
                            {
                                var cookieSets = document.cookie.split("; "); // break cookie into array

                                  var alreadySet=0;
                                  var count=1;
                                  for(i=0;i<cookieSets.length;i++)
                                  {
                                    var cookieNameValue=cookieSets[i].split("=");
                                    var data=cookieNameValue[1].split("^z");
                                    if(cookieNameValue[0]==data[0])
                                    {

                                     //document.write(data[0] + "<br />" + data[1] + "<br />" + data[2])

                                     document.write("<form method=\"post\" action=\"/searchTickets.php\" onsubmit=\"return false;\">");

                                     document.write("<tr><td width=\"3%\">" + count + "</td>" );
                                     document.write("<td width=\"29%\">");
                                     document.write("<a href=\"/searchTickets.php?eventID1=" + data[3] +  "\"><b>" + data[2] + "</b></a><br />");

                                     if(data[5])
                                     {
                                       if(data[4] != '')
                                        document.write("vs. ");
                                       else
                                        document.write("/ ");

                                       document.write("<a href=\"/searchTickets.php?eventID1=" + data[6] +  "\">" + data[5] + "</a><br />");
                                     }

                                     document.write("<b>@ " + "<a href=\"/searchTickets.php?venueID=" + data[11] +  "\">" + data[10] + "</b></a>");

                                     document.write(" <a href=\"javascript:seatingWindow = window.open('/popSeating.php?venueID=" + data[11] + "', 'seatingWindow', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=750,height=550,left=20,top=20'); seatingWindow.focus();\" title=\"Display Seating Chart.\"> (map) </a></td>");

                                     document.write("<td width=\"13%\">");

                                     document.write("<b>" + data[7] + "</b><br />" + data[8] + ", " + data[9] + "</td>");

                                     document.write("<td width=\"24%\">Sec: <b>" + data[14] + "</b> Row: <b>" + data[15] + "</b><br />");
                                     document.write(data[17] + "</td>");

                                     document.write("<td width=\"15%\"><b>" + data[19] + "</b><br />each</td>");

                                     document.write("<td width=\"8%\">");

                                    var thisTicketID = data[0];
                                     var thisSelectedQtyID = 'qty_' + thisTicketID;

                                     document.write("<select name=\"quantity\" id=\"" + thisSelectedQtyID + "\">");

                                     for(j=data[18];j>0; j-=2)
                                      document.write("<option value=\"" + j + "\">"+j+"</option>");

                                     document.write("</select></td>");

                                     document.write("<td width=\"8%\">");
                                     document.write("<button type=\"button\" name=\"addToCart\" value=\"1\" title=\"Click here to purchase these tickets.\" onclick=\"BuyTickets('" + thisTicketID + "');\">Order</button></td>")

                                     //document.write("<br /><input type=checkBox name=\"" + data[0] + "\" value=\"" + data[0] + "^z" + data[1] + "\" onClick=\"removeFromCompare(this.name), window.location.reload(true)\"> Remove</td>");

                                    document.write("<input type=\"hidden\" name=\"EI_tix_id\" value=\"" + data[0] +"\">");
                                    document.write("<input type=\"hidden\" name=\"BID\" value=\"" + data[1] + "\">");
                                    document.write("<input type=\"hidden\" name=\"event\" value=\"" + data[2] + "\">");
                                    document.write("<input type=\"hidden\" name=\"EID1\" value=\"" + data[3] + "\">");
                                    document.write("<input type=\"hidden\" name=\"t\" value=\"" + data[4] + "\">");
                                    document.write("<input type=\"hidden\" name=\"oppName\" value=\"" + data[5] + "\">");
                                    document.write("<input type=\"hidden\" name=\"EID2\" value=\"" + data[6] + "\">");
                                    document.write("<input type=\"hidden\" name=\"date\" value=\"" + data[7] + "\">");
                                    document.write("<input type=\"hidden\" name=\"day\" value=\"" + data[8] + "\">");
                                    document.write("<input type=\"hidden\" name=\"time\" value=\"" + data[9] + "\">");
                                    document.write("<input type=\"hidden\" name=\"venue\" value=\"" + data[10] + "\">");
                                    document.write("<input type=\"hidden\" name=\"VID\" value=\"" + data[11] + "\">");
                                    document.write("<input type=\"hidden\" name=\"city\" value=\"" + data[12] + "\">");
                                    document.write("<input type=\"hidden\" name=\"state\" value=\"" + data[13] + "\">");
                                    document.write("<input type=\"hidden\" name=\"section\" value=\"" + data[14] + "\">");
                                    document.write("<input type=\"hidden\" name=\"row\" value=\"" + data[15] + "\">");
                                    document.write("<input type=\"hidden\" name=\"seats\" value=\"" + data[16] + "\">");
                                    document.write("<input type=\"hidden\" name=\"ticketDesc\" value=\"" + data[17] + "\">");
                                    //document.write("<input type=\"hidden\" name=\"brokerPrice\" value=\"" + data[18] + "\">");
                                    //document.write("<input type=\"hidden\" name=\"price\" value=\"" + data[19] + "\">");
                                    document.write("<input type=\"hidden\" name=\"maxAvailable\" value=\"" + data[18] + "\">");
                                    document.write("<input type=\"hidden\" name=\"v\" value=\"" + data[20] + "\">");

                                    document.write("</form></tr>");

                                    count++;
                                    }
                                  } //for

                                  if(count==1)
                                   document.write("<tr><td colspan=\"7\"><br /><br /><b>No Tickets to compare. Please use checkbox on the ticket listing page to select the ticket and then compare.</b></td></tr>")

                            }


                              //populate affiliate link box
                              function populateLinkBox()
                              {
                                 //aff cookie
                                 var cookieSets = document.cookie.split("; ");
                                     for(i=0;i<cookieSets.length;i++)
                                     {
                                     var cookieNameValue=cookieSets[i].split("=");
                                     if(cookieNameValue[0]=="orderCookie[aid]")
                                      var aid =  cookieNameValue[1];
                                     }

                                 var vals = document.linkForm.event.value.split("^");

                                 if(vals[0] != ""){
                                 document.linkForm.linkBox.value="<p align=\"right\"><a target=\"_blank\" href=\"/searchTickets.php?eventID1=" + vals[1] + "&aid=" + aid + "\">" + vals[0] + " Tickets</a><br><a onmouseover=\"window.status='';return true\" onmouseout=\"window.status=''; return true;\" style=\"text-decoration:none; cursor:default;\" href=\"/\"><font size=\"1\">@ Buyselltix</a></font></p>";
                                 document.linkForm.copyButton.disabled=false;
                                 }
                                 else
                                 document.linkForm.linkBox.value="Please select event from list above. (You can link to the Ticket Search Home Page by selecting 2nd option in the list)";
                              }
