//called when the cahnnel page loads
function chanelLoad()
{
  if(parent.document)
  {
    //changes all the links to open in the parent window
    allLnk = document.getElementsByTagName("a");
    for (curLn=0;curLn<allLnk.length;curLn++)
      if (allLnk[curLn].target == "")
        allLnk[curLn].target = "_parent";
  
    //resizes the frame in the parent document verticly to fit the channel
    resizeFrame();
  }
}

//resizes the frame in the parent document verticly to fit the channel
function resizeFrame()
{
  //gets all the iframes in the parent document
  allFrm = parent.document.getElementsByTagName("iframe");
  for(frmNum=0;frmNum<allFrm.length;frmNum++)  //finds the parent frame
    if(allFrm[frmNum].contentWindow.location == document.location)
      parFrame = allFrm[frmNum];

  //gets the window size
  frameHeight = document.getElementsByTagName("div")[0].clientHeight;
  if (frameHeight == 0) //for IE
    frameHeight = document.body.scrollHeight;
  
  //if a height is found then resize
  if (frameHeight > 0)
  {
    //sets the 
    parFrame.style.height = frameHeight +"px";
  }
  else
    setTimeout('resizeFrame()',500);
}

//sets the domain so that the calling page can access the parent page
try{parent.document.domain;}
catch (error)
{document.domain = "beliefnet.com";}
parFrame = "";