var ie=document.all
var ns6=document.getElementById&&!document.all
var n=document.layers


if (ie||ns6)    {fShow="visible";fHide="hidden";}
if (n) {fShow="show"; fHide="hide";}

var MonthNames = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

var nCurrentYear = 0;
var nCurrentMonth = 0;

var nWidth  = 20;
var nHeight = 20;

var leftX;
var rightX
var topY;
var bottomY;


function Calendar()
{

var HTMLstr = "";

HTMLstr += "<table width='193px' cellspacing='0' cellpadding='0' border='0'>\n";
HTMLstr += "<tr>\n";
HTMLstr += "<td>\n";
HTMLstr += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" bgcolor=\"#EEEEEE\">\n";
HTMLstr += "<tr>\n";
HTMLstr += "<td  width=\"28\">\n";
HTMLstr += "<a href=\"javascript:prevMonth();\">\n";
HTMLstr += "<img border=\"0\" src=\"images/calendar/left.jpg\" width=\"28\" height=\"23\"></a></td>\n";
HTMLstr += "<td align=\"right\" style=\"font-family: Verdana; font-size: 11px; color: #AA0000; font-weight: bold; padding-top: 7px; padding-bottom: 4px; padding-top: 5px; padding-bottom: 4px\">\n";

if (ie||ns6)
	HTMLstr += "<div id='main2'>";
if (n) 
	HTMLstr += "<ilayer id='main2'><layer id='idMonth' top='0' left='0'>\n";

HTMLstr += "Month Name";

if (ie||ns6)
	HTMLstr += "<div>\n";
if (n) 
	HTMLstr += "</layer></ilayer>\n";

HTMLstr += "</td>\n";
HTMLstr += "<td width=\"20\" align=\"center\" style=\"font-family: Verdana; font-size: 11px; color: #AA0000; font-weight: bold; padding-left: 6px; padding-right: 6px; padding-top: 5px; padding-bottom: 4px\">/</td>\n";
HTMLstr += "<td align=\"left\" style=\"font-family: Verdana; font-size: 11px; color: #AA0000; font-weight: bold; padding-top: 7px; padding-bottom: 4px; padding-top: 5px; padding-bottom: 4px\">\n";

if (n) 
	HTMLstr += "<ilayer id='main'><layer id='idYear' top='0' left='0'>\n";
if (ie||ns6)
	HTMLstr += "<div id='main' style='position: relative'>\n";
	
	HTMLstr += "Year";
	
if (n) 
	HTMLstr += "</layer></ilayer>\n";
if (ie||ns6)
	HTMLstr += "</div>\n";

HTMLstr += "</td>\n";
HTMLstr += "<td align=\"right\" width=\"29\">\n";
HTMLstr += "<a href=\"javascript:nextMonth();\">\n";
HTMLstr += "<img border=\"0\" src=\"images/calendar/right.jpg\" width=\"29\" height=\"23\"></a></td>\n";
HTMLstr += "</tr>\n";
HTMLstr += "</table>\n";
HTMLstr += "</td>\n";
HTMLstr += "</tr>\n";

HTMLstr += "<tr>\n";
HTMLstr += "<td><img border=\"0\" src=\"images/calendar/02.jpg\" width=\"193\" height=\"22\"></td>\n";
HTMLstr += "</tr>\n";

HTMLstr += "<tr>\n";
HTMLstr += "<td>\n";
HTMLstr += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" id=\"table3\">\n";
HTMLstr += "<tr>\n";
HTMLstr += "<td width=\"4\">&nbsp;</td>\n";
HTMLstr += "<td style=\"border-left:2px solid #E7E7E7; border-bottom:2px solid #E7E7E7; padding-left:8px; padding-right:7px; padding-bottom:16px\" bordercolor=\"#E7E7E7\">\n";

HTMLstr += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" id=\"table4\">\n";
HTMLstr += "<tr>\n";
HTMLstr += "<td height=\"6\" bgcolor=\"#F8F8F8\"></td>\n";
HTMLstr += "</tr>\n";
HTMLstr += "<tr>\n";
HTMLstr += "<td>\n";

HTMLstr += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" id=\"table5\">\n";
HTMLstr += "<tr>\n";
HTMLstr += "<td width=\"9\">&nbsp;</td>\n";
HTMLstr += "<td>\n";

HTMLstr += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" id=\"table6\">\n";

HTMLstr += "<tr>\n";
HTMLstr += "<td style=\"font-family: Verdana; font-size: 12px; color: #FFFFFF; font-weight: bold; background-color:#C90004; border-right:2px solid #F9F9F9\" align=\"center\">S</td>\n";
HTMLstr += "<td style=\"font-family: Verdana; font-size: 12px; color: #FFFFFF; font-weight: bold; background-color:#D9D9D9; border-left:2px solid #F9F9F9; border-right:2px solid #F9F9F9\" align=\"center\">M</td>\n";
HTMLstr += "<td style=\"font-family: Verdana; font-size: 12px; color: #FFFFFF; font-weight: bold; background-color:#D9D9D9; border-left:2px solid #F9F9F9; border-right:2px solid #F9F9F9\" align=\"center\">T</td>\n";
HTMLstr += "<td style=\"font-family: Verdana; font-size: 12px; color: #FFFFFF; font-weight: bold; background-color:#D9D9D9; border-left:2px solid #F9F9F9; border-right:2px solid #F9F9F9\" align=\"center\">W</td>\n";
HTMLstr += "<td style=\"font-family: Verdana; font-size: 12px; color: #FFFFFF; font-weight: bold; background-color:#D9D9D9; border-left:2px solid #F9F9F9; border-right:2px solid #F9F9F9\" align=\"center\">T</td>\n";
HTMLstr += "<td style=\"font-family: Verdana; font-size: 12px; color: #FFFFFF; font-weight: bold; background-color:#D9D9D9; border-left:2px solid #F9F9F9; border-right:2px solid #F9F9F9\" align=\"center\">F</td>\n";
HTMLstr += "<td style=\"font-family: Verdana; font-size: 12px; color: #FFFFFF; font-weight: bold; background-color:#D9D9D9; border-left:2px solid #F9F9F9\" align=\"center\">S</td>\n";
HTMLstr += "</tr>\n";

HTMLstr += "<tr>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  font-family:Verdana; font-size:11px; color:#5C575E; padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d0\">0</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  font-family:Verdana; font-size:11px; color:#5C575E; padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d1\">1</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  font-family:Verdana; font-size:11px; color:#5C575E; padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d2\">2</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  font-family:Verdana; font-size:11px; color:#5C575E; padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d3\">3</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  font-family:Verdana; font-size:11px; color:#5C575E; padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d4\">4</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  font-family:Verdana; font-size:11px; color:#5C575E; padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d5\">5</div></td>\n";
HTMLstr += "<td style=\"border-bottom:2px solid #F1F1F1; font-family:Verdana; font-size:11px; color:#5C575E; padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d6\">6</div></td>\n";
HTMLstr += "</tr>\n";

HTMLstr += "<tr>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d7\">7</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d8\">8</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d9\">9</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d10\">10</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d11\">11</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d12\">12</div></td>\n";
HTMLstr += "<td style=\"border-bottom:2px solid #F1F1F1; padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d13\">13</div></td>\n";
HTMLstr += "</tr>\n";

HTMLstr += "<tr>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d14\">14</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d15\">15</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d16\">16</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d17\">17</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d18\">18</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d19\">19</div></td>\n";
HTMLstr += "<td style=\"border-bottom:2px solid #F1F1F1; padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d20\">20</div></td>\n";
HTMLstr += "</tr>\n";

HTMLstr += "<tr>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d21\">21</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d22\">22</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d23\">23</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d24\">24</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d25\">25</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d26\">26</div></td>\n";
HTMLstr += "<td style=\"border-bottom:2px solid #F1F1F1; padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d27\">27</div></td>\n";
HTMLstr += "</tr>\n";

HTMLstr += "<tr>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1; font-family:Verdana; font-size:11px; color:#5C575E; padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d28\">28</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1; font-family:Verdana; font-size:11px; color:#5C575E; padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d29\">39</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  font-family:Verdana; font-size:11px; color:#5C575E; padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d30\">30</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  font-family:Verdana; font-size:11px; color:#5C575E; padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d31\">31</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  font-family:Verdana; font-size:11px; color:#5C575E; padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d32\">32</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; border-bottom:2px solid #F1F1F1;  font-family:Verdana; font-size:11px; color:#5C575E; padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d33\">33</div></td>\n";
HTMLstr += "<td style=\"border-bottom:2px solid #F1F1F1; font-family:Verdana; font-size:11px; color:#5C575E; padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d34\">34</div></td>\n";
HTMLstr += "</tr>\n";

HTMLstr += "<tr>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; font-family:Verdana; font-size:11px; color:#5C575E; padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d35\">35</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; font-family:Verdana; font-size:11px; color:#5C575E; padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d36\">36</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; font-family:Verdana; font-size:11px; color:#5C575E; padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d37\">37</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; font-family:Verdana; font-size:11px; color:#5C575E; padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d38\">38</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; font-family:Verdana; font-size:11px; color:#5C575E; padding-top: 2px; padding-bottom: 2px;  \" align=\"center\"><div  id=\"d39\">39</div></td>\n";
HTMLstr += "<td style=\"border-right:2px solid #F1F1F1; font-family:Verdana; font-size:11px; color:#5C575E; padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d40\">40</div></td>\n";
HTMLstr += "<td style=\"font-family:Verdana; font-size:11px; color:#5C575E; padding-top: 2px; padding-bottom: 2px; \" align=\"center\"><div  id=\"d41\">41</div></td>\n";
HTMLstr += "</tr>\n";

HTMLstr += "</table>\n";

HTMLstr += "</td>\n";
HTMLstr += "<td width=\"8\">&nbsp;</td>\n";
HTMLstr += "</tr>\n";
HTMLstr += "</table>\n";												

HTMLstr += "</td>\n";
HTMLstr += "</tr>\n";
HTMLstr += "</table>\n";


HTMLstr += "</td>\n";
HTMLstr += "<td width=\"8\">&nbsp;</td>\n";
HTMLstr += "</tr>\n";
HTMLstr += "</table>\n";
HTMLstr += "</td>\n";
HTMLstr += "</tr>\n";
HTMLstr += "</table>\n";

document.writeln(HTMLstr);
buildMonthMenu(HTMLstr);
}


function setCurrentMonth()
{
  date = new Date();
  currentyear=date.getYear()
  if (currentyear < 1000)
  currentyear+=1900
  setYearMonth(currentyear, date.getMonth()+1);
}

function setMonth(nMonth)
{
	setYearMonth(nCurrentYear, nMonth);
}

function setYearMonth(nYear, nMonth)
{

  if (ie||ns6)
{
  nCurrentYear = nYear;
  nCurrentMonth = nMonth;
  var cross_obj=ns6? document.getElementById("main"): document.all["main"]
  var cross_obj2=ns6? document.getElementById("main2"): document.all["main2"]
  cross_obj.innerHTML  = nCurrentYear;
  cross_obj2.innerHTML = MonthNames[nCurrentMonth-1];

  var date   = new Date(nCurrentYear, nCurrentMonth-1, 1);
  var nWeek  = 1;
  var nDate;

	var pos;

	var daysInMonth = 32 - new Date(nCurrentYear, date.getMonth(), 32).getDate();
	
	for(pos = 0; pos < date.getDay(); pos++)
	{
		var x = document.getElementById("d" + pos);
/*		
		if(pos != 6)
			x.style.borderRight="2px solid #F1F1F1";
		
		x.style.borderBottom="2px solid #F1F1F1";
*/		
		x.innerHTML = "&nbsp;";
	}

	var flag = 0;
	
  while (date.getMonth() == nCurrentMonth-1)
  {

		var ldate;
	 
		ldate  = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();  // date
		ldate += "-";
		ldate += date.getMonth() < 9 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1; // month
		ldate += "-";	
		ldate += nCurrentYear; // year
		
		var str = "<a style=\"font-family:Verdana; font-size:11px; color:#5C575E; text-decoration: none\" href=\"booking.php?date=" + ldate + "\">" + date.getDate() + "</a>"

		
		var x = document.getElementById("d" + pos);
/*
		if(((pos+1)%7) != 0)
			x.style.borderRight="2px solid #F1F1F1";

		if((pos+1)%7 == 1)
		{

			if((date.getDate() + 7) > daysInMonth)
				flag = 1;
			
		}
		
		if(flag == 0)
			x.style.borderBottom="2px solid #F1F1F1";
*/				
		x.innerHTML = str;

		pos++;
		
//	nDate = date.getDate();
//	nLastDate = nDate;

//	var posDay = date.getDay()-1;
//	if (posDay == -1) posDay=6;
//	var posLeft = posDay*(nWidth+5)+5;
//	var posTop  = (nWeek-1)*nHeight;
	
//    var cross_obj3=ns6? document.getElementById("idDate"+nDate).style : document.all["idDate"+nDate].style

//    var cross_obj4=ns6? document.getElementById("idDatel"+nDate) : document.all["idDatel"+nDate]

//	cross_obj4.href="abc.php?" + date.getDate() + "-" + date.getMonth() + "-" + nCurrentYear;
	

//	cross_obj3.left = posLeft;
//	cross_obj3.top  = posTop;

//	if (date.getDay() == 0 || date.getDay() == 6)
//		cross_obj3.color  = "red";
//	else
//		cross_obj3.color  = "black";
		
//	cross_obj3.visibility = "visible";
	
	date = new Date(nCurrentYear, date.getMonth(), date.getDate()+1);
	
//	if (posDay == 6) nWeek++;
  }
  
  for(var i = pos; i <= 41; i++)
		document.getElementById("d" + i).innerHTML = "&nbsp;";
  
//  for (++nDate; nDate <= 31; nDate++){
//        cross_obj3=ns6? document.getElementById("idDate"+nDate).style : document.all["idDate"+nDate].style
//	cross_obj3.visibility = "hidden";
//      }
}
  if (n)
{

  // Verify parameters
  if (nMonth < 1 || nMonth > 12) {alert("Function: setYearMonth()\nERROR: Incorrect month "+nMomth);}

  nCurrentYear = nYear;
  nCurrentMonth = nMonth;

  document.main.document.idYear.document.open();
  document.main.document.idYear.document.write("<font color=\"#99ffff\"><b>"+nCurrentYear+"</b></font>");
  document.main.document.idYear.document.close();

  document.main2.document.idMonth.document.open();
  document.main2.document.idMonth.document.write("<a href=\"javascript:showMonthMenu()\" style=\"text-decoration:none\"><font color=\"#99ffff\"><b>"+MonthNames[nCurrentMonth-1]+"</b></font></a>");
  document.main2.document.idMonth.document.close();

  var date   = new Date(nYear, nMonth-1, 1);
  var nWeek  = 1;
  var nDate;

  while (date.getMonth() == nMonth-1)
  {
  
  
	nDate = date.getDate();
	nLastDate = nDate;

	var posDay = date.getDay()-1;
	if (posDay == -1) posDay=6;
	var posLeft = posDay*(nWidth+5)+5;
	var posTop  = (nWeek-1)*nHeight;

	document.layers["idMenuContainer"].document.layers["idDate"+nDate].left = posLeft;
	document.layers["idMenuContainer"].document.layers["idDate"+nDate].top  = posTop;
	if (date.getDay() == 0 || date.getDay() == 6)
		document.layers["idMenuContainer"].document.layers["idDate"+nDate].color  = "red";
	else
		document.layers["idMenuContainer"].document.layers["idDate"+nDate].color  = "black";
	document.layers["idMenuContainer"].document.layers["idDate"+nDate].visibility = "visible";
	date = new Date(nCurrentYear, date.getMonth(), date.getDate()+1);
	if (posDay == 6) nWeek++;
  }
  for (++nDate; nDate <= 31; nDate++)
	document.layers["idMenuContainer"].document.layers["idDate"+nDate].visibility = "hidden";
}
}

function nextMonth()
{
  nCurrentMonth++;
  if (nCurrentMonth > 12)
  {
	nCurrentMonth -= 12;
	nextYear();
  }
  
  setYearMonth(nCurrentYear, nCurrentMonth);
}


function prevMonth()
{
  nCurrentMonth--;
  if (nCurrentMonth < 1)
  {
	nCurrentMonth += 12;
	prevYear();
  }
  setYearMonth(nCurrentYear, nCurrentMonth);

}

function prevYear()
{
  nCurrentYear--;
  setYearMonth(nCurrentYear, nCurrentMonth);
}

function nextYear()
{
  nCurrentYear++;
  setYearMonth(nCurrentYear, nCurrentMonth);
}

////////////////////////////////////////////////////

function updateIt(e)
{
//  var x = e.pageX;
//  var y = e.pageY;

//  if (x > rightX || x < leftX) hideMonthMenu();
//  else if (y > bottomY || y < topY) hideMonthMenu();
}

function hideMonthMenu()
{
  document.layers["idMonthMenu"].visibility="hide";
}

function showMonthMenu()
{
if (!n) return;
  topY    = document.layers["main2"].pageY-50;
  bottomY = document.layers["main2"].pageY + document.layers["idMonthMenu"].clip.height+50;
  leftX   = document.layers["main2"].pageX-50;
  rightX  = document.layers["main2"].pageX + document.layers["idMonthMenu"].clip.width+50;

  document.layers["idMonthMenu"].top = document.layers["main2"].pageY+document.layers["main2"].clip.height;
  document.layers["idMonthMenu"].left = document.layers["main2"].pageX;
  document.layers["idMonthMenu"].visibility="show";
}

function buildMonthMenu()
{

if (!n) return;
  var HTML = "";
  HTML += "<layer id=\"idMonthMenu\" visibility=\"hide\" width=\"120\" bgcolor=\"darkblue\">\n";
  HTML += "<table border=\"1\" cellspacing=\"0\" cellpading=\"0\">\n";
  for (var month=0; month<12;)
  {
	HTML += "<tr>\n";
	for (var i = 0; i < 3; i++)
	{
		var nMonth = month+1;
		HTML += "<td><a href=\"javascript:hideMonthMenu();setMonth("+nMonth+");\"><font color=\"white\" size=-1><b>"+MonthNames[month]+"</b></font></a></td>\n";
		month++;
	}
	HTML += "</tr>\n";
  }
  HTML += "</table>";
  HTML += "</layer>";
  document.writeln(HTML);
}

