now = new Date();
year = now.getYear();
month = now.getMonth();
date = now.getDate();
day = now.getDay();

tomonth = new Array(12);
tomonth[0] = 4;
tomonth[1] = 0;
tomonth[2] = 0;
tomonth[3] = 3;
tomonth[4] = 5;
tomonth[5] = 1;
tomonth[6] = 3;
tomonth[7] = 6;
tomonth[8] = 2;
tomonth[9] = 4;
tomonth[10] = 0;
tomonth[11] = 2;

monthend = new Array(12);
monthend[0] = 31;
monthend[1] = 28;
monthend[2] = 31;
monthend[3] = 30;
monthend[4] = 31;
monthend[5] = 30;
monthend[6] = 31;
monthend[7] = 31;
monthend[8] = 30;
monthend[9] = 31;
monthend[10] = 30;
monthend[11] = 31;

honev = new Array(12);
honev[0] = '2010. Január';
honev[1] = '2010. Február';
honev[2] = '2010. Március';
honev[3] = '2010. Április';
honev[4] = '2010. Május';
honev[5] = '2010. Június';
honev[6] = '2010. Július';
honev[7] = '2010. Augusztus';
honev[8] = '2010. Szeptember';
honev[9] = '2010. Október';
honev[10] = '2010. November';
honev[11] = '2010. December';

function getContainer()
{
	return document.getElementById( "calendar" );
}

function initCalendar( n )
{
if( n != undefined )
{
	month += n;
}

var nap = 1;

var str = "";

str += '<table class="naptarone" cellpadding="0" cellspacing="2" > <tr>';
str += '<td colspan="7" class="fejlec">';
if (honev[month]=='2010. Január')
{str +=  honev[month] + "<span style='cursor: pointer' onclick='initCalendar( 1 )'> > </span>";}
else if (honev[month]=='2010. December')
{str +=  "<span style='cursor: pointer' onclick='initCalendar( -1 )'> < </span>" + honev[month];}
else
{str +=  "<span style='cursor: pointer' onclick='initCalendar( -1 )'> < </span>" + honev[month] + "<span style='cursor: pointer' onclick='initCalendar( 1 )'> > </span>";}
str +=  '</td></tr><tr>';
str +=  '<td class="nemaktualis">H</td>';
str +=  '<td class="nemaktualis">K</td>';
str +=  '<td class="nemaktualis">Sze</td>';
str +=  '<td class="nemaktualis">CS</td>';
str +=  '<td class="nemaktualis">P</td>';
str +=  '<td class="nemaktualis">Szo</td>';
str +=  '<td class="nemaktualis">V</td></tr><tr>';
for(o=0;o<tomonth[month];o++) { str +=  '<td class="nemaktualis" align="center">&nbsp;</td>' };
for(i=0;i<(7-tomonth[month]);i++){
				 if (nap == date) {
				  str +=  '<td class="aktualis">';
				  str +=  (nap++);
				  str +=  '</td>';
				 }
				else {
				  str += ('<td class="nemaktualis">');
			      str += (nap++);
		    	  str += ('</td>');
				 } 
				}
str += ('</tr>');
str += ('<tr>');
for(i=0;i<7;i++){
				if (nap <= monthend[month]) {
						if (nap == date) {
						 str +=  ('<td class="aktualis">');
						 str +=  (nap++);
						 str +=  ('</td>');
						                 }
						else {
						 str += ('<td class="nemaktualis">');
					     str += (nap++);
		 		   	     str += ('</td>');
						 }
						}
				else {str += ('<td class="nemaktualis">&nbsp;</td>'); }
				}
str += ('</tr>');
str += ('<tr>');
for(i=0;i<7;i++){
				if (nap <= monthend[month]) {
						if (nap == date) {
						 str +=  ('<td class="aktualis">');
						 str +=  (nap++);
						 str +=  ('</td>');
						                 }
						else {
						 str += ('<td class="nemaktualis">');
					     str += (nap++);
		 		   	     str += ('</td>');
						 }
						}
				else {str += ('<td class="nemaktualis">&nbsp;</td>'); }
				}
str += ('</tr>');
str += ('<tr>');
for(i=0;i<7;i++){
				if (nap <= monthend[month]) {
						if (nap == date) {
						 str +=  ('<td class="aktualis">');
						 str +=  (nap++);
						 str +=  ('</td>');
						                 }
						else {
						 str += ('<td class="nemaktualis">');
					     str += (nap++);
		 		   	     str += ('</td>');
						 }
						}
				else {str += ('<td class="nemaktualis">&nbsp;</td>'); }
				}
str += ('</tr>');
str += ('<tr>');
for(i=0;i<7;i++){
				if (nap <= monthend[month]) {
						if (nap == date) {
						 str +=  ('<td class="aktualis">');
						 str +=  (nap++);
						 str +=  ('</td>');
						                 }
						else {
						 str += ('<td class="nemaktualis">');
					     str += (nap++);
		 		   	     str += ('</td>');
						 }
						}
				else {str += ('<td class="nemaktualis">&nbsp;</td>'); }
				}
str += ('</tr>');
str += ('<tr>');
for(i=0;i<7;i++){
				if (nap <= monthend[month]) {
						if (nap == date) {
						 str +=  ('<td class="aktualis">');
						 str +=  (nap++);
						 str +=  ('</td>');
						                 }
						else {
						 str += ('<td class="nemaktualis">');
					     str += (nap++);
		 		   	     str += ('</td>');
						 }
						}
				else {str += ('<td class="nemaktualis">&nbsp;</td>'); }
				}
str += ('</tr>');
str += ('</table>');

getContainer().innerHTML = str;
}

initCalendar();