var tagsArray;

function getIncludedTags(objRef, tagNameList, recurse) {   
  if (!objRef || !objRef.childNodes)
    return null;
  
  var allTags = false;
  if (tagNameList == null || tagNameList.toLowerCase() == 'all')
	allTags = true;
  else
    tagSearchList = ',' + tagNameList.toLowerCase() + ',';
  
  if (recurse == null)
    recurse = true;
    
  tagsArray = new Array();
  
  for (var i = 0; i < objRef.childNodes.length; i++) {
    if ( objRef.childNodes[i].tagName && 
         ( allTags == true || 
           tagSearchList.indexOf(',' + objRef.childNodes[i].tagName.toLowerCase() + ',') != -1 ) ) {
      tagsArray[tagsArray.length] = objRef.childNodes[i];
    } 
    if (recurse && objRef.childNodes[i].childNodes)
      getIncludedChildTags(objRef.childNodes[i], tagNameList);
  }
  return tagsArray;
}

function getIncludedChildTags(parentRef, tagNameList) {   
  if (!parentRef || !parentRef.childNodes)
    return;

  var allTags = false;
  if (tagNameList == null || tagNameList.toLowerCase() == 'all')
	allTags = true;
  else
    tagSearchList = ',' + tagNameList.toLowerCase() + ',';

  for (var i = 0; i < parentRef.childNodes.length; i++) {
    if ( parentRef.childNodes[i].tagName &&
         ( allTags == true || 
           tagSearchList.indexOf(',' + parentRef.childNodes[i].tagName.toLowerCase() + ',') != -1 ) ) {     
      tagsArray[tagsArray.length] = parentRef.childNodes[i];
    }
    if (parentRef.childNodes[i].childNodes.length != 0)
      getIncludedChildTags(parentRef.childNodes[i], tagNameList);
  }
}

// Constructor for custom object that represents an item on the context menu
function ContextMenuItem(string, cmdId)
{
  this.string = string;
  this.cmdId = cmdId;
}

// Constructor for custom object that represents a QueryStatus command and
// corresponding toolbar element.
function QueryStatusItem(command, element)
{
  this.command = command;
  this.element = element;
}

var CP_LISTPROP_INDEX, CP_ANCHOR_INDEX;

// Event handlers
function window_onload()
{
   if (!window.parent.loaded) {
    setTimeout("window_onload()", 100);
    return;
  }
 
  window.parent.scrollTo(0,0);
  parentelement = eval('window.parent.document.' + thisForm + '.elements[0]');
  //  alert (window.parent.thisForm.elements[0].type);
  if (parentelement.type == "text" && !parentelement.disabled)
  	parentelement.focus();

  setTimeout("setval()", 500);
    
  doDocOnReadyStateChange();
}

function window_onresize(w,h)
{
	alert ('in resize:'+w+':'+h);
}

// Utility used to open dialogs
//function newWindow (name, url)
//{
//	window.open (url, name, "toolbar=no,scrollbars=yes,menubar=no,location=no,width=1,height=1,top=" + window.screen.height + ",left=" + window.screen.width);
//}
