function clsCourse(hsh)
{
 for(var h in hsh)
  this[h]=hsh[h];
 this.hOriginals={}; 
 this._Marker=null;
 this._GeoIncomplete=0;
 this.hTees=null;
 this.hHoleInfo=null;
 this.hHoleTeeYards=null;

 this.Changed=0;
 this.ActiveTee="";
 this.ActiveHole=1;
 this.ActiveShot=1;
 this.BoundsZoom=10;
 this.fActiveTee=function(tee){if(tee)this.ActiveTee=tee;return this.ActiveTee;}
 this.fActiveHole=function(hole){if(hole)this.ActiveHole=hole;return this.ActiveHole;}
 this.fActiveShot=function(shot){if(shot)this.ActiveShot=shot;return this.ActiveShot;}
 this.fUpdates=function(obj,items)
 {
  this.Changed=1;
 }
 this.fAbsorb=function(name,hsh)
 {
  this[name]=hsh;
  if(name=="hTees")
  {
   for(var tee in this.hTees) break;
   this.ActiveTee=tee;
   this.ActiveHole=1;
   this.ActiveShot=1;
  }
 }
 this.fActive=function(Shot,hhole)
 {
  try
  {
   if(Shot)
    this.ActiveShot=Shot; 
   if(hhole != null)
   {
    this.ActiveHole=hhole.Hole;
   } 
   var MARKER=null;
   var INFO=this.hHoleInfo[this.ActiveHole];
   var HTY=this.hHoleTeeYards[this.ActiveTee+"_"+this.ActiveHole];
   var TEE=this.hTees[this.ActiveTee];

   var shot=this.ActiveShot;
   if(shot==1)
    MARKER=TEE.hHoles[this.ActiveHole]._TeeMarker;
   else if((shot+1)==INFO.Par)
    MARKER=INFO._GreenMarker;
   else if((shot+2)==INFO.Par)
    MARKER=INFO._ApproachMarker;
   else // if((shot+3)==INFO.Par)
   {
 //   fDebug("Shot:"+shot+":"+INFO._aShotMarkers.length);
    MARKER=INFO._aShotMarkers[shot-2];
   }

   return {
     Hole:this.ActiveHole
    ,Tee:this.ActiveTee
    ,Yards:HTY.Yards
    ,Par:HTY.Par
    ,HCP:HTY.HCP
    ,Shot:this.ActiveShot
    ,hTEE:TEE
    ,hHOLE:TEE.hHoles[this.ActiveHole]
    ,hHTY:+HTY
    ,hINFO:INFO
    ,hMARKER:MARKER
   }
  }
  catch(e)
  {
   fDebug("fActive Error : " + e.description);
   return null;
  }
 };
    
 return this;
}
clsCourse.prototype.fBounds=function(force)
{
 with(this)
 {
  if(_GeoIncomplete==0 || force)
  {
   var nelat=-90,nelng=-180,swlat=90,swlng=180;
   for(var t in hTees)
   {
    for(var h in hTees[t].hHoles)
    {
     with(hTees[t].hHoles[h])
     {
      if(TeeLat < swlat) swlat=TeeLat;
      if(TeeLng < swlng) swlng=TeeLng;
      if(TeeLat > nelat) nelat=TeeLat;
      if(TeeLng > nelng) nelng=TeeLng;
     }
    }
   }
   for(var h in hHoleInfo)
   {
    with(hHoleInfo[h])
    {
     if(Lat < swlat) swlat=Lat;
     if(Lng < swlng) swlng=Lng;
     if(Lat > nelat) nelat=Lat;
     if(Lng > nelng) nelng=Lng;
     for(var p in Polyline)
     {
      if(Polyline[p][0] < swlat) swlat=Polyline[p][0];
      if(Polyline[p][1] < swlng) swlng=Polyline[p][1];
      if(Polyline[p][0] > nelat) nelat=Polyline[p][0];
      if(Polyline[p][1] > nelng) nelng=Polyline[p][1];
     }
    }
   }
   return {sw:{lat:swlat,lng:swlng},ne:{lat:nelat,lng:nelng}};
  }
 }
 return null;
};
clsCourse.prototype.fHoleBounds=function(hole)
{
 var nelat=-90,nelng=-180,swlat=90,swlng=180;
 for(var t in this.hTees)
 {
  with(this.hTees[t].hHoles[hole])
  {
   if(TeeLat < swlat) swlat=TeeLat;
   if(TeeLng < swlng) swlng=TeeLng;
   if(TeeLat > nelat) nelat=TeeLat;
   if(TeeLng > nelng) nelng=TeeLng;
  }
 }
 with(this.hHoleInfo[hole])
 {
  if(Lat < swlat) swlat=Lat;
  if(Lng < swlng) swlng=Lng;
  if(Lat > nelat) nelat=Lat;
  if(Lng > nelng) nelng=Lng;
  for(var p in Polyline)
  {
   if(Polyline[p][0] < swlat) swlat=Polyline[p][0];
   if(Polyline[p][1] < swlng) swlng=Polyline[p][1];
   if(Polyline[p][0] > nelat) nelat=Polyline[p][0];
   if(Polyline[p][1] > nelng) nelng=Polyline[p][1];
  }
 }
// fDebug(fSerialize({sw:{lat:swlat,lng:swlng},ne:{lat:nelat,lng:nelng}}));
 return {sw:{lat:swlat,lng:swlng},ne:{lat:nelat,lng:nelng}};
}
clsCourse.prototype.fHoleMarkers=function(hole,tee)
{
 return {
  TeeMarker:this.hTees[tee||this.ActiveTee].hHoles[hole]._TeeMarker
  ,GreenMarker:this.hHoleInfo[hole]._GreenMarker
  ,ApproachMarker:this.hHoleInfo[hole]._ApproachMarker
  ,aShotMarkers:this.hHoleInfo[hole]._aShotMarkers
 }
};

clsCourse.prototype.fReBuildPolylines=function(param)
{
 for(var hole in this.hHoleInfo)
  this.hHoleInfo[hole]._GreenMarker.fBuildPolyline(param);
}
clsCourse.prototype.fClose=function(gmaps,force)
{
 if(this.hOriginals.hCourse==null)
 {
  return this.Changed=0;
 }
 // hResult {changes:0,tests:0,aTxt:[],hChanges:{}};
 var result = this.fSaveCheck(this.hOriginals.hCourse);
 if(result)
 {
//  fDebug("Force:"+force+" Result:"+result.changes);
  if(force || result.changes == 0 ||window.confirm("\nWe compared "+result.tests+" items and found "+result.changes+" course differences."
     +"\n\nAre you sure you want to discard the changes?"))
  {
   this.fUnLoadMarkers(gmaps,this.hOriginals.hCourse);
   return null;
  }
 }
 return result;
}

clsCourse.prototype.fSaveCheck=function(hsections)
{
 // hsections contains only the first level sections of the this.hOriginals
 var hcounter={changes:0,tests:0,aTxt:[],hChanges:{}};
 var hcoursesections={};
 for(var s in hsections)
  hcoursesections[s]=this[s];
 hcounter.hChanges=fChanges(hsections,hcoursesections,hcounter,true);
 this.Changed=hcounter.changes;
 return hcounter;
}

clsCourse.prototype.fSaveCapture=function(gmaps)
{
 if(this.hTees==null || this.hHoleInfo==null)
 {
  USGMaps.fMsg("Nothing To Save!");
  return;
 }
 if(this._GeoIncomplete==0 && !window.confirm("\n"
    +"\nThis course was already mapped.\n\nAre you sure you want to save these changes?"))
 {
  return;
 }
 var hcounter={changes:0,tests:0,aTxt:[],hChanges:{}};
 var hcoursesections={};
 var hsections={hTees:this.hOriginals.hCourse.hTees,hHoleInfo:this.hOriginals.hCourse.hHoleInfo};
 for(var s in hsections)
  hcoursesections[s]=this[s];
 hcounter.hChanges=fChanges(hsections,hcoursesections,hcounter,true);
 if(hcounter.changes>0)
 {
  var hsections={hTees:this.hTees,hHoleInfo:this.hHoleInfo};
  this.fSave(gmaps,hsections);
 }
}

clsCourse.prototype.fSave=function(gmaps,hsections,callback)
{
 fClientServerMsg("Saving Changes...");
 var url="/include/USGSave.asp?CourseID="+this.CourseID+"&TID="+new Date().getMilliseconds();
 var method="post";
 var hSaved={};
 fCopyObject(hsections,hSaved,"hCourse");
 var b=this.fBounds(1);
 var bnd=new gmaps.LatLngBounds(new gmaps.LatLng(b.sw.lat,b.sw.lng),new gmaps.LatLng(b.ne.lat,b.ne.lng));
 hSaved.hCourse.Latitude=bnd.getCenter().lat();
 hSaved.hCourse.Longitude=bnd.getCenter().lng();

 var content="hObject="+escape(fSerialize(hSaved.hCourse));
 var hcourse=this;
 fAjaxCall({async:true,method:method,url:url,content:content,fcallback:function(req)
  {
   try
   {
    hSaved=null;
    if(req.status == 200)
    {
     hcourse._GeoIncomplete=0;

     // Make Originals to compare if saving again
     hcourse.hOriginals={};
     fCopyObject({hTees:hcourse.hTees,hHoleInfo:hcourse.hHoleInfo,hHoleTeeYards:hcourse.hHoleTeeYards},hcourse.hOriginals,"hCourse");
     
     if(callback)
      callback(req.status);
     else
      USGMaps.fMsg("Thanks so much for mapping "+hcourse.Name);
    }
    else if(req.status == 401)
     USGMaps.fMsg("You are unauthorized to update "+hcourse.Name);
    else
     USGMaps.fMsg("Save Returned ErrorCode :"+req.Status);
//    fDebug("Save Return Status:"+req.status+"<hr>"+req.responseText);
   }
   catch(e)
   {
    fDebug("Save fCourseInfo Error :"+e.description);
   }
   fClientServerMsg();
  }
 });
}
clsCourse.prototype.fBuildMarkers=function(gmaps,hTeesGeo)
{
 gmaps.hCourse=this;
 fRunCaptures.fBreakDownAll();
 var el=fGD("dvCourseName");
 el.innerHTML=this.Name;
 el.style.display="";
 with(this)
 {
  this._GeoIncomplete=0;
  var latlng=_Marker.getPosition();
 //    USGMaps.fMsg(fSerialize(hTees));
  for(var hty in hHoleTeeYards)
  {
   if(hTees[hHoleTeeYards[hty].Tee]!=null)
   {
    var tee=hHoleTeeYards[hty].Tee;
    var hole=String(hHoleTeeYards[hty].Hole);
    hHoleInfo[hole].Par=hHoleTeeYards[hty].Par;
    var teehole=tee+"_"+hole;
    var visible=true;
    if(hTeesGeo[teehole].TeeLat==0 || hTeesGeo[teehole].TeeLng==0)
    {
     visible=false;
     this._GeoIncomplete++;
    }
    hTees[tee].hHoles[hole]=
    {
     _visible:visible
     ,HoleTeeYardsID:hHoleTeeYards[hty].HoleTeeYardsID
     ,Hole:hHoleTeeYards[hty].Hole
     ,Position:hTees[tee].Position
     ,Yards:hHoleTeeYards[hty].Yards
     ,Par:hHoleTeeYards[hty].Par
     ,Tee:tee
     ,HCP:hHoleTeeYards[hty].HCP
     ,TeesGeoID:hTeesGeo[teehole].TeesGeoID
     ,TeeLat:hTeesGeo[teehole].TeeLat==0?latlng.lat():hTeesGeo[teehole].TeeLat
     ,TeeLng:hTeesGeo[teehole].TeeLng==0?latlng.lng():hTeesGeo[teehole].TeeLng
     ,TeeAlt:hTeesGeo[teehole].TeeAlt
 //       ,TeeBox:hTeesGeo[teehole].TeeBox
    };
   }
  }
  for(var tee in hTees) break;
  this.ActiveTee=tee;
  for(var hole in hHoleInfo)
  {
   var holeincomplete=0;
   var hHOLE=hHoleInfo[hole];
   if(hHoleInfo[hole].Lat==0)
   {
    holeincomplete++;
    hHoleInfo[hole].Lat=latlng.lat();
    hHoleInfo[hole].Lng=latlng.lng();
   }
   if(hHOLE.Par > 3)
   {
    for(var p=hHOLE.Polyline.length;p<=hHOLE.Par-4;p++)
    {
     holeincomplete++;
 //       fDebug("Length:"+hHOLE.Polyline.length+" p:"+p);
     hHOLE.Polyline.push([latlng.lat(),latlng.lng()]);
    }
 //      fDebug("Par:"+hHOLE.Par+" Polyline:"+hHOLE.Polyline+" Polyline Length:"+hHOLE.Polyline.length);
   }
   hHOLE._visible=holeincomplete ? false:true;
   this._GeoIncomplete+=holeincomplete;
  }
  fCopyObject({hTees:hTees,hHoleInfo:hHoleInfo,hHoleTeeYards:hHoleTeeYards},this.hOriginals,"hCourse");

  for(var hty in hHoleTeeYards)
  {
   var tee=hHoleTeeYards[hty].Tee;
   var hole=String(hHoleTeeYards[hty].Hole);
   hTees[tee].hHoles[hole]._TeeMarker=new clsTeeCaptureMarker(gmaps,hTees[tee].hHoles[hole],1);
   hTees[tee].hHoles[hole]._TeeMarker.fAddListeners(gmaps);
  }
  for(var hole in hHoleInfo)
  {
   var hHOLE=hHoleInfo[hole];
   var shot=2;
   if(hHOLE.Par > 3)
   {
    if(hHOLE.Par > 4)
    {
     hHOLE._aShotMarkers=new Array();
     for(var p=4;p<hHOLE.Par;p++)
     {
      hHOLE._aShotMarkers.push(new clsFairwayCaptureMarker(gmaps,hHOLE,shot));
      hHOLE._aShotMarkers[p-4].fAddListeners(gmaps);
      shot++;
     }
    }
    hHOLE._ApproachMarker=new clsApproachCaptureMarker(gmaps,hHOLE,shot);
    hHOLE._ApproachMarker.fAddListeners(gmaps);
    shot++;
   }
   hHOLE._GreenMarker=new clsGreenCaptureMarker(gmaps,hHOLE,shot);
   hHOLE._GreenMarker.fAddListeners(gmaps);
   hHOLE._GreenMarker.PolylineOverlay=null;
   hHOLE._GreenMarker.PolygonOverlay=null; //new clsPolygonOverlay(gmaps,hHOLE);
  }
  for(var tee in hTees) break;
  ActiveTee=tee;
  fGDs("dvCourseEdits").display="";
  if(this._GeoIncomplete > 0)
  {
   fBuildCaptures(this);
  }
  else
  {
   fReBuildPolylines();
   var b=fBounds();
   if(b)
   {
    var bnd=new gmaps.LatLngBounds(new gmaps.LatLng(b.sw.lat,b.sw.lng),new gmaps.LatLng(b.ne.lat,b.ne.lng));
    gmaps.map.fitBounds(bnd);
    this._Marker.setPosition(bnd.getCenter());
    gmaps.map.setCenter(bnd.getCenter());
    this.BoundsZoom=gmaps.map.getZoom();
   }
   fGDs("dvTourUtilityToggle").display="";
   if(this._Mapped)
   {
     USGMaps.fMsg("\n"+this.Name + " is already mapped.\n\nModifications are restricted to course personel!\n");
     fGDs("btnCourseEditsSave").display="";
   }
  }
  gmaps.HoldEvents=true;
 }
}
clsCourse.prototype.fUnLoadMarkers=function(gmaps,hsections)
{
 with(this)
 {
  fGDs("dvCourseEdits").display="none";
  fGDs("dvCourseName").display="none";
  gmaps.HoldEvents=false;
  if(hsections.hTees!=null)
  {
   for(var t in hTees)
   {
    for(var h in hTees[t].hHoles)
    {
     if(hTees[t].hHoles[h]._TeeMarker)
     {
      hTees[t].hHoles[h]._TeeMarker.fOnDelete(gmaps);
 //     delete(hTees[t].hHoles[h]._TeeMarker);
 //     hTees[t].hHoles[h]._TeeMarker=null
     }
    }
   }
   hOriginals.hCourse.hTees=null;
   this.hTees=null;
  }
  if(hsections.hHoleTeeYards!=null)
  {
   hOriginals.hCourse.hHoleTeeYards=null;
   this.hHoleTeeYards=null;
  }
  if(hsections.hHoleInfo!=null)
  {
   for(var h in hHoleInfo)
   {
    if(hHoleInfo[h]._aShotMarkers)
    {
     for(var s=0;s<hHoleInfo[h]._aShotMarkers.length;s++)
     {
      hHoleInfo[h]._aShotMarkers[s].fOnDelete(gmaps);
 //     delete(hHoleInfo[h]._aShotMarkers[s]);
 //     hHoleInfo[h]._aShotMarkers[s]=null
     }
    }
    if(hHoleInfo[h]._ApproachMarker)
    {
     hHoleInfo[h]._ApproachMarker.fOnDelete(gmaps);
 //    delete(hHoleInfo[h]._ApproachMarker);
 //    hHoleInfo[h]._ApproachMarker=null
    }
    if(hHoleInfo[h]._GreenMarker)
    {
     hHoleInfo[h]._GreenMarker.fOnDelete(gmaps);
 //    delete(hHoleInfo[h]._ApproachMarker);
 //    hHoleInfo[h]._ApproachMarker=null
    }
   }
   hOriginals.hCourse.hHoleInfo=null;
   this.hHoleInfo=null;
  }
  this.fRemoveGroundOverlays();
  if(this._Marker)
  {
   this.Changed=0;
   this._Marker.fCourseClosed(gmaps);
  }
 }
 gmaps.hCourse=null;
 fGDs("dvTourUtilityToggle").display="none";
}
clsCourse.prototype.fAnimate=function(gmaps)
{
 return;
 var hcourse=this;
 //gmaps.aClicks=[{ "lat":45.48342999373558, "lng":-122.92619705200197 }, { "lat":45.48321937304828, "lng":-122.92626142501832 }, { "lat":45.48291848498617, "lng":-122.92630434036256 }, { "lat":45.48257246172816, "lng":-122.9263472557068 }, { "lat":45.48212112384992, "lng":-122.9263472557068 }, { "lat":45.48159455842211, "lng":-122.92602539062501 }, { "lat":45.48153437920271, "lng":-122.92536020278932 }, { "lat":45.481790140441205, "lng":-122.92473793029787 }, { "lat":45.482286614825085, "lng":-122.92430877685548 }, { "lat":45.48285830718095, "lng":-122.92413711547853 }, { "lat":45.483339727823136, "lng":-122.92405128479005 }, { "lat":45.483580436601535, "lng":-122.92402982711793 }, { "lat":45.483505215218784, "lng":-122.92132616043092 }, { "lat":45.483670702128286, "lng":-122.92190551757814 }, { "lat":45.483640613635444, "lng":-122.92254924774171 }, { "lat":45.48346008234091, "lng":-122.92302131652833 }, { "lat":45.4828282182542, "lng":-122.92345046997072 }, { "lat":45.482557417190485, "lng":-122.92327880859376 }, { "lat":45.48243706074433, "lng":-122.92244195938112 }, { "lat":45.482331748643055, "lng":-122.92214155197145 }, { "lat":45.481684827130664, "lng":-122.9217553138733 }, { "lat":45.48139897572403, "lng":-122.92209863662721 }, { "lat":45.481188347443755, "lng":-122.92278528213502 }, { "lat":45.48129366168231, "lng":-122.92327880859376 }, { "lat":45.48145915508806, "lng":-122.9237723350525 }, { "lat":45.48373087906578, "lng":-122.91971683502199 }, { "lat":45.48371583483744, "lng":-122.92057514190675 }, { "lat":45.48356539233302, "lng":-122.92106866836549 }, { "lat":45.482948573864704, "lng":-122.92156219482423 }, { "lat":45.48231670404109, "lng":-122.92156219482423 }, { "lat":45.48147419991903, "lng":-122.92126178741456 }, { "lat":45.48139897572403, "lng":-122.92012453079225 }, { "lat":45.481579513623274, "lng":-122.91935205459596 }, { "lat":45.48203085584038, "lng":-122.91954517364503 }, { "lat":45.4821813024426, "lng":-122.92001724243165 }, { "lat":45.4821361685041, "lng":-122.92053222656251 }, { "lat":45.482647684356344, "lng":-122.91823625564577 }, { "lat":45.482707862386576, "lng":-122.91860103607179 }, { "lat":45.48261759531713, "lng":-122.91896581649782 }, { "lat":45.48225652559303, "lng":-122.91913747787477 }, { "lat":45.481579513623274, "lng":-122.91853666305543 }, { "lat":45.48147419991903, "lng":-122.91785001754762 }, { "lat":45.48163969279447, "lng":-122.91718482971193 }, { "lat":45.48206094519296, "lng":-122.91716337203981 }, { "lat":45.48252732810305, "lng":-122.91733503341676 }, { "lat":45.48385123274791, "lng":-122.91587591171266 }, { "lat":45.48342999373558, "lng":-122.91604757308961 }, { "lat":45.48296361829795, "lng":-122.91615486145021 }, { "lat":45.48231670404109, "lng":-122.916476726532 }, { "lat":45.48185031938741, "lng":-122.91666984558107 }, { "lat":45.48139897572403, "lng":-122.91675567626955 }, { "lat":45.48188040883644, "lng":-122.91527509689332 }, { "lat":45.482000766471735, "lng":-122.91488885879518 }, { "lat":45.48231670404109, "lng":-122.91486740112306 }, { "lat":45.48248219444177, "lng":-122.91516780853273 }, { "lat":45.48243706074433, "lng":-122.91553258895875 }, { "lat":45.482241480970984, "lng":-122.91606903076173 }, { "lat":45.48194058768621, "lng":-122.91624069213869 }, { "lat":45.48126357191997, "lng":-122.91619777679445 }, { "lat":45.480992763335536, "lng":-122.91523218154909 }, { "lat":45.481098077939706, "lng":-122.91488885879518 }, { "lat":45.482557417190485, "lng":-122.91385889053346 }, { "lat":45.4821813024426, "lng":-122.9137945175171 }, { "lat":45.48166978235595, "lng":-122.91392326354982 }, { "lat":45.48114321270981, "lng":-122.9140090942383 }, { "lat":45.481760050944, "lng":-122.91392326354982 }, { "lat":45.482331748643055, "lng":-122.91360139846803 }, { "lat":45.48266272886994, "lng":-122.91287183761598 }, { "lat":45.48266272886994, "lng":-122.91106939315797 }, { "lat":45.48269281788506, "lng":-122.91171312332155 }, { "lat":45.48260255079149, "lng":-122.91207790374757 }, { "lat":45.482241480970984, "lng":-122.9122281074524 }, { "lat":45.48188040883644, "lng":-122.91175603866579 }, { "lat":45.48163969279447, "lng":-122.91134834289552 }, { "lat":45.48138393087298, "lng":-122.91109085083009 }, { "lat":45.48024051043809, "lng":-122.91263580322267 }, { "lat":45.481022853242536, "lng":-122.91246414184572 } ];
/*
 Fluff to animate an inward spiral for the pins
 var latlng=this.getPosition();
 for(var h=1;h<=hcourse.Holes;h++)
 {
  
 }
*/
 var aPositions=gmaps.aClicks;
 var aMarkers=new Array();
 aMarkers.push(1);
 for(var a=1;a<aPositions.length+1;a++)
  aMarkers.push(0);
 var hole=1;
 var aOldPositions=new Array();
 aOldPositions.push({});
 gmaps.infoWindow.close();
 for(var h=1;h<=hcourse.Holes;h++)
 {
  aOldPositions[h]=hcourse.fHoleMarkers(String(h)).GreenMarker.getPosition();
 }
 window.setTimeout(function()
 {
 gmaps.AnimateID=window.setInterval(
  function()
   {
    var leader=0;
    for(var m=0;m<aPositions.length;m++)
    { 
     if(aMarkers[m]!=0)
     {
      var latlng=new gmaps.LatLng(aPositions[m].lat,aPositions[m].lng);
//      hcourse.fHoleMarkers(String(aMarkers[m])).GreenMarker.fLatLng(latlng);
      hcourse.fHoleMarkers(String(aMarkers[m])).GreenMarker.setPosition(latlng);
      if(hcourse.fHoleMarkers(String(aMarkers[m])).GreenMarker._visilble==false);
       hcourse.fHoleMarkers(String(aMarkers[m])).GreenMarker.setMap(gmaps.map);
      leader++;
     }
    }

    for(var m=aPositions.length;m>=1;m--)
    { 
     aMarkers[m]=parseInt(aMarkers[m-1]);
    }
    if(aMarkers[aPositions.length]!=0)
    {
      var latlng=aOldPositions[aMarkers[aPositions.length]];
      hcourse.fHoleMarkers(String(aMarkers[aPositions.length])).GreenMarker.setPosition(aOldPositions[aMarkers[aPositions.length]]);
      if(hcourse.fHoleMarkers(String(aMarkers[aPositions.length])).GreenMarker._visible==false)
       hcourse.fHoleMarkers(String(aMarkers[aPositions.length])).GreenMarker.setMap(null);
//      hcourse.fHoleMarkers(String(aMarkers[aPositions.length])).GreenMarker.fLatLng(aOldPositions[aMarkers[aPositions.length]]);
    }
    hole++;
    if(hole<=18)
     aMarkers[0]=hole;
    else
     aMarkers[0]=0;
    if(leader==0)
    {
     window.clearInterval(gmaps.AnimateID);
     gmaps.AnimateID=null;
     fDebug("Animation Complete");
     return;
    }
   }
  ,200);},2000);
}
clsCourse.prototype.fLoadGroundOverlays=function(gmaps)
{
 if(this.hGroundOverlays!=null)
 {
  this.fRemoveGroundOverlays();
  this.hGroundOverlays=null;
  gmaps.fMsg("\nOverlays have been removed!\n");
  return;
 }
 var hcourse=this;
 fAjaxCall({async:true,method:"POST",url:"/include/USGMobileQuery.asp",content:"hCall={Type:'Overlays',CourseID:"+this.CourseID+"}",fcallback:function(req)
  {
   try
   {
    var obj=null;
    eval("obj="+req.responseText);
    if(obj.number)
     throw(obj);
    else
    {
     for(var o in obj)
      hcourse.fAddGroundOverlay(USGMaps,obj[o]);
    }
   }
   catch(e){USGMaps.fMsg(e.description);}
  }
 }
 );
}
clsCourse.prototype.fAddGroundOverlay=function(gmaps,hsh)
{
 if(this.hGroundOverlays==null)
    this.hGroundOverlays={};

 if(!this.hGroundOverlays[hsh.Val])
 {
  var bounds=new gmaps.LatLngBounds(new gmaps.LatLng(hsh.South,hsh.West),new gmaps.LatLng(hsh.North,hsh.East));
  this.hGroundOverlays[hsh.Val]=new gmaps.GroundOverlay(hsh.Src,bounds,{clickable:false,map:gmaps.map});
 }
 return this.hGroundOverlays[hsh.Val];
}
clsCourse.prototype.fRemoveGroundOverlays=function()
{
 for(var g in this.hGroundOverlays)
  this.fRemoveGroundOverlay(g);
}
clsCourse.prototype.fRemoveGroundOverlay=function(val)
{
 if(this.hGroundOverlays[val])
 {
  this.hGroundOverlays[val].setMap(null);
  delete this.hGroundOverlays[val];
  this.hGroundOverlays[val]=null;
 }
}

