function calendar( tid, gameDate, currentMonthYear, direction, divHeight ) {

	document.getElementById( 'loadingCalendar' ).style.height = divHeight + 'px';
	document.getElementById( 'loadingCalendar' ).style.display = 'block';
	document.getElementById( 'calendar' ).style.display = 'none';

	JsHttpRequest.query(

		'/php/Request/Request.php',

		{
//			action: 'calendar',
			_class:		'Calendar',
			_method:	'getCalendar',
			is_Js_Request:	true,
			is_Grab:	true,
			tid:		tid,
			gameDate:	gameDate,
			currentMonthYear: currentMonthYear,
			direction:	direction
		},

		function ( result, errors ) {

			// Write the answer.
//			if ( result != '' && result != undefined ) {

				document.getElementById( 'calendar' ).innerHTML = result['calendar'];

//			}

			// Write errors to the debug div.
			if ( errors != '' && errors != undefined ) {

				document.getElementById( 'calendarDebug' ).innerHTML = errors;
				document.getElementById( 'calendarDebug' ).style.display = 'block';

			}
			else {

				document.getElementById( 'calendarDebug' ).style.display = 'none';

			}

			document.getElementById( 'loadingCalendar' ).style.display = 'none';
			document.getElementById( 'calendar' ).style.display = 'block';

		},

		true // do not disable caching

	);

}


DOM = (document.getElementById) ? 1 : 0;
NS4 = (document.layers) ? 1 : 0;
// We need to explicitly detect Konqueror
// because Konqueror 3 sets IE = 1 ... AAAAAAAAAARGHHH!!!
Konqueror = (navigator.userAgent.indexOf("Konqueror") > -1) ? 1 : 0;
// We need to detect Konqueror 2.2 as it does not handle the window.onresize event
Konqueror22 = (navigator.userAgent.indexOf("Konqueror 2.2") > -1 || navigator.userAgent.indexOf("Konqueror/2.2") > -1) ? 1 : 0;
Opera = (navigator.userAgent.indexOf("Opera") > -1) ? 1 : 0;
Opera5 = (navigator.userAgent.indexOf("Opera 5") > -1 || navigator.userAgent.indexOf("Opera/5") > -1) ? 1 : 0;
Opera6 = (navigator.userAgent.indexOf("Opera 6") > -1 || navigator.userAgent.indexOf("Opera/6") > -1) ? 1 : 0;
Opera56 = Opera5 || Opera6;
IE = (navigator.userAgent.indexOf("MSIE") > -1) ? 1 : 0;
IE = IE && !Opera;
IE5 = IE && DOM;
IE4 = (document.all) ? 1 : 0;
IE4 = IE4 && IE && !DOM;


function getRef( id ) {
    if ( DOM ) return document.getElementById( id );
    if ( IE4 ) return document.all[id];
    if ( NS4 ) return document.layers[id];
}

function getSty( id ) {
    return ( NS4 ? getRef( id ) : getRef( id ).style );
}

function onover( id ) {
		getSty( 'c' + id ).backgroundColor = "#ffcc99"; //ccffcc";
}

function onout( id, is_current ) {
		getSty( 'c' + id ).backgroundColor = "#" + ( is_current ? "ffd931" : "fffeee" );
}
