// header.js [odpa]

function ViewDay(yr,mm,dd) 
{
    window.open ('cgi-bin/calendar/calendar.pl?ACTION=VIEWDAY&Year=' +yr+ '&Month=' +mm+ '&Date=' +dd + '&config=calendar.cfg','VIEWDAY','scrollbars,resizable,height=400,width=450');
}

function ShowChart()
{
	 var gnChartSize = 300;
	 var gnGoalMembers = 1000;
	 var gnGoalDonations = 20000;
	 var gnGoalDollars = 25000;

	 //var tnCurrMembers = 625;
	 var tnCurrDonations = 20000;
	 var tnCurrDollars = 6000;

	 var tnCurrMemSize = (tnCurrMembers / gnGoalMembers) * gnChartSize;
	 var tnCurrDonSize = (tnCurrDonations / gnGoalDonations) * gnChartSize;
	 var tnCurrDolSize = (tnCurrDollars / gnGoalDollars) * gnChartSize;

	 var gnGoalMemSize = gnChartSize - tnCurrMemSize;
	 var gnGoalDonSize = gnChartSize - tnCurrDonSize;
	 var gnGoalDolSize = gnChartSize - tnCurrDolSize;

	 document.write('<CENTER><B>ODPA Goals</B></CENTER>');

	 document.write('<TABLE BORDER=0><TR>');

	 document.write ('<TD ALIGN="Center">');
	 document.write('<P><TABLE CELLSPACING=0 BORDER=0>'
	 +'<TR>'
	 +'<TD ALIGN=CENTER Class=TextRed><B> '
	 +gnGoalMembers
	 +' </B></TD>'
	 +'</TR>'
	 +'<TR>'
	 +'<TD VALIGN=BOTTOM ALIGN=CENTER><IMG SRC="/images/grey.gif" HEIGHT='
	 +gnGoalMemSize
	 +' WIDTH=50 BORDER=0></TD>'
	 +'</TR>'
	 +'<TR>'
	 +'<TD VALIGN=BOTTOM ALIGN=CENTER><IMG SRC="/images/b.gif" HEIGHT='
	 +tnCurrMemSize
	 +' WIDTH=50 BORDER=0></TD>'
	 +'</TR>'
	 +'</TABLE>');
	 document.write ('</TD>');

	 document.write ('<TD ALIGN="Center">');
	 document.write ('<P><TABLE CELLSPACING=0 BORDER=0>'
	 +'<TR>'
	 +'<TD ALIGN=CENTER><B>$'
	 +gnGoalDonations
	 +'</B></TD>'
	 +'</TR>'
	 +'<TR>'
	 +'<TD VALIGN=BOTTOM ALIGN=CENTER><IMG SRC="/images/grey.gif" HEIGHT='
	 +gnGoalDonSize
	 +' WIDTH=50 BORDER=0></TD>'
	 +'</TR>'
	 +'<TR>'
	 +'<TD VALIGN=BOTTOM ALIGN=CENTER><IMG SRC="/images/a.gif" HEIGHT='
	 +tnCurrDonSize
	 +' WIDTH=50 BORDER=0></TD>'
	 +'</TR>'
	 +'</TABLE>');
	 document.write ('</TD>');

	 document.write ('<TD ALIGN="Center">');
	 document.write ('<P><TABLE CELLSPACING=0 BORDER=0>'
	 +'<TR>'
	 +'<TD ALIGN=CENTER><B>$'
	 +gnGoalDollars
	 +'</B></TD>'
	 +'</TR>'
	 +'<TR>'
	 +'<TD VALIGN=BOTTOM ALIGN=CENTER><IMG SRC="/images/grey.gif" HEIGHT='
	 +gnGoalDolSize
	 +' WIDTH=50 BORDER=0></TD>'
	 +'</TR>'
	 +'<TR>'
	 +'<TD VALIGN=BOTTOM ALIGN=CENTER><IMG SRC="/images/m.gif" HEIGHT='
	 +tnCurrDolSize
	 +' WIDTH=50 BORDER=0></TD>'
	 +'</TR>'
	 +'</TABLE>');

	 document.write ('</TD>');
	 document.write ('</TR>');

	 document.write ('<TR>'
	 +'<TD ALIGN=CENTER Class=TextRed><B>Paid<BR>Members</B></TD>'
	 +'<TD ALIGN=CENTER><B>Fence<BR>Donations</B></TD>'
	 +'<TD ALIGN=CENTER><B>Tribute<BR>Donations</B></TD>'
	 +'</TR>'
	 +'<TR>'
	 +'<TD ALIGN=CENTER Class=TextRed><B>&gt; '
	 +tnCurrMembers
	 +' &lt;</B></TD>'
	 +'<TD ALIGN=CENTER><B>$'
	 +tnCurrDonations
	 +'</B></TD>'
	 +'<TD ALIGN=CENTER><B>$'
	 +tnCurrDollars
	 +'</B></TD>'
	 +'</TR>');
	 document.write ('</TABLE>');
}

function switchOver(fsPass)
{
    tsTemp = fsPass;
    fsTDA = document.getElementById(tsTemp)
    fsTDA.className='over';
    fsTDA.setAttribute("class", "over");
    tsTemp = fsPass + 'a';
    fsTDA = document.getElementById(tsTemp)
    fsTDA.className='over';
    fsTDA.setAttribute("class", "over");
    tsTemp = fsPass + 'l';
    fsTDA = document.getElementById(tsTemp)
    fsTDA.className='over';
    fsTDA.setAttribute("class", "over");
}
function switchUnder(fsPass)
{
    tsTemp = fsPass;
    fsTDA = document.getElementById(tsTemp)
    fsTDA.className='under';
    fsTDA.setAttribute("class", "under");
    tsTemp = fsPass + 'a';
    fsTDA = document.getElementById(tsTemp)
    fsTDA.className='under';
    fsTDA.setAttribute("class", "under");
    tsTemp = fsPass + 'l';
    fsTDA = document.getElementById(tsTemp)
    fsTDA.className='under';
    fsTDA.setAttribute("class", "under");
}

function switchOn(fsPass)
{
    tsTemp = fsPass;
    fsTDA = document.getElementById(tsTemp)
    fsTDA.className='on';
    fsTDA.setAttribute("class", "on");
    tsTemp = fsPass + 'a';
    fsTDA = document.getElementById(tsTemp)
    fsTDA.className='on';
    fsTDA.setAttribute("class", "on");
    tsTemp = fsPass + 'l';
    fsTDA = document.getElementById(tsTemp)
    fsTDA.className='on';
    fsTDA.setAttribute("class", "on");
}

function switchOnB(fsPass)
{
    tsTemp = fsPass;
    fsTDA = document.getElementById(tsTemp)
    fsTDA.className='on2';
    fsTDA.setAttribute("class", "on2");
    tsTemp = fsPass + 'a';
    fsTDA = document.getElementById(tsTemp)
    fsTDA.className='on2';
    fsTDA.setAttribute("class", "on2");
    tsTemp = fsPass + 'l';
    fsTDA = document.getElementById(tsTemp)
    fsTDA.className='on2';
    fsTDA.setAttribute("class", "on2");
}

function switchOff(fsPass)
{
    tsTemp = fsPass;
    fsTDA = document.getElementById(tsTemp)
    fsTDA.className='off';
    fsTDA.setAttribute("class", "off");
    tsTemp = fsPass + 'a';
    fsTDA = document.getElementById(tsTemp)
    fsTDA.className='off';
    fsTDA.setAttribute("class", "off");
    tsTemp = fsPass + 'l';
    fsTDA = document.getElementById(tsTemp)
    fsTDA.className='off';
    fsTDA.setAttribute("class", "off");
}

function switchOffB(fsPass)
{
    tsTemp = fsPass;
    fsTDA = document.getElementById(tsTemp)
    fsTDA.className='off2';
    fsTDA.setAttribute("class", "off2");
    tsTemp = fsPass + 'a';
    fsTDA = document.getElementById(tsTemp)
    fsTDA.className='off2';
    fsTDA.setAttribute("class", "off2");
    tsTemp = fsPass + 'l';
    fsTDA = document.getElementById(tsTemp)
    fsTDA.className='off2';
    fsTDA.setAttribute("class", "off2");
}

var dimages=new Array();
var numImages=21;

for (i=0; i<numImages; i++)
{
  dimages[i]=new Image();
  //dimages[i].src="/gallery/image.php?twg_album=http://www.orangedogpark.com/gallery/pictures/20000000/&twg_random="+i+2+"&twg_type=random&twg_random_size=300&twg_random_subdir=true";
  dimages[i].src="/gallery/image.php?twg_album=20000000&twg_random="+i+2+"&twg_type=random&twg_random_size=300&twg_random_subdir=true";
  // dimages[i].src="images/image"+(i+1)+".jpg";
}
var curImage=-1;

function swapPhoto()
{
//  if (document.images)
 // {
    var nextImage=curImage+1;
    if (nextImage>=numImages)
      nextImage=1;
      if (document.images.myImage)
        target=document.images.myImage;
      if (document.all && document.getElementById("myImage"))
        target=document.getElementById("myImage");
  
      // MAKE SURE TARGET IS VALID.  IT MIGHT NOT BE VALID
      //   IF THE PAGE HAS NOT FINISHED LOADING
//      if (target)
 //     {
        //target.src="/gallery/image.php?twg_album=http://www.orangedogpark.com/gallery/pictures/20000000/&twg_random="+nextImage+"&twg_type=random&twg_random_size=300&twg_random_subdir=true";
        target.src="/gallery/image.php?twg_album=20000000&twg_random="+nextImage+"&twg_type=random&twg_random_size=300&twg_random_subdir=true";
        //target.src=dimages[nextImage].src;
        curImage=nextImage;
  //    }
  //}
  curImage=nextImage;
  setTimeout("swapPhoto()", 500);
}

function swapPicture()
{
  if (document.images)
  {
    var nextImage=curImage+1;
    if (nextImage>=numImages)
      nextImage=0;
    if (dimages[nextImage] && dimages[nextImage].complete)
    {
      var target=0;
      if (document.images.myImage)
        target=document.images.myImage;
      if (document.all && document.getElementById("myImage"))
        target=document.getElementById("myImage");
  
      // make sure target is valid.  It might not be valid
      //   if the page has not finished loading
      if (target)
      {
        //target.src="/gallery/image.php?twg_album=http://www.orangedogpark.com/gallery/pictures/20000000/&twg_random="+nextImage+"&twg_type=random&twg_random_size=300";
        target.src="/gallery/image.php?twg_album=20000000&twg_random="+nextImage+"&twg_type=random&twg_random_size=300";
        curImage=nextImage;
        //target.src=dimages[nextImage].src;
      }

      setTimeout("swapPicture()", 5000);

    }
    else
    {
      setTimeout("swapPicture()", 500);
    }
  }
}

setTimeout("swapPicture()", 5000);
