// when deployoing custom controls into a new project copy this file into the <Project Root>/js folder
// standard popup window
function popmetoo(target, options) {
	window.open(target, '_blank', options);
}

function CaptureEnterKey(ButtonToClick) 
{    
	if (event.keyCode == 13) 
	{        
		event.cancelBubble = true;
		event.returnValue = false;
		Form1[ButtonToClick].click();
	}
}


function ReplaceEnterKey(elm) 
{    
	if (event.keyCode == 13) 
	{    
		event.cancelBubble = true;
		event.returnValue = false;
		elm.value = elm.value + "\n";
	}
}



function setFocusOnLoad()
{
// if there are any forms on a page this function sets the focus on the first element which is not hidden
  var firstForm, i;
  if(document.forms.length > 0) {
    firstForm = document.forms[0];
    for (i=0; i<firstForm.length; i++) {
      if (!isHidden(firstForm.elements[i]) ) {
        firstForm.elements[i].focus();
        break;
      }
    }
  }
}

function isHidden(elm) {
// returns true if a form element is a hidden field
  if(elm.type == "hidden") {
    return true;
  }
  return false;
}
