var today = new Date();
var previousDay = null;

var months = new Array("January","February","March","April","May","June","July","August","September","October","November","December");                                                                                             

var currentM;



function findPos(obj) {

        var curleft = curtop = 0;

        if (obj.offsetParent) { 

                curleft = obj.offsetLeft

                curtop = obj.offsetTop

                while (obj = obj.offsetParent) {

                        curleft += obj.offsetLeft

                        curtop += obj.offsetTop

                }                   

        }                           

        return [curleft,curtop];

}                     
function showSmallBox(idBox, display)
{
if (document.getElementById(idBox + "Box") != null)
{
positions = findPos(document.getElementById(idBox));
var boxElement = document.getElementById(idBox + "Box");
boxElement.style.display = display;
boxElement.style.left = (positions[0] + 45) + "px";
boxElement.style.top = (positions[1] + 47) + "px";
}
}

function showDayBox(idBox, display)

{

if (document.getElementById(idBox + "Box") != null)
{

if (display == "block") {

document.getElementById("featureData").innerHTML = "<div style='height:550px;width:357px;overflow:auto;'>"+document.getElementById(idBox + "Data").innerHTML + "</div>";
document.getElementById("featureData").style.display = "block";
if (previousDay != null)
{
document.getElementById(previousDay + "top").style.backgroundColor = "#a3b3d7";
document.getElementById(previousDay + "top").style.color = "black";
}
document.getElementById(idBox + "top").style.backgroundColor = "#003094";
document.getElementById(idBox + "top").style.color = "white";
previousDay = idBox;
}

}

}



function getNextMonth(currentMonth)

{

showMonth(currentMonth, "none", "normal");

nextMonth = (getMonthByString(currentMonth) + 1) % 12;

nextMonthString = months[nextMonth];

showMonth(nextMonthString, "block", "bold");

currentM = nextMonthString;
document.getElementById("featureData").style.display = "none";
}



function showMonth(month, style, fontStyle)

{

document.getElementById(month + "Table").style.display = style;

document.getElementById(month + "Title").style.fontWeight = fontStyle;

}



function clickTab(currentMonth)

{

showMonth(currentM, "none", "normal");

showMonth(currentMonth, "block", "bold");

currentM = currentMonth;
document.getElementById("featureData").style.display = "none";
}



function getPreviousMonth(currentMonth)

{

showMonth(currentMonth, "none", "normal");

nextMonth = (getMonthByString(currentMonth) - 1);

if (nextMonth == -1)

{

nextMonth = 11;

}

nextMonthString = months[nextMonth];

showMonth(nextMonthString, "block", "bold");

currentM = nextMonthString;
document.getElementById("featureData").style.display = "none";
}



function getMonthByString(month)

{

   for (i = 0; i < 12; i++)

   {

       if (months[i] == month)

       {

           return i;

       }

   }

}


