//
// not nice, but we need to trap when the enter button is pressed in an imput field
// so that it will trigger a button click, the following code assume that the input
// contol as the attribute onclick added with the name of this function and the id
// for the button to click..
// 
// this CRclickButton will make a click event if it is a CR
function CRClickButton(buttonID, e)
{
  var code;

  if(!e) var e = window.event;

  if (e.keyCode) 
    code = e.keyCode;
  else 
    if (e.which) code = e.which;

  if(code==13) {
    e.cancelBubble = true;
	  if (e.stopPropagation) e.stopPropagation();
    document.getElementById(buttonID).click();
    window.event.returnValue = false;
    return false;
  }

  return true;    
}



function printpage()
{
  window.print();
}


var ctrl;

function OnFocus(c)
{
  OnFocus(c, c.defaultValue);
}

function OnFocus(c, defaultText)
{
  if (c.type == "text")
  {
    if (defaultText == null)
     defaultText = c.defaultValue;
     
    if (c.value == defaultText) 
      c.value = '';
  }  
  else if (c.type == "textarea")
  {
    c.select();
  }
  
}


function SetFocusDelay(c)
{
	ctrl = document.getElementById(c);
	setTimeout("SetFocus(\"" + c + "\")" , 100);
}


function SetFocus(c)
{
	if (c != null)
		ctrl = document.getElementById(c);
			
	if (ctrl != null)
	{
//		ctrl.select();
		ctrl.focus();
	}
}

