/*
 * Copyright 2005-2006, Peter Rowntree. All Rights Reserved.
 * http://www.hdyn.com/wr/common/contact.php?addr=pr
 */

var g_ctx="/ui22/";
var g_id=(typeof getQueryItem == "undefined" ? null : getQueryItem("id"));
if(g_id != null)
   document.title+=" "+g_id;
var g_reportOb=null;

function getID()
{
   return g_id;
}

function getBranchURI(id)
{
   return "http://people.22true.com/"+id+".html";
}

function docName()
{
   var s=window.location.toString();
   var arr=s.split("/");
   if(arr.length < 1)
      return "";
   return arr[arr.length-1];
}

//if className == null it's ignored
//only works with HTML nodes because n.className is only defined for html nodes
function indImmediateChild(n,i,tagName,className)
{
	tagName=tagName.toLowerCase();
   n=n.firstChild;
   while(n != null)
   {
   	if(n.nodeName.toLowerCase() == tagName 
         && (className == null || n.className == className) && i-- <= 0)
   		return n;
   	n=n.nextSibling;
   }
   return n;
}

function entit(s)
{
   s=s.replace(/&/g,"&amp;")
      .replace(/</g,"&lt;")
      .replace(/>/g,"&gt;");
   var regex=new RegExp("\"","g"); //stray quote breaks js.php
   return s.replace(regex,"&quot;");
}

function deentit(s)
{
   return s.replace(/&quot;/g,"\"")
      .replace(/&gt;/g,">")
      .replace(/&lt;/g,"<")
      .replace(/&amp;/g,"&");
}

function report(s)
{
   if(g_reportOb == null)
   	return;
   g_reportOb.innerHTML=s;
}

function setObClass(ob,oc,set)
{
   oc=" "+oc;
   var regex=new RegExp(oc);
   var c=ob.className;
	if(set)
   {
      if(c.indexOf(oc) >= 0)
         return false;
      c+=oc;
   }
   else
   {
      var oldC=c;
      c=c.replace(regex,"");
      if(c == oldC)
         return false;
   }
   ob.className=c;
   return true;
}

function stopEvent(e)
{
   if(typeof e.stopPropagation != "undefined")
      e.stopPropagation();
   else if(typeof e.cancelBubble != "undefined")
      e.cancelBubble=true;
}