function ShowCal()
{
	if(document.getElementById('contentMenu').style.display != 'none')
		document.getElementById('contentMenu').style.display = 'none';
	else
		document.getElementById('contentMenu').style.display = '';
	 
}
function gOfs(obj){
    var x=0,y=0;
    if(window.opera)
    {
        if(obj.style.position=='absolute')
        {
            x=obj.style.posLeft;
            y=obj.style.posTop;
        }else{
            while (obj.offsetParent)
            {
                x+=obj.offsetLeft;
                y+=obj.offsetTop;
                obj=obj.offsetParent;
            }
        }
    }else if(obj.offsetParent)
    {
        while (obj.offsetParent)
        {
            x+=obj.offsetLeft;
            y+=obj.offsetTop;
            obj=obj.offsetParent;
        }
    }else if (obj.x)
    {
        x += obj.x;
        y += obj.y;

    }
    //alert(x+' '+y);
    return {x: x, y: y}
}

function doGetLoad_cal(url, show_in)
	{
    ofs = gOfs(document.getElementById(show_in));
    if (window.XMLHttpRequest)
	{
		request = new XMLHttpRequest();
		request.onreadystatechange = function()
		{
			abortRequest = window.setTimeout("request.abort();", 10000);
			if (request.readyState == 4)
			{
				clearTimeout(abortRequest);
				if (request.status == 200)
				{
                    document.getElementById('calendar_bootdiv').style.display = 'none';
                    document.getElementById(show_in).innerHTML = request.responseText;
				}
				else
				{
					alert("Не удалось получить данные:\n" + request.statusText);
				}
            }
            else if (request.readyState == 3 || request.readyState == 1)
    		{
                    document.getElementById('calendar_bootdiv').style.display = '';
                    document.getElementById('calendar_bootdiv').style.top = ofs.y;
                    document.getElementById('calendar_bootdiv').style.left = ofs.x;
                    document.getElementById('calendar_bootdiv').style.width = document.getElementById('calendar_area').offsetWidth;
                    document.getElementById('calendar_bootdiv').style.height = document.getElementById('calendar_area').offsetHeight;
    				
			}
			return false;
		}
		request.open("GET", url, true);
		request.send(null);
		return false;
	}
	else if (window.ActiveXObject)
	{
		request = new ActiveXObject("Microsoft.XMLHTTP");
		if (request)
			{
			request.onreadystatechange = function()
				{
				abortRequest = window.setTimeout("request.abort();", 10000);
				if (request.readyState == 4)
					{
					clearTimeout(abortRequest);
					if (request.status == 200)
						{
                        document.getElementById('calendar_bootdiv').style.display = 'none';
                        document.getElementById(show_in).innerHTML = request.responseText;
						}
					else
						{
						alert("Не удалось получить данные:\n" + request.statusText);
						}
					}
                else if (request.readyState == 3 || request.readyState == 1)
        				{
                        document.getElementById('calendar_bootdiv').style.display = '';
                        document.getElementById('calendar_bootdiv').style.top = ofs.y;
                        document.getElementById('calendar_bootdiv').style.left = ofs.x;
                        document.getElementById('calendar_bootdiv').style.width = document.getElementById('calendar_area').offsetWidth;
                        document.getElementById('calendar_bootdiv').style.height = document.getElementById('calendar_area').offsetHeight;
        				}
				return false;
				}
			request.open("GET", url, true);
			request.send();
			return false;
			}
		}

	return false;
	}


function update_calendar(year, month, day)
    {
    if(doGetLoad_cal("ajaxCalendar/ajax_calendar.php?year="+year+"&month="+month+"&day="+day, "calendar_area"))
        {
		
        doGetLoad_cal("ajaxCalendar/date.notes.list.php?year="+year+"&month="+month+"&day="+day, "side_note_list");
        }
    return false;
    }
    
  
function CloseShowCal(TargetID, dLeft, dTop)
{

}    
    
    
function ShowCal2(TargetID, dLeft, dTop)
{
    /*
    if (document.getElementById('calendar_area')) 
    {
      CloseShowCal();
    } 
    else 
    {
      TargetIDObj = document.getElementById(TargetID);
      if (!dLeft) var dLeft = 0;
      if (!dTop) var dTop = 0;
    } 
    */     
}
    