sa_tourn = new Object;
   sa_tourn.build_count=99692;
   sa_tourn.scores_avail="Y";
   sa_tourn.full_name="La Nivelle Ladies Open";
   sa_tourn.short_name="La Nivelle Ladies Open";
   sa_tourn.code="NIV2";
   sa_tourn.scores_type="G";
   sa_tourn.course_dates="LA NIVELLE<BR>9th - 11th June 2010";
   sa_tourn.round_head="Final Scoreboard";
   sa_tourn.rounds_played=3;
   sa_tourn.full_scoreboard_url="http://glt.ocs-europe1.com/tic/tmscores.cgi?tourn=NIV2~params=PG0SSC999~season=2010";
   sa_tourn.tic_url="http://glt.ocs-europe1.com/tic/tmtic.cgi?season=2010";
   sa_tourn.tour_name="GENERALI LADIES TOUR";
   sa_tourn.tour_website="http://www.generaliladiestour.com";
   sa_tourn.tour_logo="";
   sa_tourn.logo_pos="";
   sa_tourn.event_sponsor_name="";
   sa_tourn.event_sponsor_website="";
   sa_tourn.sponsor_indicator_logo="http://ffg.ocs-europe1.com/misc/titleist_oom.gif";
   sa_tourn.represents_heading="Country";
   sa_tourn.software_provider_name="Tour Management Software from OCS Sport";
   sa_tourn.software_provider_website="http://www.ocs-sport.com";
   sa_tourn.webmaster_email="ffgadmin@ocs-sport.com";
   sa_tourn.live_scoring="N";
   sa_tourn.group_ties=false;
   sa_tourn.scroll_height=132;
   sa_tourn.max_width=true;
   sa_tourn.autosize=false;
   sa_tourn.name_wrap=false;
   sa_tourn.matchplay_format="N";
   sa_tourn.matchplay_team_format="N";
   sa_tourn.std_columns=1;
   sa_tourn.array_delimiter="/~";
   sa_tourn.cgi_base="http://glt.ocs-europe1.com/tic/";
   sa_tourn.data_entries=0;
   sa_tourn.error_found=false;
   sa_tourn.referring_page="";
   sa_tourn.referring_match="http://www.letaccess.com/";
   sa_tourn.licencee_ref="GLT0000001";
   sa_tourn.licencee="GLT";
   sa_tourn.licence_error=false;
   sa_tourn.report_options=new Array;
       sa_tourn.report_options[0]="Tournament Entries/~http://glt.ocs-europe1.com/tic/tmentry.cgi?tourn=NIV2~season=2010~alphaorder~exemptorder~/~";
       sa_tourn.report_options[1]="Round 1 Draw/~http://glt.ocs-europe1.com/tic/tmdraw.cgi?tourn=NIV2~season=2010~round=1~/~";
       sa_tourn.report_options[2]="Round 1 Scores Only/~http://glt.ocs-europe1.com/tic/tmscores.cgi?tourn=NIV2~season=2010~params=P*1SRC~/~";
       sa_tourn.report_options[3]="Round 2 Draw/~http://glt.ocs-europe1.com/tic/tmdraw.cgi?tourn=NIV2~season=2010~round=2~/~";
       sa_tourn.report_options[4]="Round 2 Scores Only/~http://glt.ocs-europe1.com/tic/tmscores.cgi?tourn=NIV2~season=2010~params=P*2SRC~/~";
       sa_tourn.report_options[5]="Round 2 Scoreboard/~http://glt.ocs-europe1.com/tic/tmscores.cgi?tourn=NIV2~season=2010~params=P*2ESC~/~";
       sa_tourn.report_options[6]="Round 3 Draw/~http://glt.ocs-europe1.com/tic/tmdraw.cgi?tourn=NIV2~season=2010~round=3~/~";
       sa_tourn.report_options[7]="Round 3 Scores Only/~http://glt.ocs-europe1.com/tic/tmscores.cgi?tourn=NIV2~season=2010~params=P*3SRC~/~";
       sa_tourn.report_options[8]="Round 3 Scoreboard/~http://glt.ocs-europe1.com/tic/tmscores.cgi?tourn=NIV2~season=2010~params=P*3ESC~/~";
       sa_tourn.report_options[9]="Final Result/~http://glt.ocs-europe1.com/tic/tmresult.cgi?tourn=NIV2~season=2010~result=PF~/~";
       sa_tourn.report_options[10]="Scoring Statistics/~http://glt.ocs-europe1.com/tic/tmstats.cgi?tourn=NIV2~season=2010~/~";
       sa_tourn.report_options[11]="Course Statistics/~http://glt.ocs-europe1.com/tic/tmcrsts.cgi?tourn=NIV2~season=2010~/~";
       sa_tourn.report_options[12]="Statistics Tables/~http://glt.ocs-europe1.com/tic/tmoomt.cgi?tourn=NIV2~season=2010~/~";
   sa_tourn.report_options_default=9;
   sa_tourn.css_table="font-family:verdana,tahoma,arial,sans-serif;color:black;background-color:#F8AC68;";
   sa_tourn.css_head="font-family:verdana,tahoma,arial,sans-serif;font-size:9pt;color:blue;";
   sa_tourn.css_main="font-family:verdana,tahoma,arial,sans-serif;font-size:9pt;color:black;background-color:beige;";
   sa_tourn.css_title="font-family:verdana,tahoma,arial,sans-serif;font-size:11pt;color:darkblue;";
   sa_tourn.css_line="font-family:verdana,tahoma,arial,sans-serif;font-size:7.5pt;padding-left:1px;padding-right:1px;";
   sa_tourn.css_linea="font-family:verdana,tahoma,arial,sans-serif;color:black;background-color:#FBD4B1;";
   sa_tourn.css_lineb="font-family:verdana,tahoma,arial,sans-serif;color:black;background-color:#F8AC68;";
   sa_tourn.css_select="font-family:verdana,tahoma,arial,sans-serif;font-size:7.5pt;color:black;background-color:#FBD4B1;";

sa_data = new Array (
   "1/~/~208/~-2/~208/~AFO001/~*Caroline AFONSO/~FRA/~N/~Institut Basque de Golf/~69/~67/~72/~69 67 72/~/~",
   "2/~/~209/~-1/~209/~ARR003/~*Marina ARRUTI/~ESP/~N/~/~70/~71/~68/~70 71 68/~/~",
   "3/~/~211/~+1/~211/~BEA004/~*Maria BEAUTELL/~ESP/~N/~/~74/~69/~68/~74 69 68/~/~",
   "4/~/~212/~+2/~212/~AND002/~*Lucie ANDRE (am)/~FRA/~N/~Mionnay / Pôle France/~67/~74/~71/~67 74 71/~/~",
   "5/~/~213/~+3/~213/~MAR024/~*Caroline MARTENS LARSEN/~NOR/~N/~Peak Performance/~70/~70/~73/~70 70 73/~/~",
   "6/~/~214/~+4/~214/~LAR009/~*Ana LARRANETA/~ESP/~N/~PING/~73/~74/~67/~73 74 67/~/~",
   "7/~=/~215/~+5/~215/~CHE003/~*Laura CHEMARIN (am)/~FRA/~N/~Golf de Toulouse/~70/~72/~73/~70 72 73/~/~",
   "7/~=/~215/~+5/~215/~BEL009/~*Rachel BELL/~ENG/~N/~/~67/~72/~76/~67 72 76/~/~",
   "9/~=/~216/~+6/~216/~LUN005/~*Karen LUNN/~AUS/~N/~/~75/~72/~69/~75 72 69/~/~",
   "9/~=/~216/~+6/~216/~CAU002/~*Anne-Lise CAUDAL/~FRA/~N/~Lacoste/~69/~76/~71/~69 76 71/~/~",
   "9/~=/~216/~+6/~216/~MAC004/~*Mariana MACIAS CAPUZZI/~ESP/~N/~/~72/~73/~71/~72 73 71/~/~",
   "9/~=/~216/~+6/~216/~MAT007/~*Kiran MATHARU/~ENG/~N/~/~72/~72/~72/~72 72 72/~/~",
   "EOD/~");
   --sa_data.length;
   sa_tourn.data_entries=sa_data.length;

function sa_get_data_object(index)
{
   var tm_eo = new Object;
   var tm_ta = sa_data[index].split('/~');
   if (tm_ta.length > 0)
      tm_eo.pos=tm_ta[0];
   if (tm_ta.length > 1)
      tm_eo.tied=tm_ta[1];
   if (tm_ta.length > 2)
      tm_eo.score=tm_ta[2];
   if (tm_ta.length > 3)
      tm_eo.vspar=tm_ta[3];
   if (tm_ta.length > 4)
      tm_eo.d_score=tm_ta[4];
   if (tm_ta.length > 5)
      tm_eo.member_no=tm_ta[5];
   if (tm_ta.length > 6)
      tm_eo.name=tm_ta[6];
   if (tm_ta.length > 7)
      tm_eo.nationality=tm_ta[7];
   if (tm_ta.length > 8)
      tm_eo.sponsored=tm_ta[8];
   if (tm_ta.length > 9)
      tm_eo.represents=tm_ta[9];
   if (tm_ta.length > 10)
      tm_eo.score_R1=tm_ta[10];
   if (tm_ta.length > 11)
      tm_eo.score_R2=tm_ta[11];
   if (tm_ta.length > 12)
      tm_eo.score_R3=tm_ta[12];
   if (tm_ta.length > 13)
      tm_eo.rounds=tm_ta[13];
   if (tm_ta.length > 14)
      tm_eo.holes=tm_ta[14];
   return(tm_eo);
}
   sa_tourn.incl_score=true;
   sa_tourn.incl_vspar=true;
   sa_tourn.incl_holes=false;
   sa_tourn.std_columns=4;
var sa_ticlinestyle="";
var sa_ticsubwin="";
var sa_cellspacing=false;

// Scoreboard Table Generation

function sa_open_tic_window()
{
  if ((typeof sa_ticsubwin != "object") || (sa_ticsubwin.closed))
      sa_ticsubwin = window.open("", "TICLINKWIN",
                 "location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=640,height=400,", true)
  else
      sa_ticsubwin.focus();
}

function sa_call_sb_report()
{
  var selopt = document.getElementById("sa_options").selectedIndex;
  var option_data = sa_tourn.report_options[selopt].split(sa_tourn.array_delimiter);
  var cgiurl = option_data[1];
  sa_open_tic_window();
  sa_ticsubwin.location = cgiurl;
}

function sa_tour_website()
{
  sa_open_tic_window();
  sa_ticsubwin.location = sa_tourn.tour_website;
}

function sa_tour_tic()
{
  sa_open_tic_window();
  sa_ticsubwin.location = sa_tourn.tic_url;
}

function sa_full_scoreboard()
{
  sa_open_tic_window();
  sa_ticsubwin.location = sa_tourn.full_scoreboard_url;
}

function sa_get_sb_position_strokeplay(index)
{
  var p = sa_get_data_object(index);
  var nbsp = ((sa_cellspacing) ? "" : "&nbsp;");
  if (sa_tourn.group_ties)
  {
     var newpos = false;
     if (p.pos != sa_lastpos)
     {
        newpos = true;
        var tiecount = 0;
        var i=index;
        var p2 = p;
        while ((i<sa_tourn.data_entries) && (p2.pos == p.pos))
        {
           ++tiecount; ++i;
           if (i<sa_tourn.data_entries)
              var p2 = sa_get_data_object(i);
        }
        sa_lastpos = p.pos;
     }
  }
  else
  {
     var newpos = true;
     var tiecount = 1;
  }
  if (p.pos == "CUT")
     return("");
  if (newpos)
     sa_ticlinestyle = ((sa_ticlinestyle=="a")?"b":"a");
  var nwrap = ((sa_tourn.name_wrap) ? "" : " nowrap");
  var sline = "";
  sline += "<TR style='" + sa_tourn["css_line" + sa_ticlinestyle] + "'>";
  if (newpos)
  {
     sline += "<TD style='" + sa_tourn["css_line"] + "text-align:left;' rowspan=" + tiecount + " nowrap>" + p.pos + p.tied + nbsp + "</TD>";
     if (sa_tourn.scores_type == "P")
         p.score += "<SMALL>pts</SMALL>";
     if (sa_tourn.incl_score)
         sline += "<TD style='" + sa_tourn["css_line"] + "text-align:center;' rowspan=" + tiecount + " nowrap>" + ((p.score == "") ? "&nbsp;" : p.score) + "</TD>";
     if (sa_tourn.scores_type == "P")
         p.vspar = "";
     if (sa_tourn.incl_vspar)
         sline += "<TD style='" + sa_tourn["css_line"] + "text-align:center;' rowspan=" + tiecount + " nowrap>" + ((p.vspar == "") ? "&nbsp;" : p.vspar) + "</TD>";
  }
  sline += "<TD style='" + sa_tourn["css_line"] + "text-align:left;" + ((sa_tourn.max_width) ? "width:90%;" : "") + "'" + nwrap + ">" + nbsp + p.name + "</TD>";
  if ((p.holes  == "") || (p.holes == "0"))  p.holes  = "&nbsp;";
  if  (p.holes  == "18")                     p.holes  = "F";
  if (sa_tourn.incl_holes)
     sline += "<TD style='" + sa_tourn["css_line"] + "text-align:center;' nowrap>" + p.holes + "</TD>";
  sline += "</TR>";
  return(sline);
}

function sa_get_sb_position_matchplay(index)
{
  var p = sa_get_data_object(index);
  var noscores = ((p.holes == "0") && (p.status_1 != "W") && (p.status_2 != "W"));
  sa_ticlinestyle = ((sa_ticlinestyle=="a")?"b":"a");
  var nwrap = ((sa_tourn.name_wrap) ? "" : " nowrap");
  var sline = "";
  sline += "<TR style='" + sa_tourn["css_line" + sa_ticlinestyle] + "'>";
  sline += "<TD style='" + sa_tourn["css_line"] + "text-align:center;' rowspan=2 nowrap>&nbsp;" + p.match + "&nbsp;</TD>";
  if (p.status_1 == "L")  p.full_score_1 = "&nbsp;";
  if (p.status_1 == "D")  p.full_score_1 = "&nbsp;";
  if (noscores)
      p.full_score_1 = "[" + p.time + "]";
  if (p.status_1 == "H")
      noscores = true;
  var fweight = ((p.status_1 == "W") ? "font-weight:bold;" : "font-weight:normal;");
  sline += "<TD style='" + sa_tourn["css_line"] + "text-align:center;" + fweight + "'" + ((noscores) ? " rowspan=2" : "") + " nowrap>" + p.full_score_1 + "</TD>";
  sline += "<TD style='" + sa_tourn["css_line"] + "text-align:left;"   + fweight + "'" + nwrap + ">" + p.name_1   + "</TD>";
  if ((p.status_1 == "W") || (p.status_2 == "W"))
      p.holes = "F";
  if (p.holes == "0")
      p.holes = "";
  sline += "<TD style='" + sa_tourn["css_line"] + "text-align:center;' rowspan=2 nowrap>&nbsp;" + p.holes + "&nbsp;</TD>";
  sline += "</TR>";
  sline += "<TR style='" + sa_tourn["css_line" + sa_ticlinestyle] + "'>";
  if (p.status_2 == "L")  p.full_score_2 = "&nbsp;";
  if (p.status_2 == "D")  p.full_score_2 = "&nbsp;";
  var fweight = ((p.status_2 == "W") ? "font-weight:bold;" : "font-weight:normal;");
  if (!noscores)
      sline += "<TD style='" + sa_tourn["css_line"] + "text-align:center;" + fweight + "' nowrap>" + p.full_score_2 + "</TD>";
  sline += "<TD style='" + sa_tourn["css_line"] + "text-align:left;"   + fweight + "'" + nwrap + ">" + p.name_2   + "</TD>";
  sline += "</TR>";
  return(sline);
}

function sa_add_logo()
{
  var dhtml = "";
  if (sa_tourn.tour_logo == "")
       return(dhtml);
  dhtml += "<TD style='text-align:center;margin:auto;vertical-align:middle;'>" +
           "<IMG src='" + sa_tourn.tour_logo + "' style='cursor:pointer;text-align:center;' border=0 " +
           "title='" + sa_tourn.tour_name + " web site' " +
           "onclick='sa_tour_website();'>" +
           "</TD>";
  return(dhtml);
}

function sa_get_scoreboard()
{
  sa_ticlinestyle = "";
  sa_lastpos = "";
  sa_cellspacing=sa_tourn.group_ties;
  var cspan = sa_tourn.std_columns;
  var dhtml = "";
  if (sa_tourn.autosize)
     dhtml += "<DIV style='width:100px;'>" +
              "<TABLE border=0 cellspacing=" + ((sa_cellspacing) ? "1" : "0") + " cellpadding=0 style='" + sa_tourn["css_table"] + "'>" +
              "<TR><TD colspan=" + cspan + ">"
  else
     dhtml += "<DIV style='" + sa_tourn["css_table"] + "margin:auto;text-align:center;'>";
  dhtml += "<TABLE border=0 cellspacing=0 cellpadding=0 style='margin:auto;" + ((sa_tourn.autosize) ? "width:100%;" : "") + "'>" +
           "<TR>";
  if (sa_tourn.logo_pos == "T")
     dhtml += sa_add_logo() + "</TR><TR>"
  else
  if (sa_tourn.logo_pos == "L")
     dhtml += sa_add_logo();
  dhtml += "<TD style='text-align:center;margin:auto;'>";
  dhtml += "<DIV style='" + sa_tourn["css_title"] + "text-align:center;font-weight:bold;padding:1px;'>" +
           sa_tourn.short_name + "</DIV>";
  var cds = sa_tourn.course_dates.split("<BR>");
  var cdj = ((cds.length == 2) ? "<NOBR>" + cds[0] + "</NOBR> <NOBR>" + cds[1] + "</NOBR>" : cds[0]);
  if (sa_tourn.autosize)
     cdj = "<NOBR>" + sa_tourn.course_dates + "</NOBR>";
  dhtml += "<DIV style='" + sa_tourn["css_head"] + "text-align:center;padding:1px;'>" + cdj + "</DIV>";
  dhtml += "</TD>";
  if (sa_tourn.logo_pos == "R")
     dhtml += sa_add_logo();
  dhtml += "</TR></TABLE>";
  dhtml += "<DIV style='" + sa_tourn["css_main"] + "text-align:center;font-weight:bold;padding:1px;clear:both;'>" +
           sa_tourn.round_head + "</DIV>";
  dhtml += "<DIV style='" + sa_tourn["css_main"] + ((sa_tourn.scroll_height != 0) ? "height:" + sa_tourn.scroll_height + "px;overflow:auto;" : "") + "'>";
  if (sa_tourn.autosize)
      dhtml += "</DIV></TD></TR>"
  else
      dhtml += "<TABLE border=0 cellspacing=" + ((sa_cellspacing) ? "1" : "0") + " cellpadding=1 style='margin:auto;text-align:center;'>";
  if (sa_tourn.data_entries != 0)
  {
      for (var i=0; i<sa_tourn.data_entries; i++)
      {
         if (sa_tourn.scores_type == "M")
             dhtml += sa_get_sb_position_matchplay(i)
         else
             dhtml += sa_get_sb_position_strokeplay(i);
      }
  }
  if (sa_tourn.licence_error)
     dhtml += "<TR><TD style='" + sa_tourn["css_head"] + "text-align:center;' colspan=" + cspan + " nowrap>" +
              "<DIV style='font-size:120%;font-weight:bold;margin:5px;padding-top:20px;padding-bottom:20px;'>" +
              "UNLICENSED<BR>SERVICE" +
              "</DIV></TD></TR>"
  else
  if (sa_tourn.data_entries == 0)
     dhtml += "<TR><TD style='" + sa_tourn["css_head"] + "text-align:center;' colspan=" + cspan + " nowrap>" +
              "<DIV style='margin:5px;padding-top:20px;padding-bottom:20px;'>" +
              "No Scoreboard<BR>Currently<BR>Available" +
              "</DIV></TD></TR>";
  if (sa_tourn.autosize)
      dhtml += "<TR><TD colspan=" + cspan + ">"
  else
      dhtml += "</TABLE></DIV>";
  dhtml += "<DIV style='" + sa_tourn["css_main"] + "text-align:center;font-weight:normal;padding:2px;'>";
  if (typeof sa_tourn.report_options != "undefined")
  {
     dhtml += "<DIV style='text-align:center;'><NOBR>" +
              "<SELECT id=sa_options style='" + sa_tourn["css_select"] + "'>";
     for (var i=0; i<sa_tourn.report_options.length; i++)
     {
         var option_data = sa_tourn.report_options[i].split(sa_tourn.array_delimiter);
         dhtml += "<OPTION" + ((i == sa_tourn.report_options_default) ? " selected" : "") + ">";
         dhtml += option_data[0] + "</OPTION>";
     }
     dhtml += "</SELECT>";
     dhtml += "&nbsp;&nbsp;" +
              "<BUTTON style='" + sa_tourn["css_select"] + "' onclick='sa_call_sb_report();' " +
              "title='Open selected report in a new window'>Go&#187;</BUTTON>";
     dhtml += "</NOBR></DIV>";
     dhtml += "<DIV style='font-size:80%; padding:2px; text-align:center;'>" +
              "<A href='javascript:sa_tour_tic();' " +
              "style='" + sa_tourn["css_main"] + "text-decoration:none;padding:1px;' " +
              "title='The information centre provides a full service of tournament scores " +
              "and statistics, orders of merit and player records'>Information&nbsp;Centre&#187;</A>" +
              "</DIV>";
  }
  else
  {
     if (sa_tourn.full_scoreboard_url != "")
         dhtml += "<DIV><A href='javascript:sa_full_scoreboard();' " +
                  "style='" + sa_tourn["css_main"] + "text-decoration:none;padding:1px;' " +
                  "title='" + ((sa_tourn.live_scoring == "Y") ? "Open the live scoring monitor" : "View the full detailed scoreboard") + "'>" +
                  ((sa_tourn.live_scoring == "Y") ? "Live&nbsp;Scoring" : "Full&nbsp;Scoreboard") + "&#187;</A></DIV>";
     if (sa_tourn.logo_pos != "")
         dhtml += "<DIV><A href='javascript:sa_tour_tic();' " +
                  "style='" + sa_tourn["css_main"] + "text-decoration:none;padding:1px;' " +
                  "title='Visit the " + sa_tourn.tour_name + " Information Centre for a full service of scores and statistics'>" +
                  "Information&nbsp;Centre&#187;</A></DIV>";
  }
  dhtml += "</DIV>";
  if (sa_tourn.autosize)
     dhtml += "</TD></TR></TABLE>"
  dhtml += "</DIV>";
  return(dhtml);
}
