﻿
var g_myAjax;
var g_strPage = 'GetItems.aspx';

function myAjaxResponse ()
{
    var aaa = g_myAjax.responseStatus[0]; 
    alert (aaa);
}
function AddItem() 
{
    var MainGrid = document.getElementById('DIVGRID_CNT');
    var newDiv = null;

    newDiv = document.createElement("div");
    newDiv.style.height = '50px';
    newDiv.style.left = '50px';
    newDiv.style.top = '50px';
    newDiv.style.width = '50px';
    newDiv.style.position = 'absolute';
    newDiv.style.zIndex = '1000';
    newDiv.style.backgroundColor = 'yellow';
    MainGrid.appendChild(newDiv);

/*    alert('kuk');    */
}

function doDoubleClick(event)
    {
    /*    var MainGrid = document.getElementById ('DIVGRID');

    var evt=window.event || event //cross browser event object
    var xPos = evt.clientX-getLeftPos (MainGrid)-2+MainGrid.scrollLeft;
    var yPos = evt.clientY-getTopPos (MainGrid)-2+MainGrid.scrollTop;

    if (document.all)
    {
    xPos-=2;
    yPos-=2;
    }
			    
    alert (xPos);
    alert (yPos);
    //nResource = (yPos / g_nCellHeight) % g_nResourcesNum;
    alert (Point2Date (yPos));
    alert (Point2Time(xPos));
    alert (g_arrResources[Point2Resource(yPos)]);
    */

/*  g_myAjax = new sack();
  g_myAjax.requestFile = g_strPage;
  g_myAjax.onCompletion = function(){ myAjaxResponse(); };
  g_myAjax.runAJAX();
*/

        /*  eo_GetObject('ScheduleItemEdit').show(true);*/
/*        AddItem();*/
}
//</script>




function on_tab_item_click(e, info)
{
	//Select the clicked item on the client side
	info.getItem().setSelected(true);
}

function ChangeDate()
{
	var cell = document.getElementById("CalendarSel");
	eo_GetObject("PopupCalendar1").goTo(eo_GetObject("PopupCalendar1").getSelectedDate());
	eo_ShowPopupCalendar("PopupCalendar1",  cell);
}


function getTopPos(inputObj)
{		
  var returnValue = inputObj.offsetTop;
  while((inputObj = inputObj.offsetParent) != null){
  	if(inputObj.tagName!='HTML')returnValue += inputObj.offsetTop;
  }
  return returnValue;
}

function getLeftPos(inputObj)
{
  var returnValue = inputObj.offsetLeft;
  while((inputObj = inputObj.offsetParent) != null){
  	if(inputObj.tagName!='HTML')returnValue += inputObj.offsetLeft;
  }
  return returnValue;
}

function Point2Time (nX)
{
  var nTime;

  nTime = Math.floor(g_nFromHour + (60 / g_nCellWidth) * nX);
  nTime = Math.floor((nTime/5)) * 5;
   
 return nTime;

}
function Point2Date (nY)
{
  return Math.floor(nY / (g_nCellHeight * g_nResourcesNum));
}
function Point2Resource (nY)
{
  return Math.floor((nY / g_nCellHeight) % g_nResourcesNum);
}

