//-----------------------------------------------------------------
//-- Copyright 2005 Woodlawn Christian Church. All rights reserved.
//-- Designed by R. E. Woods 3/10/2005.
//-----------------------------------------------------------------
function wcc_menu(thisitem, startstate){ 
  callname = "gl" + thisitem;
  divname = "mu" + thisitem;  
  this.itemnumber = thisitem;
  this.caller = document.getElementById(callname);
  this.thediv = document.getElementById(divname);
  this.thediv.style.visibility = startstate;
}

function wcc_event(event, theobj){
  for (var i = 1; i <= 6; i++){
    var shutdiv = eval("nav" + i + ".thediv");
    shutdiv.style.visibility = "hidden";
  	document.getElementById("gl" + i).style.backgroundColor = "";
  }
  theobj.thediv.style.visibility = "visible";
  document.getElementById("gl" + theobj.itemnumber).style.backgroundColor = "#99e299";
}
				
function wcc_nomenu(event){
  if ((event.clientY < 40)||(event.clientY > 115)){
    for (var i = 1; i <= 6; i++){
      var shutdiv =eval("nav" + i + ".thediv");
	  if (shutdiv) {
      shutdiv.style.visibility = "hidden";
	  }
  	  document.getElementById("gl" + i).style.backgroundColor = "";
    }
  }
}

function wcc_panel(w, c, type) {
  var w_fill = w - 12;
  var imgl = "images/panels/" + c + "_" + type + "l.gif";
  var imgr = "images/panels/" + c + "_" + type + "r.gif";
  var t='<table cellpadding="0" cellspacing="0" width="'+w+'" border="0"><tr>';
  t+='<td width="6" align="left" valign="top"><img src="'+imgl+'" width="6" height="6"></td>';
  t+='<td width="'+w_fill+'" align="center" valign="top" bgcolor="#'+c+'"></td>';
  t+='<td width="6" align="left" valign="top"><img src="'+imgr+'" width="6" height="6"></td>';
  t+='</tr></table>';
  return t;
}

//modified version of a calendar by Brian Gosselin at http://scriptasylum.com/bgaudiodr/
//script featured on Dynamic Drive (http://www.dynamicdrive.com)
function wcc_cal(m, y){
var mn = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
var dim = [31,0,31,30,31,30,31,31,30,31,30,31];
var oD = new Date(y, m-1, 1);
oD.od = oD.getDay() + 1;
var now = new Date();
var hilite = (y==now.getFullYear() && m==now.getMonth()+1)? now.getDate() : 0;
dim[1] = (((oD.getFullYear()%100!=0)&&(oD.getFullYear()%4==0))||(oD.getFullYear()%400==0))?29:28;
var t = '<div class="cal"><table class="cal" cols="7" cellpadding="0" border="0" cellspacing="0"><tr align="center">';
t+='<td colspan="7" align="center" class="calH1">';
t+='<a href="#" onclick="wcc_nxtcal(-1);">';
t+='<img src="images/prev_btn.gif" width="6" height="11" alt="Previous Month" border="0" /></a>';
t+='   '+mn[m-1]+' '+y+'  <a href="#" onclick="wcc_nxtcal(1);">';
t+='<img src="images/next_btn.gif" width="6" height="11" alt="Next Month" border="0" /></a>';
t+='</td></tr><tr align="center">';
for (s = 0; s < 7; s++)t+='<td class="calH2">'+"SMTWTFS".substr(s,1)+'</td>';
t+='</tr><tr align="center">';
for (i = 1; i <= 42; i++){
var x = ((i-oD.od>=0)&&(i-oD.od<dim[m-1]))? i-oD.od+1 : '&nbsp;';
if (x == hilite)
	x = '<span id="now">'+x+'</span>';
t+='<td class="calA">'+x+'</td>';
if (((i)%7==0)&&(i<36))t+='</tr><tr align="center">';
}
return t+='</tr></table></div>';
}

function wcc_nxtcal(inc){
	curmonth = curmonth + inc;
	if (curmonth > 12){
		curmonth = 1;
		curyear++;
	}
	if (curmonth < 1){
		curmonth = 12;
		curyear--;
	}
	if (document.getElementById)
		document.getElementById("calendar").innerHTML = wcc_cal(curmonth, curyear);
	return 0;
}
