function createRequestObject() 
{
     var ro;     
     ro = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
 
     return ro;
}
 
var http = createRequestObject();
 
function storeCal(calno) 
{
     http.open('get', 'storecal.php?calno='+calno);
     //http.onreadystatechange = handleResponse;
     http.send(null);
}

function storeCalSection(calno) 
{
     http.open('get', 'storecalsection.php?calno='+calno);
     //http.onreadystatechange = handleResponse;
     http.send(null);
}





function showthreecols(startat)
{
	for (var c=0; c<6; c++)
	{
		if (c<startat || c>=startat+3)
		{
			document.getElementById("calcol"+c).style.display='none';
		}
		else
		{
			document.getElementById("calcol"+c).style.display='block';
		}
	}
	
	if (startat>2)
	{
		document.getElementById("keydatesprev").style.display='block';
		document.getElementById("keydatesnext").style.display='none';
	}  
	else
	{
		document.getElementById("keydatesprev").style.display='none';
		document.getElementById("keydatesnext").style.display='block';
	} 
	
	//storeCalSection(startat);
}


function showdate(adate,amonth,ayear,texttoshow)
{
	//window.alert(''+texttoshow);
	//document.getElementById("datetip").innerHTML="<div class='datetipheading'>"+adate+"/"+amonth+"/"+ayear+"</div><div class='datetipbody'>"+texttoshow+"</div>";
	//document.getElementById("datetip").style.display='block';
	$('#datetip').html("<div class='datetipheading'>"+adate+"/"+amonth+"/"+ayear+"</div><div class='datetipbody'>"+texttoshow+"</div>"); 
	$('#datetip').show();
}

function hidedate()
{
	//document.getElementById("datetip").style.display='none';
	$('#datetip').hide();
}

function showcalno(calno)
{
	for (var c=0; c<6; c++)
	{
		document.getElementById("datetable"+c).style.display='none';
	}
	document.getElementById("datetable"+calno).style.display='inline';
	storeCal(calno+1);
   
}

function showdefault()
{
	showcalno(curmonth);
	//document.onmousemove = postip;
	//document.attachEvent("onmousemove", postip);
	$(document).mousemove(postip); 
	
	if (curmonth>2)
	{
		showthreecols(3);
	}
	else
	{
		showthreecols(0);
	}

}

function postip(e)
{
	//window.alert('postip'+e.pageX);
	
	//var tempX;
	//var tempY;
	//tempX=e.pageX-$('body').offsetLeft;
	//tempY=e.pageY;
	//document.getElementById('datetip').style.left=(tempX-50)+'px';
    //document.getElementById('datetip').style.top=(tempY+15)+'px';
    //eleOffset = $(this).offset();
   
	//$('#datetip').html("X: " + e.pageX + " Y: " + e.pageY); 
	$('#datetip').css('left', e.pageX+15);
	$('#datetip').css('top', e.pageY+15);

	
	
    //document.getElementById("datetip").style="left:"+(e.pageX-50)+"px;top:"+(e.pageY+15)+"px;";
}

