// standard functions

var initial_page = "homepage.htm";
var fb_field_delim = "&^~/~^?";
var fb_field_sep = "&^/*?";

tours = new Array (
   "Allianz Tour==" +
       "FFG==Paris, France==" +
       "1EUR==1==" +
       "www.allianzgolftour.com/==" +
       "info.ffg.org==*==" +
       "wap.ffg.org==N==" +
       "http://www.ocs-sport.com/images/allianz.jpg==" +
       "images/mlogo-alliance.gif",

   "Alps Tour==" +
       "ALPS==Paris, France==" +
       "1EUR==1==" +
       "www.alpstourgolf.com==" +
       "info.alpstourgolf.com==*==" +
       "wap.alpstourgolf.info==N==" +
       "http://info.alpstourgolf.com/misc/alpstour.gif==" +
       "images/mlogo-alpstour.gif",
 
   "Amatour==" +
       "AMATOUR==London, United Kingdom==" +
       "1EUR==1==" +
       "www.amatour.co.uk==" +
       "amatour.ocs-golf.com==*==" +
       "wap.amatour.ocs-golf.com==Y==" +
       "http://www.ocs-sport.com/images/amalogonew.jpg==" + 
       "images/mlogo-amatour.jpg==", 	     
   
   "Asean Tour==" +
       "ASEAN==Singapore, Asia==" +
       "5SEA==1==" +
       "www.aseangolftour.com.sg==" +
       "asean.ocs-europe1.com==*==" +
       "wap.asean.ocs-europe1.com==N==" +
       "http://www.ocs-sport.com/images/asean.jpg==" +
       "images/mlogo-asean.jpg",
   
   "Asian Tour==" +
       "ASIANTOUR==Kuala Lumpur, Malaysia==" +
       "5SEA==1==" +
       "www.asiantour.com==" +
       "asiantour.ocs-europe1.com==*==" +
       "*==N==" +
       "http://asiantour.ocs-europe1.com/misc/tourlogo.gif==" +
       "images/mlogo-asiantour.gif",

   "English Womens Golf Association==" +
       "ELGA==Birmingham, United Kingdom==" +
       "1EUR==1==" +
       "www.englishwomensgolf.org==" +
       "info.englishladiesgolf.org==*==" +
       "wap.englishladiesgolf.org==Y==" +
       "http://ocs-sport.com/images/ewga.jpg==" + 
       "images/mlogo-ewga.gif==", 
  
   "French Federation==" +
       "FFG==Paris, France==" +
       "1EUR==1==" +
       "www.ffgolf.org==" +
       "==*==" +
       "wap.ffgolf.org==Y==" +
       "http://www.ocs-sport.com/images/ffgolflogo.gif==" +
       "images/mlogo-ffgolf.gif==", 
  
   "Ladies European Tour==" +
       "LET==Manchester, England==" +
       "1EUR==1==" +
       "www.ladieseuropeantour.com==" +
       "www.ladieseuropeantour.info==*==" +
       "wap.ladieseuropeantour.info==Y==" +
       "http://www.ladieseuropeantour.info/misc/letlogo.gif==" +
       "images/mlogo-let.jpg",
   
   "Ladies Golf Union==" +
       "LGU==St.Andrews, Scotland==" +
       "1EUR==4==" +
       "www.lgu.org==" +
       "info.lgu.org==*==" +
       "wap.lgu.org==N==" +
       "http://info.lgu.org/misc/tourlogo.gif==" +
       "images/mlogo-lgu.gif",

   "PGA Tour of Australasia==" +
       "PGATA==Sydney, Australia==" +
       "6AUS==1==" +
       "www.pgatour.com.au==" +
       "info.pgatour.com.au==*==" +
       "*==N==" +
       "http://info.pgatour.com.au/misc/tourlogo.gif==" +
       "images/mlogo-pgatour-au.gif",
       
   "PGA Europro Tour==" +
       "EPT==Birmingham, England==" +
       "1EUR==3==" +
       "www.pga.info/europro.asp==" +
       "www.pga-tic.com==*==" +
       "wap.pga-tic.com==N==" +
       "http://www.pga-tic.com/misc/europro_logo.gif==" +
       "images/mlogo-europro.gif",

   "Professional Golfers' Association==" +
       "PGA==Birmingham, England==" +
       "1EUR==2==" +
       "www.pga.info==" +
       "www.pga-tic.co.uk==*==" +
       "*==N==" +
       "http://www.ocs-sport.com/images/pgalogo.gif==" +
       "images/mlogo-pga.gif",
     
   "Sunshine Tour==" +
       "ST==Cape Town, South Africa==" +
       "3AFR==1==" +
       "www.sunshinetour.com==" +
       "www.sunshinetour.info==*==" +
       "wap.sunshinetour.info==Y==" +
       "http://www.sunshinetour.info/misc/tourlogo.gif==" +
       "images/mlogo-sunshinetour.gif",
       
/*   "Tour de las Americas==" +
       "TDLA==Miami, Florida==" +
       "9LAM==1==" +
       "www.tourdelasamericas.com==" +
       "www.tdla-tic.com==*==" +
       "*==N==" +
       "http://www.tdla-tic.com/misc/tlalogo.gif==" +
       "images/mlogo-tdla.gif",
       
   "Ernie Els Junior Tour==" +
       "EEJT==Johannesburg, South Africa==" +
       "3AFR==2==" +
       "www.ernieels.com/default.aspx?i_CategoryID=60==" +
       "eejtinfo.ernieels.com==*==" +
       "*==N==" +
       "http://eejtinfo.ernieels.com/misc/tourlogo.jpg==" +
       "images/mlogo-eejt.gif",*/
       
   "");
--tours.length;

function extract_tour(tourno)
{
   var t = new Object;
   var te = tours[tourno].split("==");
   t.tname    =  te[0];
   t.tid      =  te[1];
   t.base     =  te[2];
   t.gkcont   =  te[3];
   t.gkno     =  te[4];
   t.website  =  te[5];
   t.ticsite  =  te[6];
   t.addseas  =  te[7];
   t.wapsite  =  te[8];
   t.wapdemo  = (te[9] == "Y");
   t.logo     =  te[10];
   t.logomini =  te[11];
   t.feedcgi  = "tmticd.cgi";
   if ((t.tid == "PGA") || (t.tid == "EPT"))
       t.feedcgi = "tmticdn.cgi";
   return(t);
}

function tours_sort_compare(a, b)
{
   var aa = a.split("==");
   var bb = b.split("==");
   if (aa[3] < bb[3]) return(-1);
   if (aa[3] > bb[3]) return(1);
   if (aa[4] < bb[4]) return(-1);
   if (aa[4] > bb[4]) return(1);
   return(0);
}

function sort_tours()
{
   tours.sort(tours_sort_compare);
}

function get_random_tour()
{
   var x = 99;
   while (x >= tours.length)
   {
       var rstr = "x" + Math.random();
       var x = rstr.charAt(4) - 0;
   }
   return(x);
}

function get_random_scorefeed_url()
{
   var tourno = get_random_tour();
   var t = extract_tour(tourno);
   var ssfurl="http://" + t.ticsite + "/tic/scorefeed.cgi?" +
              "jspref=sf~limit=5~groupties=Y~autosize~fontsize=t~siteid=66667777~";
   return(ssfurl);
}

function navbar_load_page(purl)
{
   if (purl == "n/a")
       alert("Sorry - this page is not yet available")
   else
   {
       var inframe = (purl.indexOf("www") == -1);
       if (inframe)
       {
           var mf = document.getElementById("main_frame");
           mf.src = purl;
       }
       else
           document.location = "http://" + purl;
   }
}

function navbar_option(title, motext, pageurl)
{
   var dhtml = "";
   dhtml += "<TR>" +
            "<TD>";
   dhtml += "<BUTTON class=CSS_NAV_BUTTON style='width:100%;'" +
            " title=\"" + motext + "\"" +
            " onclick='navbar_load_page(\"" + pageurl + "\");'" +
            ">" +
            title +
            "</BUTTON>";
   dhtml += "</TD>" +
            "</TR>";
   document.write(dhtml);
}

function send_internal_email(control, data)
{
   if ((typeof xfer_window != 'object') || (xfer_window.closed))
       xfer_window = window.open("", "OCS_TRANSFER_WINDOW",
                  "location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes" +
                  ",width=280,height=200,", true)
   else
       xfer_window.focus();
   xfer_window.document.write ("<HTML>" +
               "<HEAD>" +
               "<TITLE>OCS Sport Direct Email Server</TITLE>" +
               "</HEAD>" +
               "<BODY style='text-align: center; font-family: tahoma,arial; font-size: 10pt; background-color: #ffffe1; color: black;'>" +
               "<B>Your email is currently being processed.</B><P>Please wait for the server to respond." +
               "<FORM name=f_xfer_out action='http://www.ocs-sport.com/cgi-bin/feedback.cgi' method=POST>" +
               "<input type=hidden name=f_control id=f_control value='" + control + "'>" +
               "<input type=hidden name=f_data id=f_data value='" + data + "'>" +
               "</FORM>" +
               "</BODY>" +
               "</HTML>");
   xfer_window.document.f_xfer_out.submit();
}

function show_disclaimer()
{
   alert ("DISCLAIMER - PLEASE READ CAREFULLY\n\n" +
          "Web site copyright 2009 OCS Sport LTD. All rights reserved.\n\n" +
          "No commercial reproduction, adaptation, distribution or transmission of any part " +
          "or parts of this website or any information contained therein by any means " +
          "whatsoever is permitted without the prior written permission of OCS Sport LTD " +
          ", or in the case of third-party graphic logos, trademarks or content their respective owners.\n\n" +
          "Whilst every effort is made to ensure the accuracy of the information contained " +
          "in this website, its contents are not warranted in any way. Neither the authors " +
          "nor website owner will be held liable for any loss, directly or indirectly caused " +
          "by this website or its contents, and use of the website and its content is solely " +
          "at the risk of the user.\n\n" +
          "By entering this site you agree to these terms and conditions.");
}

// end of script
