
// DOM Helper Functions --------------------------------------------------

//////////////////////////////////////////////////////////////////////////
// 関数名：GetTextNodeValue() / SetTextNodeValue()
// 引数  ：
// 戻り値：
// 概要  ：
//////////////////////////////////////////////////////////////////////////
function GetTextNodeValue(node)
{
  return (node && node.childNodes.length == 1) ? node.firstChild.nodeValue : "";
}
function SetTextNodeValue(node, value)
{
  if (node && node.childNodes.length == 1) node.firstChild.nodeValue = value;
}

//////////////////////////////////////////////////////////////////////////
// 関数名：GetTextFrom1stChild() / SetTextInto1stChild()
// 引数  ：
// 戻り値：
// 概要  ：
//////////////////////////////////////////////////////////////////////////
function GetTextFrom1stChild(node)
{
  return (node && node.length == 1) ? GetTextNodeValue(node[0]) : "";
}
function SetTextInto1stChild(node, value)
{
  if (node && node.length == 1) SetTextNodeValue(node[0], value);
}

//////////////////////////////////////////////////////////////////////////
// 関数名：CreateLinkText
// 引数  ：
// 戻り値：
// 概要  ：
//////////////////////////////////////////////////////////////////////////
function CreateLinkText(lnkText, hrefURL, targetName)
{
  var d = document;
  var anchr = d.createElement("a");
  anchr.setAttribute("href", hrefURL);
  anchr.setAttribute("target", targetName);
  anchr.appendChild(d.createTextNode(lnkText));
  return anchr;
}

//////////////////////////////////////////////////////////////////////////
// 関数名：AddHandler
// 引数  ：
// 戻り値：
// 概要  ：
//////////////////////////////////////////////////////////////////////////
function AddHandler(dstObj, eventType, funcName)
{
  if (!dstObj) return;
  if (document.all) // IE
    dstObj.setAttribute(eventType, new Function(funcName));
  else // FireFox, Safari
    dstObj.setAttribute(eventType, funcName);
}


