var IE = document.all?true:false;

//mouse position
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;
var tempX = 0;
var tempY = 0;
function getMouseXY(e) {
if (IE) { // grab the x-y pos.s if browser is IE
tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
}
else {  // grab the x-y pos.s if browser is NS
tempX = e.pageX;
tempY = e.pageY;
}  
if (tempX < 0){tempX = 0;}
if (tempY < 0){tempY = 0;}  
return true;
}


function addZero(num)
{
  if (num < 10)
    return '0' + num;
  return num;
}

function swapview(input1, input2)
{
  input1.style.display = 'none';
  input2.style.display = '';
  input2.focus();
}

function OpenLegend(legend)
{
  var mouseTop = getLengthFromPx(getMouseTop());
  legend.style.top = mouseTop + 'px';
  var mouseLeft = getLengthFromPx(getMouseLeft());
  legend.style.left = ((parseInt(mouseLeft) < parseInt(getLengthFromPx(legend.style.width)) ?
			mouseLeft :
			(mouseLeft - getLengthFromPx(legend.style.width))) - 0 + 5) + 'px';
  legend.style.display = '';
  
}

function CloseLegend(legend)
{
  legend.style.display = 'none';
}

function getMouseTop()
{
  return tempY;
}

function getMouseLeft()
{
  return tempX;
}

function getLengthFromPx(length)
{
  length = length + '';
  var ret = '';
  for (var i = 0; length.charCodeAt(i) >= 48 && length.charCodeAt(i) <= 57; i++)
    ret += length.charAt(i) + '';
  return ret;
}

function TurkishChar(idInput, leChar)
{
  document.getElementById(idInput).innerHTML = document.getElementById(idInput).value + leChar; 
}

