// Octix Common JavaScript utility routines.
// Copyright (c) 2006 Octix Software Corp
// Doug Luecke
// 2006-03-14 drl Begin Initial version.

// Copy the given text value to the system clipboard.
function SetClip(val) {
	window.clipboardData.setData('Text',val);
}

// Get the current text value from the system clipboard.
function GetClip(){
	return window.clipboardData.getData('Text');
}

// Get the selected value of the named SELECT object.
function GetSelValue(objId)
{
	var selValue = 0;
	var selObj = document.getElementById(objId);
	if ((selObj != null) && (selObj.selectedIndex >= 0)) {
	  selValue = selObj.options[selObj.selectedIndex].value;
	}
  return selValue;
}

// Ensure that the named Text object is not empty.
function ValidateTextNotEmpty(objId, msg)
{
  var isValid = false;
  var textObj = document.getElementById(objId);
  if (textObj != null)
  {
    if (textObj.value.length > 0)
    {
      isValid = true;
    }
    else
    {
      if (!textObj.disabled)
      {
        textObj.focus();
        textObj.select();
      }
      alert(msg);
    }
  }
  return isValid;
}

