var vehiclePopupCount=0;
var vehiclePopupShow = new Array();
var vehiclePopupHide = new Array();

function stopEvent()
{
	e=window.event;
	e.cancelBubble = true;
	if (e.stopPropagation) e.stopPropagation();
}

function vehiclePopupOver(id)
{
	window.focus();
	if(vehiclePopupShow[id] == null)
	{
		vehiclePopupShow[id]=0;
	}
	if(vehiclePopupHide.length)
	{
		for(var i=0;i<vehiclePopupHide.length;i++)
		{
			vehiclePopupOutTimeout(vehiclePopupHide[i]);
		}
		vehiclePopupHide.length = new Array();
	}
	document.getElementById('detail'+id).style.display='';
	document.getElementById('td'+id).style.zIndex=1000;

	vehiclePopupShow[id]++;
}

function vehiclePopupOut(id)
{
	vehiclePopupShow[id]--;
	vehiclePopupHide[vehiclePopupHide.length] = id;
	setTimeout("vehiclePopupOutTimeout('"+id+"')","250");

}

function vehiclePopupOutTimeout(id)
{
	if(vehiclePopupShow[id] < 1)
	{
		document.getElementById('detail'+id).style.display='none';
		document.getElementById('td'+id).style.zIndex=99;
	}
	else
	{
		setTimeout("vehiclePopupOutTimeout('"+id+"')","250");
	}
}

function vehiclePopupMove(id)
{
	document.getElementById('detail'+id).style.top = event.y - document.getElementById('detail'+id).offsetHeight + 100;
	document.getElementById('detail'+id).style.left = event.x  - document.getElementById('detail'+id).offsetWidth + 185;

}

function vehiclePopupTopRightMove(id)
{
	document.getElementById('detail'+id).style.top = event.y - document.getElementById('detail'+id).offsetHeight;
	//document.getElementById('detail'+id).style.left = event.x + 30;
	document.getElementById('detail'+id).style.left = 426 - document.getElementById('detail'+id).offsetParent.offsetLeft;
}

function vehiclePopupSelectHide()
{
	vehiclePopupCount++;
	 	var s = document.getElementsByTagName('select');
	  	for (var i=0; i<s.length; i++) {
			s[i].style.display='none';
		}
}

function vehiclePopupSelectShow()
{
	vehiclePopupCount--;
	setTimeout("vehiclePopupSelectShowTimeout()","250");
}

function vehiclePopupSelectShowTimeout()
{
	if(vehiclePopupCount < 1)
	{
	 	var s = document.getElementsByTagName('select');
	  	for (var i=0; i<s.length; i++) {
			s[i].style.display='';
		}
	}
	else
	{
		setTimeout("vehiclePopupSelectShowTimeout()","250");
	}
}
