function OpenMenu(ItemID,CurrentMenuID){
var MenuTag="";
var MenuName="";
var ImageUrl="";
var strPos=0;
var MenuIndexOf=0;
var strMenuIndex="";

var MenuObject = document.all.item(CurrentMenuID);
var ItemObject = document.all.item(ItemID);
var HeaderObject = document.all.item('HeaderTable');

	var pos = getElementAbsolutePos(ItemObject);
	//document.all.DESC.innerText = pos.x+"-"+pos.y;

	MenuObject.style.left=pos.x-MenuObject.offsetWidth+ItemObject.offsetWidth+22;
	MenuObject.style.top=pos.y+20;


	if (document.all){MenuObject.style.visibility="visible";}
	}

function getElementAbsolutePos(el) {
	var SL = 0, ST = 0;
	var is_div = /^div$/i.test(el.tagName);
	if (is_div && el.scrollLeft)
		SL = el.scrollLeft;
	if (is_div && el.scrollTop)
		ST = el.scrollTop;
	var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST };
	if (el.offsetParent) {
		var tmp = this.getElementAbsolutePos(el.offsetParent);
		r.x += tmp.x;
		r.y += tmp.y;
	}
	return r;
}

function CloseMenu(CurrentMenuID){
var MenuObject = document.all.item(CurrentMenuID);
if (document.all){MenuObject.style.visibility="hidden";}
}

function SetInnerTextAndHide(DropDownID,ObjectID,InnerText){
	SetObjectInnerText(ObjectID,InnerText)
	var mDropDownObject = document.all.item(DropDownID);
	mDropDownObject.style.visibility="hidden";
}

function HighlightMenuItem(ObjectID){
	var mObject = document.all.item(ObjectID);
	mObject.style.backgroundColor="#e6e6fa";
}

function ResetMenuItem(ObjectID){
	var mObject = document.all.item(ObjectID);
	mObject.style.backgroundColor="#ffffff";
	//document.all.DESC.innerText = LeftPosition;
}

function HideObject(ObjectID){
	var mObject = document.all.item(ObjectID);
	mObject.style.visibility="hidden";
}
	
function ShowObject(LEFTcoord,TOPcoord,ObjectID){
	var mObject = document.all.item(ObjectID);
	mObject.style.left=LEFTcoord;
	mObject.style.top=TOPcoord;
	mObject.style.visibility="visible";
}

function SetObjectInnerText(ObjectID,InnerText){
	var mObject = document.all.item(ObjectID);
	mObject.innerText=InnerText;
}

function OpenCalendar(ImageID,CalendarPanelID){

var CurrentObjectID="";
var MenuName="";
var ImageUrl="";
var strPos=0;
var CurrentObjectIDIndexOf=0;
var strMenuIndex="";
document.all.DESC.innerText="Line_0";
try{
	var ImageObject = document.all.item(ImageID);
	document.all.DESC.innerText="Line_1";

	CurrentObjectID=ImageObject.id;
	CurrentObjectIDIndexOf=CurrentObjectID.lastIndexOf("_")-1;
	strMenuIndex=CurrentObjectID.substr(CurrentObjectIDIndexOf,1);
	//MenuName="DropDownMenu"+strMenuIndex;
	//Imagesrc=CurrentMenuItem.src;
	
	var CalendarObject = document.all.item(CalendarPanelID);
	document.all.DESC.innerText="Line_2";

	LeftPosition=GetImageLeftCoordinate(ImageID);
	TopPosition=GetImageTopCoordinate(ImageID);
	//TopPosition=CurrentObject.ClientTop;
	CalendarObject.style.left=LeftPosition;
	CalendarObject.style.top=TopPosition;
	//document.all.DropDownMenu2.style.left=LeftPosition;
	//document.all.DropDownMenu2.style.top=TopPosition;
	//document.all.DESC.innerText="Left:"+LeftPosition+"-Top:"+TopPosition;
	//document.all.DESC.innerText=CurrentObjectID+"--"+strMenuIndex+"--"+TopPosition;
	//fadeIn(CalendarObject);

	if (document.all){CalendarObject.style.visibility="visible";}
	}
	
//catch(e){document.all.DESC.innerText = e.Message;}
catch(e){e.Message;}

}

function GetImageTopCoordinate(ImageID){
var LeftPosition=0;
var TopPosition=0;
var TopPositionAll=0;
var ImageObjectID="";
var strPos=0;
var ImageObjectIDIndexOf=0;
var ImageIndex;
var strImageIndex;
var ImageObject = document.all.item(ImageID);


ImageObjectID=ImageObject.id;
ImageObjectIDIndexOf=ImageObjectID.lastIndexOf("_")-1;
strImageIndex=ImageObjectID.substr(ImageObjectIDIndexOf,1);
ImageIndex=Number(strImageIndex);
//MenuName="DropDownMenu"+strMenuIndex;
//Imagesrc=CurrentMenuItem.src;
document.all.DESC.innerText=ImageObjectID.indexOf("grdRecords");
var MainTableHeaderRowHeight=document.all.MainTableHeaderRow.offsetHeight;
var MainTitleTableHeight=document.all.MainTitleTable.offsetHeight;
var MainTableTop=document.all.MainTable.offsetTop;
var SubTableRow1Height=document.all.MainTableRow1.offsetHeight;
var SubTableRow2Height=document.all.MainTableRow2.offsetHeight;
var SubTableRow3Height=document.all.MainTableRow3.offsetHeight;
var SubTableRow4Height=document.all.MainTableRow4.offsetHeight;
document.all.DESC.innerText=MainTitleTableHeight;

if (ImageObjectID.indexOf("grdRecords") != -1)
	{
		for (var i = 0; i < ImageIndex; i++)
		{
		var divObject = document.all.item("RecordLine"+String(i));
		var tmpImageParentObject = divObject.parentElement;
		TopPositionAll += tmpImageParentObject.clientHeight+23;
		}
	//var CommonControlsObject = document.all.item("_ctl0_commonrecords");
	TopPositionAll += SubTableRow4Height+ImageObject.offsetTop+42;
	}
else
	TopPositionAll = ImageObject.offsetTop+38;
	//var par = tmpImageParentObject.parentElement;


//var xx = tmpImageParentObject.clientHeight;
//document.all.DESC.innerText=TopPositionAll;
//document.all.DESC.innerText = ImageObjectID+"---"+TopPositionAll
//try{document.all.DESC.innerText = ImageObjectID+"---"+TopPositionAll;}
//catch(e){document.all.DESC.innerText = e.Message;}
TopPosition = MainTableHeaderRowHeight+MainTableTop+SubTableRow1Height+SubTableRow2Height+SubTableRow3Height+TopPositionAll;
//TopPosition = MainTableHeaderRowHeight+MainTitleTableHeight+TopPositionAll;
document.all.DESC.innerText=TopPosition;
return TopPosition

}

function GetImageLeftCoordinate(ImageID){
var LeftPosition=0;
var ImageObject = document.all.item(ImageID);

LeftPosition=ImageObject.offsetLeft+ImageObject.offsetParent.offsetLeft+document.all.MainTable.offsetLeft+35;
return LeftPosition

}

function OpenCalendarx(){
if (document.all){document.all.DivDateCalendar.style.visibility="visible";}
}

function HideCalendar(CalendarObject){
if (CalendarObject)
	{CalendarObject.style.visibility="hidden"};
}

function HideObject(CurrentObjectNameID){
var CurrentObject = document.all.item(CurrentObjectNameID);
CurrentObject.style.visibility="hidden"
}

function StartUp() {
document.all.DropDownMenu2.style.visibility="hidden"
}
function fadeOut(obj) {
    obj.style.filter="blendTrans(duration=1)";
	// Make sure filter is not playing.
	if ((obj.visibility != "hidden") && (obj.filters.blendTrans.status != 1)) {
        obj.filters.blendTrans.Apply();
        obj.style.visibility="hidden";
	    obj.filters.blendTrans.Play();
	}
}
function fadeIn(obj) {
    obj.style.filter="blendTrans(duration=1)";
	// Make sure filter is not playing.
	if ((obj.visibility != "visible") && (obj.filters.blendTrans.status != 1)) {
      obj.filters.blendTrans.Apply();
      obj.style.visibility="visible";
	  obj.filters.blendTrans.Play();
	}
}