

//form field names:
//Title - text field

// *********** GLOBAL VARS *****************************

var helpDoc = MM.HELP_inspTitle;

// ******************** API ****************************
function canInspectSelection(){

  var titleObj = getSelectedObj();

  //accept if the selected node is text or if it is the title tag 
  return (titleObj.nodeType==Node.TEXT_NODE || (titleObj.nodeType=Node.ELEMENT_NODE && titleObj.tagName=="TITLE"));
}

function inspectSelection(){
  var titleObj = getSelectedObj();
 
  while (titleObj.nodeType!=Node.ELEMENT_NODE ) //while an element node (the title one) is not selected
    titleObj=titleObj.parentNode; //traverse up the tree	
  findObject("Title").value = titleObj.innerHTML
  showHideTranslated();
}


// ******************** LOCAL FUNCTIONS ****************************

function setTitleTag(){
  var titleObj = getSelectedObj();

//while an element node (the title one) is not selected
  while (titleObj.nodeType!=Node.ELEMENT_NODE ) 
    titleObj=titleObj.parentNode; //traverse up the tree
  
  if (titleObj.innerHTML != findObject("Title").value){
    titleObj.innerHTML = findObject("Title").value;
  }	
}


