/*
* Filename.......: calendar.js
* Project........: Popup Calendar
* Last Modified..: $Date: 2002/07/22 18:17:05 $
* CVS Revision...: $Revision: 1.2 $
* Copyright......: 2001, 2002 Richard Heyes
*/
var globalMonth;
var globalLastRow;
//numer tygodnia.

//alert(typeof window.$F);
/*
//if(typeof window.$F != "function")
//{
	
	function $F($n)
	{
		return $("#"+$n).val();
	}
}
*/
Date.prototype.getWeek = function() {                                                                                                                                              
    var determinedate = new Date();                                                                                                                                                
    determinedate.setFullYear(this.getFullYear(), this.getMonth(), this.getDate());                                                                                                
    var D = determinedate.getDay();                                                                                                                                                
    if(D == 0) D = 7;                                                                                                                                                              
    determinedate.setDate(determinedate.getDate() + (4 - D));                                                                                                                      
    var YN = determinedate.getFullYear();                                                                                                                                          
    var ZBDoCY = Math.floor((determinedate.getTime() - new Date(YN, 0, 1, -6)) / 86400000);                                                                                        
    var WN = 1 + Math.floor(ZBDoCY / 7);                                                                                                                                           
    return WN;                                                                                                                                                                     
}                                                                                                                                                                                  
                                                                                                                                                                                   
function getWeekNr(Year, Month, Day)                                                                                                                                               
{                                                                                                                                                                                  
                                                                                                                                                                                   
        var weekNr = new Date();                                                                                                                                                   
        weekNr.setFullYear(Year, Month, Day);                                                                                                                                      
        var weeknumber = weekNr.getWeek();                                                                                                                                         
        return weeknumber;                                                                                                                                                         
}                                                                                                                                                                                  


function takeYear(theDate)
{
	x = theDate.getYear();
	var y = x % 100;
	y += (y < 38) ? 2000 : 1900;
	return y;
}

function setGlobalMonth(month)
{
	globalMonth = month;
}

function setGlobalLastRow(row)
{
	globalLastRow = row
}


function getSwitcher()
{
	try{
		var $periodType = $F("timePeriod");	
	}
	catch(e)
	{
	    //var $periodType = $("#timePeriod").val();
	    return 1;
	}
	return $periodType;
}

function checkRowSelection(obj, fill, weekFill, prefix)
{
	regexik = /prev/;
	if(regexik.test(obj))
	{
		var fakePrefix = '1_0_'+globalMonth;
		checkRowSelection(fakePrefix, fill, 1, prefix);
		return;
	}
	regexikNext = /next/;
	if(regexikNext.test(obj))
	{
		//alert(globalMonth);
		daysInMonth = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
		
		var fakePrefix = daysInMonth[globalMonth]+'_'+globalLastRow+'_'+globalMonth;
		checkRowSelection(fakePrefix, fill, 1, prefix);
		return;
	}
	
	var d = document;
	//jak dzien, to return.
	var switcher = getSwitcher();
	if(switcher==1){
		//nie podswietlaj
		//alert(obj.innerHTML);
		
		return;
	}
	 var year = globalYear;
	var rowNr = obj.split("_");
	/*if(fill == 1)
	{	fill = "#FF2F14";
	}
	else
		fill = "#eeeeee";
	*/
	//var date
	fill==1?fill="#FF2F14":"#eeeeee";
	weekNr = getWeekNr(year,rowNr[2], rowNr[0]-1);
	//alert(weekNr);
	
	if(switcher == 1)
	{
		for(i=0;i<7;i++)
		{
			if(d.getElementById(firstWeek+i+prefix))
				d.getElementById(firstWeek+i+prefix).style.background = fill;
		}
	}
	else if(switcher == 2)
	{
		for(i=0; i<33; i++)
		{
			if(d.getElementById(i+"_"+rowNr[1]+"_"+rowNr[2]+"_"+prefix))
				d.getElementById(i+"_"+rowNr[1]+"_"+rowNr[2]+"_"+prefix).style.background = fill;
		}
		if(rowNr[1] == 0)
			for(i=0;i<8;i++)
				if(document.getElementById('prev'+i+prefix))
					document.getElementById('prev'+i+prefix).style.background = fill;
		if(weekFill == 1)
		{
			if(weekNr == 0)
				weekNr =52;
			if(d.getElementById(weekNr+prefix))
				d.getElementById(weekNr+prefix).style.background = fill;
		}
		if(rowNr[1] == globalLastRow)
			for(i=1;i<7;i++)
				if(d.getElementById('next'+globalLastRow+i+prefix))
					d.getElementById('next'+globalLastRow+i+prefix).style.background = fill;

	}
	else if(switcher==3)
	{
		for(i=0;i<33;i++)
		{
			for(j=0;j<6;j++)
				if(d.getElementById(i+"_"+j+"_"+globalMonth+"_"+prefix))
					d.getElementById(i+"_"+j+"_"+globalMonth+"_"+prefix).style.background = fill;
				
			
		}
		for(i=0;i<7;i++)
		{
			
			if(d.getElementById(firstWeek+i+prefix))
				d.getElementById(firstWeek+i+prefix).style.background = fill;
		}
	}
}

function checkPeriod(obj,dateID,fill, kuka,prefix)
{
	var d = document;
	switcher = getSwitcher()
	//jak dzien
	
	if(switcher ==1)
	{
		try{
		    var qqq = obj.childNodes[0].innerHTML;
		}catch(e){
		    var qqq = '';
		}
		if(qqq) obj.innerHTML = qqq;
		
		return;
	}
	//tydzien
	else if(switcher ==2)
	{	
		obj.className  = 'dynCalendar_day';
		checkRowSelection(dateID, fill,0, prefix);
	//	alert(obj.id);	
	}
	else if(switcher==3)
	{	
		checkRowSelection(dateID, fill, 0, prefix);
	}
	
}
var globalYear;
var firstWeek;
function setglobalYear(val)
{
  	  globalYear = val
}

function setFirstWeek(val)
{
  	firstWeek = val;

}
function getDateInfo()
{
//var y = document.form.year.value;
//var m = document.form.month.options[document.form.month.options.selectedIndex].value;
//var d = document.form.day.options[document.form.day.options.selectedIndex].value;
	var hlpr = mtend[m];
	if (d < mtend[m] + 1)
	{
		if (m == 1 && y % 4 == 0) { hlpr++; }
		var c = new Date(y,m,d);
		var dayOfWeek = c.getDay();
		document.form.dw.value = days[dayOfWeek];
		if(c.getTime() > new Date().getTime())
		{
			document.form.time.value = opt[1];
		}
		else
		{
			document.form.time.value = opt[0];
   		}
	}
	else
	{
		alert("The date "+months[m]+" "+d+", "+y+" is invalid.\nCheck it again.");
	}
}

function dateFromWeek(val, prefix)
{
	
	var check =  val.split("_");
	switcher = getSwitcher();
	if(switcher ==1)
		return;
	calCallback(check[0], check[1] , check[2], prefix);
}


/**
* Global variables
*/
	dynCalendar_layers          = new Array();
	dynCalendar_mouseoverStatus = false;
	dynCalendar_mouseX          = 0;
	dynCalendar_mouseY          = 0;

/**
* The calendar constructor
*
* @access public
* @param string objName      Name of tvar regex = new RegExp("[0-9]{1}");
	if(document.getElementById(regex))
		alert(1);
	he object that you create
* @param string callbackFunc Name of the callback function
* @param string OPTIONAL     Optional layer name
* @param string OPTIONAL     Optional images path
*/
	function dynCalendar(objName, callbackFunc,calObjID)
	{
		/**
        * Properties
        */
		// Todays date
		this.today          = new Date();
		this.date           = this.today.getDate();
		this.month          = this.today.getMonth();
		this.year           = this.today.getFullYear();

		this.objName        = objName;
		this.callbackFunc   = callbackFunc;
		this.calObjID 		= calObjID
		this.imagesPath     = '';//arguments[2] ? arguments[2] : 'images/';
		this.layerID        = arguments[3] ? arguments[3] : 'dynCalendar_layer_' + dynCalendar_layers.length;

		this.offsetX        = 5;
		this.offsetY        = 5;

		this.useMonthCombo  = true;
		this.useYearCombo   = true;
		this.yearComboRange = 5;

		this.currentMonth   = this.month;
		this.currentYear    = this.year;

		/**
        * Public Methods
        */
		this.show              = dynCalendar_show;
		this.writeHTML         = dynCalendar_writeHTML;

		// Accessor methods
		this.setOffset         = dynCalendar_setOffset;
		this.setOffsetX        = dynCalendar_setOffsetX;
		this.setOffsetY        = dynCalendar_setOffsetY;
		this.setImagesPath     = dynCalendar_setImagesPath;
		this.setMonthCombo     = dynCalendar_setMonthCombo;
		this.setYearCombo      = dynCalendar_setYearCombo;
		this.setCurrentMonth   = dynCalendar_setCurrentMonth;
		this.setCurrentYear    = dynCalendar_setCurrentYear;
		this.setYearComboRange = dynCalendar_setYearComboRange;


		/**
        * Private methods
        */
		// Layer manipulation
		this._getLayer         = dynCalendar_getLayer;
		this._hideLayer        = dynCalendar_hideLayer;
		this._showLayer        = dynCalendar_showLayer;
		this._setLayerPosition = dynCalendar_setLayerPosition;
		this._setHTML          = dynCalendar_setHTML;

		// Miscellaneous
		this._getDaysInMonth   = dynCalendar_getDaysInMonth;
		this._mouseover        = dynCalendar_mouseover;

		/**
        * Constructor type code
        */
		dynCalendar_layers[dynCalendar_layers.length] = this;
		this.writeHTML();
	}

/**
* Shows the calendar, or updates the layer if
* already visible.
*
* @access public
* @param integer month Optional month number (0-11)
* @param integer year  Optional year (YYYY format)
*/
	function dynCalendar_show()
	{
	
		// Variable declarations to prevent globalisation
		var month, year, monthnames, numdays, thisMonth, firstOfMonth;
		var ret, row, i, cssClass, linkHTML, previousMonth, previousYear;
		var nextMonth, nextYear, prevImgHTML, prevLinkHTML, nextImgHTML, nextLinkHTML;
		var monthComboOptions, monthCombo, yearComboOptions, yearCombo, html;
		
		this.currentMonth = month = arguments[0] != null ? arguments[0] : this.currentMonth;
		this.currentYear  = year  = arguments[1] != null ? arguments[1] : this.currentYear;
                setglobalYear(this.currentYear);
		
		
		monthnames = new Array('Január', 'Február', 'Marec', 'Apríl', 'Máj', 'Jún', 'Júl', 'August', 'September', 'Október', 'November', 'December');
		numdays    = this._getDaysInMonth(month, year);

		thisMonth    = new Date(year, month, 1);
		firstOfMonth = thisMonth.getDay();
		month = thisMonth.getMonth();
		//lata na miesiace, ktore zaczynaja sie pierwszego. ustawia im wtedy poczatek tygodnia na poniedzialek,
		//bo java zwraca 0.
		if(firstOfMonth == 0){
		    //alert('month');
		    firstOfMonth = 7;
		}
		// First few blanks up to first day
		ret = new Array(new Array());
		prevMonth = new Array(31,31,28,31,30,31,30,31,31,30,31,30,31)
		
		prevMonthDay = prevMonth[month] -  firstOfMonth + 2;
		for(j=1; j<firstOfMonth; j++){
			prevMonthNr = Number(month);
			pseudoYear = year;
			if(prevMonthNr == 0)
			{	
				pseudoYear = Number(year - 1)
				prevMonthNr = 12;
			}
			if(getSwitcher()==1)
				pseudolinkHTML = '<a href="javascript: ' + this.callbackFunc + '(' + (prevMonthDay+j-1) + ', ' + (Number(prevMonthNr) ) + ', ' + pseudoYear + ',\''+this.calObjID+'\'); ' + this.objName + '._hideLayer()">' +(prevMonthDay+j-1)+'</a>';
			else
				pseudolinkHTML = '';
			
			ret[0][ret[0].length] = '<td class="dyncalendar_day" id="prev'+j+this.objName+'" onmouseover="checkRowSelection(this.id, 1,1,\''+this.objName+'\');" onmouseout="checkRowSelection(this.id, 0,1,\''+this.objName+'\');" >'+pseudolinkHTML+'</td>';
		}
                
		// Main body o	f calendar
		row = 0;
		i   = 1;
		d = 1;
		var daysInRow = new Array(0,0,0,0,0,0);
		//alert(numdays);
		while(i <= numdays){
			if(ret[row].length == 7){
				ret[++row] = new Array();
			}
			if(i==1)
				 var firstWeek = (getWeekNr(year, month, i));
			//monthStart = i + '-' + Number(month+1) + '-' + year; 
			/**
            * Generate this cells' HTML
            */
			cssClass = (i == this.date && month == this.month && year == this.year) ? 'dynCalendar_today' : 'dynCalendar_day';
			if(ret[row].length==5 || ret[row].length==6  || (month==11 && i==24) || (month==11 && i==31) || (month==0 && i==1))
				cssClass = 'dynCalendar_day dynCalendar_free';
			linkHTML = '<a href="javascript: ' + this.callbackFunc + '(' + i + ', ' + (Number(month) + 1) + ', ' + year + ',\''+this.calObjID+'\'); ' + this.objName + '._hideLayer()">' + (i++) + '</a>';
			ret[row	][ret[row].length] = '<td id="'+i+'_'+row+'_'+month+'_'+this.objName+'" onmouseover="checkRowSelection(this.id, 1,1,\''+this.objName+'\');" onmouseout="checkRowSelection(this.id, 0,1,\''+this.objName+'\');" align="center" class="' + cssClass + '">' + linkHTML + '</td>';
			daysInRow[row]++;
		}
		setGlobalLastRow(row);
		
		//dni do kolejnego miesiaca.
		
		for(i=0;i < daysInRow.length;i++)
			if(daysInRow[i] != 0)
				nextMonthDays = parseInt(7-daysInRow[i]);
		if(getSwitcher()== 1)	
		{	
			for(q=0;q< nextMonthDays; q++)
			{
				i = parseInt(q+1);
				pseudoNextMonth = parseInt(month+1);
				cssClass = (i == this.date && month == this.month && year == this.year) ? 'dynCalendar_today' : 'dynCalendar_day';
				if(ret[row].length==5 || ret[row].length==6  || (pseudoNextMonth==11 && i==24) || (pseudoNextMonth==11 && i==31) || (pseudoNextMonth==0 && i==1))
					cssClass = 'dynCalendar_day dynCalendar_free';
				
				linkHTML = '<a href="javascript: ' + this.callbackFunc + '(' + i + ', ' + (Number(pseudoNextMonth) + 1) + ', ' + year + ',\''+this.objName+'\'); ' + this.objName + '._hideLayer()">' + (i++) + '</a>';
				
				ret[row][ret[row].length]= '<td id="next'+row+i+this.objName+'" onmouseover="checkRowSelection(this.id, 1,1,\''+this.objName+'\');" 	onmouseout="checkRowSelection(this.id, 0,1,\''+this.objName+'\');" align="center" class="' + cssClass + '">' + linkHTML + '</td>'
			}
		}	
		var prvWeek = -1;
		for(i=0; i<ret.length; i++){
			if(firstWeek+i == 0)
				firstWeek = 52;
			if((firstWeek+i) ==54)
				firstWeek = ((i*-1)+1);
			
			
			var tmpSpan = "<span style='display:none;'>"+firstWeek+"|"+i+"</span>";

			var swich = getSwitcher();
			swich = (swich == null ? 1 : swich);
			if(swich == 0)
			    hrefLink = (firstWeek+i);
			else
			    hrefLink = '<a href="javascript:setDate('+(i*7-firstOfMonth+2)+','+(month+1)+','+year+',\'' + this.calObjID+'\'),'+ this.objName + '._hideLayer();">'+(firstWeek+i)+'</a>'
			    //hrefLink = '<a href="javascript:dateFromWeek(\''+(i*7-firstOfMonth+2)+'_'+(month+1)+'_'+year+'\',\'' + this.objName+'\'),'+ this.objName + '._hideLayer();">'+(firstWeek+i)+'</a>'
		
//			prvWeek = hrefLink;
//			var tmpSpan = "<span style='display:none;'>"+hrefLink+"|"+prvWeek+"</span>";
			ret[i] = '<td class="dynCalendar_week"  onmouseover="checkPeriod(this,\'5_'+i+'_'+month+'\' ,1,0,\''+this.objName+'\') " onmouseout="checkPeriod(this,\'5_'+i+'_'+month+'\' ,0,0,\''+this.objName+'\') " id="'+(firstWeek+i)+this.objName+'">'+hrefLink+'</td>'+ret[i].join('\n') + '\n';
			//ret[i] = '<td class="dynCalendar_week"  id="'+(firstWeek+i)+this.objName+'">'+hrefLink+'</td>'+ret[i].join('\n') + '\n';
			
		}
			
		//onmouseout="checkPeriod(this,\'5_'+i+'_'+month+'\' ,0) ;"
		setFirstWeek(firstWeek);
		previousYear  = thisMonth.getFullYear();
		previousMonth = thisMonth.getMonth() - 1;
		if(previousMonth < 0){
			previousMonth = 11;
			previousYear--;
		}
		
		nextYear  = thisMonth.getFullYear();
		nextMonth = thisMonth.getMonth() +1;
		if(nextMonth > 11){
			nextMonth = 0;
			nextYear++;
		}
		setGlobalMonth(month);
		prevImgHTML  = '<img src="' + this.imagesPath + '/prev.gif" alt="<<" border="0" />';
		if(previousYear == 2004)
			prevLinkHTML = '<a href="javascript: return;"></a>';
		else
			prevLinkHTML = '<a href="javascript: ' + this.objName + '.show(' + previousMonth + ', ' + previousYear + ')">' + prevImgHTML + '</a>';
		nextImgHTML  = '<img src="' + this.imagesPath + '/next.gif" alt="<<" border="0" />';
		if(nextYear ==2011)
			nextLinkHTML = 	'<a href="javascript: return;"></a>';
		else
			nextLinkHTML = '<a href="javascript: ' + this.objName + '.show(' + nextMonth + ', ' + nextYear + ')">' + nextImgHTML + '</a>';

		/**
        * Build month combo
        */
       
		if (this.useMonthCombo) {
			monthComboOptions = '';
			for (i=0; i<12; i++) {
				selected = (i == thisMonth.getMonth() ? 'selected="selected"' : '');
				monthComboOptions += '<option value="' + i + '" ' + selected + '>' + monthnames[i] + '</option>';
			}
			monthCombo = '<select id="calendarMonths'+this.calObjID+'" name="months" onchange="' + this.objName + '.show(this.options[this.selectedIndex].value, ' + this.objName + '.currentYear)">' + monthComboOptions + '</select>';
		
		} else {
			monthCombo = monthnames[thisMonth.getMonth()];
		}
		
		/**
        * Build year combo
        */
		var dataInYear = new Array();//2005,2006);
			dataInYear[2005] = '1';
			dataInYear[2006] = '1';
			dataInYear[2007] = '1';
			dataInYear[2008] = '1';
			dataInYear[2009] = '1';
			dataInYear[2010] = '1';

		if (this.useYearCombo) {
			yearComboOptions = '';
			for (i = thisMonth.getFullYear() - this.yearComboRange; i <= (thisMonth.getFullYear() + this.yearComboRange)  ; i++) {
				selected = (i == thisMonth.getFullYear() ? 'selected="selected"' : '');
				if(dataInYear[i])
					yearComboOptions += '<option value="' + i + '" ' + selected + '>' + i + '</option>';
			}
			yearCombo = '<select id="calendarYears'+this.calObjID+'" style="border: 1px groove" name="years" onchange="' + this.objName + '.show(' + this.objName + '.currentMonth, this.options[this.selectedIndex].value)">' + yearComboOptions + '</select>';
		} else {
			yearCombo = thisMonth.getFullYear();
		}

		html = '<table border="0" bgcolor="#eeeeee" id="monthTable'+this.calObjID+'" >';
		html += '<tr id="month_tr"><td class="dynCalendar_header">' + prevLinkHTML + '</td><td colspan="5" align="center" class="dynCalendar_header">' + monthCombo + ' ' + yearCombo + '</td><td align="right" class="dynCalendar_header">' + nextLinkHTML + '</td>';
		if($F("timePeriod") == 3)
		{
		  //	 + (Number(month) + 1) + ', ' + year + 
		   // html += '<td><input type="button" value="Potvrď" onclick="alert('+$F("calendarMonths"+this.calObjID)+');setDate(1,'+parseInt(parseInt($F("calendarMonths"+this.calObjID))+parseInt(1))+','+$F("calendarYears"+this.calObjID)+', \''+this.calObjID+'\');"/></td>'
		    html += '<td><input type="button" value="Potvrď" onclick="setDate(1,'+(Number(month) + 1)+','+year+', \''+this.calObjID+'\');"/></td>'
		
		}
		html += '</tr>';
		html += "</table>";
		html += '<table border="0" bgcolor="#eeeeee" id="daysTable'+this.objName+'" class="jqueryAnchorClass"><tr>';
			html += '<td class="dynCalendar_dayname">Týž</td>';
		html += '<td class="dynCalendar_dayname">Po</td>';
		html += '<td class="dynCalendar_dayname">Ut</td>';
		html += '<td class="dynCalendar_dayname">Str</td>';
		html += '<td class="dynCalendar_dayname">Štv</td>';
		html += '<td class="dynCalendar_dayname">Pi</td>';
		html += '<td class="dynCalendar_dayname">So</td>';
		html += '<td class="dynCalendar_dayname">Ne</td></tr>';
		html += '<tr>' + ret.join('</tr>\n<tr>') + '</tr>';
		html += '</table>';
//		alert(html);
		this._setHTML(html);
		
		if (!arguments[0] && !arguments[1]) {
			this._showLayer();
			this._setLayerPosition();

		}
		
		try{
		    $period = $F("timePeriod");
		    //alert($period);
		    if($period == 3)//month, hide days in  callendar.
		    {	
				//alert(typeof $().jquery );
				try{
				    if(typeof $().jquery == "string")
				    {
					$(".jqueryAnchorClass").css('display', 'none');
		        		//$("#daysTable$to").css('display' ,'none');
					//alert($('#daysTable$from').html());
				    }
				}catch(e)
				//else
				{
				    
				    $("daysTable$from").style.display = 'none';
		        	    $("daysTable$to").style.display = 'none';
				}
		    }
		}catch(e){}

	}

/**
* Writes HTML to document for layer
* @access public
*/
	function dynCalendar_writeHTML()
	{
		
		if (is_ie5up || is_nav6up || is_gecko || window.opera) {
			//document.write('<a href="javascript: ' + this.objName + '.show()"><img src="' + this.imagesPath + 'dynCalendar.gif" border="0" width="17" height="17" id="dynImg" style="vertical-align: 0px;"/></a>');
			
			document.write('<div class="dynCalendar" id="' + this.layerID + '" style=""></div>');
		}
	}

/**
* Sets the offset to the mouse position
* that the calendar appears at.
*
* @access public
* @param integer Xoffset Number of pixels for vertical
*                        offset from mouse position
* @param integer Yoffset Number of pixels for horizontal
*                        offset from mouse position
*/
	function dynCalendar_setOffset(Xoffset, Yoffset)
	{
		this.setOffsetX(Xoffset);
		this.setOffsetY(Yoffset);
	}

/**
* Sets the X offset to the mouse positio
* that the calendar appears at.
*
* @access public
* @param integer Xoffset Number of pixels for horizontal
*                        offset from mouse position
*/
	function dynCalendar_setOffsetX(Xoffset)
	{
		this.offsetX = Xoffset;
	}

/**
* Sets the Y offset to the mouse position
* that the calendar appears at.
*
* @access public
* @param integer Yoffset Number of pixels for vertical
*                        offset from mouse position
*/
	function dynCalendar_setOffsetY(Yoffset)
	{
		this.offsetY = Yoffset;
	}
	
/**
* Sets the images path
*
* @access public
* @param string path Path to use for images
*/
	function dynCalendar_setImagesPath(path)
	{
		this.imagesPath = path;
	}

/**
* Turns on/off the month dropdown
*
* @access public
* @param boolean useMonthCombo Whether to use month dropdown or not
*/
	function dynCalendar_setMonthCombo(useMonthCombo)
	{
		this.useMonthCombo = useMonthCombo;
	}

/**
* Turns on/off the year dropdown
*
* @access public
* @param boolean useYearCombo Whether to use year dropdown or not
*/
	function dynCalendar_setYearCombo(useYearCombo)
	{
		this.useYearCombo = useYearCombo;
	}

/**
* Sets the current month being displayed
*
* @access public
* @param boolean month The month to set the current month to
*/
	function dynCalendar_setCurrentMonth(month)
	{
		this.currentMonth = month;
	}

/**
* Sets the current month being displayed
*
* @access public
* @param boolean year The year to set the current year to
*/
	function dynCalendar_setCurrentYear(year)
	{
		this.currentYear = year;
	}

/**
* Sets the range of the year combo. Displays this number of
* years either side of the year being displayed.
*
* @access public
* @param integer range The range to set
*/
	function dynCalendar_setYearComboRange(range)
	{
		this.yearComboRange = range;
	}

/**
* Returns the layer object
*
* @access private
*/
	function dynCalendar_getLayer()
	{
		var layerID = this.layerID;
		if (document.getElementById(layerID)) {
			return document.getElementById(layerID);

		} else if (document.all(layerID)) {
			return document.all(layerID);
		}
	}

/**
* Hides the calendar layer
*
* @access private
*/
	function dynCalendar_hideLayer()
	{
		
				
		this._getLayer().style.visibility = 'hidden';
		//document.removeChild(this._getLayer().id);	
		//$("dyncalendars_containers").hide();
	}

/**
*Shows the calendar layer
*
* @access private
*/
	function dynCalendar_showLayer()
	{
		
		this._getLayer().style.visibility = 'visible';
		this._getLayer().style.display = 'block';
	}

/**
* Sets the layers position
*
* @access private
*/
	function dynCalendar_setLayerPosition()
	{
		return;
		this._getLayer().style.top  = "200px";//(dynCalendar_mouseY + this.offsetY) -10 +'px';
		this._getLayer().style.left = "200px";(dynCalendar_mouseX + this.offsetX)  + 'px';
	}

/**
* Sets the innerHTML attribute of the layer
*
* @access private
*/
	function dynCalendar_setHTML(html)
	{
		this._getLayer().innerHTML = html;
	}

/**
* Returns number of days in the supplied month
*
* @access private
* @param integer month The month to get number of days in
* @param integer year  The year of the month in question
*/
	function dynCalendar_getDaysInMonth(month, year)
	{
		monthdays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
		if (month != 1) {
			return monthdays[month];
		} else {
			return ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0 ? 29 : 28);
		}
	}

/**
* onMouse(Over|Out) event handler
*
* @access private
* @param boolean status Whether the mouse is over the
*                       calendar or not
*/
	function dynCalendar_mouseover(status)
	{
		return;
		dynCalendar_mouseoverStatus = status;
		return true;
	}

/**
* onMouseMove event handler
*/
	dynCalendar_oldOnmousemove = document.onmousemove ? document.onmousemove : new Function;

	document.onmousemove = function ()
	{
		return;
		if (is_ie5up || is_nav6up || is_gecko) {
			if (arguments[0]) {
				dynCalendar_mouseX = arguments[0].pageX;
				dynCalendar_mouseY = arguments[0].pageY;
			} else {
				dynCalendar_mouseX = event.clientX + document.body.scrollLeft;
				dynCalendar_mouseY = event.clientY + document.body.scrollTop;
				arguments[0] = null;
			}
	
			dynCalendar_oldOnmousemove();
		}
	}

/**
* Callbacks for document.onclick
*/
	/*
	dynCalendar_oldOnclick = document.onclick ? document.onclick : new Function;
	
	document.onclick = function ()
	{
		if (is_ie5up || is_nav6up || is_gecko) {
			if(!dynCalendar_mouseoverStatus){
				for(i=0; i<dynCalendar_layers.length; ++i){
					dynCalendar_layers[i]._hideLayer();
				}
			}
	
			dynCalendar_oldOnclick(arguments[0] ? arguments[0] : null);
		}
	}
	*/
