//Mine
var Xarr = new Array();
function DoPos(object, db_name)
{
	
	temp = object.id.split("_");
	ID = temp[1];
	if(!Xarr[ID])
	{
		innerH = object.innerHTML;
		object.innerHTML = '<nobr><input name="valuexyz" type="text" style="width: 100%;" value="'+innerH+'" id="valuexyz"><input  type="button"  value="V" style="width:15px;" onclick="DoPos2('+ID+', \''+db_name+'\');"></nobr>';
		Xarr[ID] = object;
	}
	
}
function DoPos2(ID, db_name)
{
	//valuexyz
	Form = document.getElementById("valuexyz");
	pos = Form.value;
	Xarr[ID].innerHTML = pos;
	SendPos(ID, db_name, pos);
	delete Xarr[ID];
	//alert(Form.value);
}
function SendPos(ID, db_name, pos)
{
	if (window.XMLHttpRequest) 
	{
		   req = new XMLHttpRequest();
	}
	else if (window.ActiveXObject) 
	{
		   req = new
		   ActiveXObject("Microsoft.XMLHTTP");
	}   

	req.open("POST", "/Admin/Ajax/"+ID+"?m="+Math.random()*10000, true);

	req.setRequestHeader("Content-Type","application/x-www-form-urlencoded");  

	req.send("pos="+pos+"&db="+db_name+"&id="+ID);

  	req.onreadystatechange = processXMLResponse; 

}
function processXMLResponse() 
{ 
		 if (req.readyState == 4)
		  {
         		if (req.status == 200) 
         		{
         			if(req.responseText == "Error")
         			{
         				alert(req.responseText);
         			}
                   } 
                   else 
                   {
           			 alert('There was a problem with the request.');
         	     }
      }
 
}

// end mine


var timerIds = new Array();
var topMenuStrip;

function fillTimerIdArray(size)
{
	for(i=0;i<size;i++)
	{
		timerIds[i] = -1;
	}
}
function commonMouseOut(obj)
{
	document.getElementById("Layer1").style.visibility = "hidden";	
}

function commonMouseOver(obj)
{
	document.getElementById("Layer1").style.visibility = "hidden";
}

function menuMouseOut(obj)
{
	var ids = (obj.id + "").split("_");
	startOffTimer(ids[1]);
	topMenuStrip = obj
	obj.style.textDecoration = "none";
	//obj.style.backgroundColor = "blue";
	
}

function menuMouseOver(obj)
{
	var ids = (obj.id + "").split("_");
	var ID = ids[1];
	timerIds[ID] = 0;
	topMenuStrip = obj;
	window.clearTimeout(timerIds[ID]);
	obj.style.textDecoration = "underline";
	//obj.style.backgroundColor = "white";
	//obj.style.color = "red";
	menuOn(ID);
}

function menuOn(ID)
{
	for(i=0;i<timerIds.length;i++)
	{
		if(i != ID)
		{
			menuOff(i);
		}
	}
	if(document.getElementById("Layer" + ID) != null)
	{
		document.getElementById("Layer" + ID).style.top = document.getElementById("marker" + ID).offsetTop + 5;
		document.getElementById("Layer" + ID).style.left = document.getElementById("marker" + ID).offsetLeft - 140;
		document.getElementById("Layer" + ID).style.visibility = "visible";
		
	}
}

function menuOff(ID)
{
	if(document.getElementById("Layer" + ID) != null)
	{
		document.getElementById("Layer" + ID).style.visibility = "hidden";	
	}
}

function startOffTimer(ID)
{
	timerIds[ID] = window.setTimeout("menuOff(" + ID + ")", 500);
}

function stopOffTimer(ID)
{
	if(timerIds[ID]!=-1)
	{
		window.clearTimeout(timerIds[ID]);
		timerIds[ID] = -1;
	}
}


