﻿
function toggleDays(day)
{
    var tr=document.getElementById(day);
    if (tr==null) {return;}
    var trE = tr.style.display=='';
    tr.style.display=(trE ? 'none' : '');
}
function ExpandRow(day)
{
    // this will take the contents of the specified row and put it into a new div to display all
    var tr=document.getElementById(day);
    if (tr==null) {return;}
    var cnt = tr.innerHTML;
    var dvcontainer=document.getElementById('ttppcontainer');
    var dv=document.getElementById('TeeTimesPopup');
    dv.innerHTML = cnt;
    dvcontainer.style.display='block';
    dv.style.overflow='scroll';
}
function HideRow()
{
    var dv=document.getElementById('TeeTimesPopup');
    var dvcontainer=document.getElementById('ttppcontainer');
    dv.innerHTML = "";
    dvcontainer.style.display='none';
}
function ExpandRow_OLD(day)
{
    var tr=document.getElementById(day);
    if (tr==null) {return;}
    var trE = tr.style.height=='150px';
    if (trE)
    {
        tr.style.height='500px';
        tr.style.overflow='scroll';
        //alert(tr.style.offsetWidth);
        tr.style.width=tr.style.offsetWidth+40 + 'px';
        alert(tr.style.offsetWidth);
       
    }
    else
    {
        tr.style.height='150px';
        tr.style.overflow='hidden';
        
    }
    
}
function toggleAll(day,numcourses)
{
    // toggle day
    var tst='container' + day;
   
    var ht='auto';
    var dsp='block';
    // now toggle courses

   
   //tr.style.display.scrolling='auto';  
        
  
    
    //-=--- courses
     for (var i=0;i<=numcourses;i++)
        {
            var divA=document.getElementById('divam' + day + i);
            var divP=document.getElementById('divpm' + day + i);
            divA.style.height=ht;
            divP.style.height=ht;
            divP.style.display=dsp;
        }
    
}

function toggleAll_NOTWORKING(day,numcourses)
{
    var tst='container' + day;
    var tstdiv=document.getElementById(tst);
    tstdiv.style.height='600px';
    tstdiv.style.overflow='auto';
    var trA=document.getElementById('AM_' + day);
    var trP=document.getElementById('PM_' + day);
    if (trA==null) {return;}
    var trE = trA.style.height;
     if (trE == "100px")
        {
            trA.style.height='auto';
            trP.style.height='auto';
            trP.style.display='block';
            trA.style.scrolling='auto';
            trA.style.overflow='auto';
        }
        else
        {
            trA.style.height='100px';
            trP.style.height='100px';
            trP.style.display='none';
            
        }
    // loop through courses
    for (var i=0;i<=numcourses;i++)
    {
        
        //return;
        //day=i;
       // alert('day ' + day);
        
        var divA=document.getElementById('divam' + day + i);
        var divP=document.getElementById('divpm' + day + i);
        // alert('div' + day + '' +  i)
       
        if (trE == "100px")
        {
           divA.style.height='auto';
            divP.style.height='auto';
            divP.style.display='block';
            
        }
        else
        {
           divA.style.height='100px';
            divP.style.height='100px';
            divP.style.display='none';
            
        }
    }
    
    
}
function atoggle()
{
    return;
}
function toggleLogin()
{
     var tr=document.getElementById('LoginForm');
    if (tr==null) {return;}
    var trE = tr.style.display=='';
    tr.style.display=(trE ? 'none' : '');
    // change the text
    var LI = document.getElementById('LoginLink');
    var LItxt = LI.innerHTML;
    //alert(LItxt);
    if (trE)
    {LItxt="I am a member";}
    else {LItxt="Close";}
    LI.innerHTML = LItxt;
    
}

