// alert ("in prcal.js");

var prAgent	= navigator.userAgent.toLowerCase();
var isMac = (prAgent.indexOf("mac") != -1);

function xShowMonth (aMonth, aYear, tfEvtListPg4, debugLocation)
{
	alert("woof");	
}

function ShowMonth (aMonth, aYear, tfEvtListPg4, debugLocation, gowhere)
{
	
	if (typeof gowhere == 'undefined' ) gowhere = 'eventlist';
	
	// alert("Show Month in prcal.js");
	//	alert("Show Month BEGIN (mm/yyyy = "+ aMonth + "/" + aYear + ") IsEventList =" + tfEvtListPg4 + " Location = " + debugLocation + "."); 
	
	document.SearchCriteria.fMonth.value = aMonth;
	document.SearchCriteria.fYear.value = aYear;
	
    var calCode = MakeCalendarCode( aMonth, aYear, tfEvtListPg4, gowhere );
	
	// have to have an extra char at the end of the calCode or Mac IE gets confused.
	// a space works - so does newline i.e. backslash n.
	
	var name="SMALL_CAL";
	var preCalCode = '<form name="Cal" style="margin-bottom: 0px;">';
	var postCalCode = '</form>';
		
	if (tfEvtListPg4)
	{
		// sniff
		if (document.getElementById) 
		{ 
			// alert("getElementByID");
			document.getElementById("SMALL_CAL").innerHTML  = 'hello';
			// alert("Now draw the small calendar");
			
			if (isMac)
				calCode = preCalCode + calCode + postCalCode;
				
			document.getElementById("SMALL_CAL").innerHTML  = calCode;
		} 
    	else if (document.layers) 
		{
			// alert ("layers");
			
        	document.layers['SMALL_CAL'].document.open();
        	document.layers['SMALL_CAL'].document.write(preCalCode);
        	document.layers['SMALL_CAL'].document.write(calCode);
        	document.layers['SMALL_CAL'].document.write(postCalCode);
        	document.layers['SMALL_CAL'].document.close();
    	} 
		else 
		{
        	if (document.all) 
			{ 
				alert ("document.all");
				document.all.SMALL_CAL.innerHTML = calCode;
			} 
    	}
	}
	else
	{
		// Opera fussing
		// document.write("<form name='Cal' style='margin-bottom: 0px;'>");
		document.write(calCode);
		// document.write("</form>");
	}
	
	// alert("ShowMonth END (mm/yyyy = "+ aMonth + "/" + aYear + ") IsEventList =" + tfEvtListPg4 + " Location = " + debugLocation + "."); 
	
	return;	
}

