function findInChildren(event,fromNode,actionName,id){
	subTgt = null;
	return scanChildNodes(event,fromNode,actionName,id);
}

function isChild(e,tgt,id,sub){
	id = id+'_'+sub;
	for(var i = 0 ; i < tgt.childNodes.length ; i++){
		if (e == tgt.childNodes.item(i))
			return i;
		else if (tgt.childNodes.item(i).hasChildNodes())
			if(scanChildren(e,tgt.childNodes.item(i),id,i)) return i;
	}
}

function hasChildren(nodeList){
	var test = false;
	for(node = 0 ; node < nodeList.childNodes.length ; node++){
		if (nodeList.childNodes[node].nodeType == 1){
			test = true;
			break;
			}
		}
		return test;
}
function scanChildren(e,tgt,id,sub){
	id = id+'_'+sub;
	var j = id+'_'+sub;
	for(j = 0 ; j < tgt.childNodes.length ; j++){
		if (e == tgt.childNodes[j]) {	
			return true;
			break;
			}
		else if(tgt.childNodes[j].hasChildNodes()) scanChildren(e,tgt.childNodes[j],id,j);
	}
}

function scanChildNodes(event,fromNode,actionName,id,tgName){
	var k = id+'_';
	for(k = 0 ; k < fromNode.childNodes.length && subTgt == null; k++){
		if(fromNode.childNodes[k].name && fromNode.childNodes[k].name == actionName) subTgt = fromNode.childNodes[k];
		else if(fromNode.childNodes[k].id && fromNode.childNodes[k].id == actionName) subTgt = fromNode.childNodes[k];
		else if(fromNode.childNodes[k].childNodes.length > 0) findInChildren(event,fromNode.childNodes[k],actionName,k);
		if (subTgt != null) break;
	}
	if(subTgt != null) return subTgt;
}

function findAnchorsInChildren(event, fromNode, id, subId, tmpArray){	return scanAnchors(event, fromNode, id, subId, tmpArray);}

function scanAnchors(event, fromNode, id, subId, tmpArray){
	id = id+'_'+subId;
	var k = id+'_'+subId;
	for(k = 0 ; k < fromNode.childNodes.length; k++){
		if(fromNode.childNodes[k].tagName == "A"){				
			if (fromNode.childNodes[k].name != null && fromNode.childNodes[k].name.length > 0) tmpArray.addElement(fromNode.childNodes[k].name);
			}
		else if(fromNode.childNodes[k].childNodes.length > 0) findAnchorsInChildren(event, fromNode.childNodes[k], id, k, tmpArray);
	}
}

function getNodesLength(oNode){
	var count = 0;
	var oChild = getFirstChild(oNode);
	while(oChild){
		if (oChild.nodeType == 1) count++;
		oChild = (oChild.nextSibling)? oChild.nextSibling : null;	
		}
	return count;
}

function getInNodeList(list,yNode,xNode,xIdx,action){
	yNode = getFirstChild(findInChildrenByTagName(list,yNode));
	
	for (i = 0; i < getNodesLength(yNode); i++){
		if (i > 0) yNode = yNode.nextSibling;
		tgt = getFirstChild(findInChildrenByTagName(yNode,xNode))
		
		for (j = 0; j < xIdx+1; j++){
			if (j > 0) tgt = tgt.nextSibling;
			while (tgt.nodeType != 1) tgt = tgt.nextSibling;
			}
			
			action(tgt);
		}
}

function actIt(oNode){
oNode.parentNode.removeChild(oNode);
}

function findInChildrenByTagName(oNode,tName){
	while(oNode.tagName != tName)	oNode = oNode.childNodes[0];
	return oNode;
}

function getFirstChild(oNode){
	while(oNode.nodeType != 1)	oNode = oNode.nextSibling;
	return oNode;
}

function getPreviousSibling(oNode){
	while(oNode.nodeType != 1)	oNode = oNode.previousSibling;	
	return oNode;
}

function getNextSibling(oNode){
	while(oNode.nodeType != 1)	oNode = oNode.nextSibling;	
	return oNode;
}

function getInNextSibling(event,oNode,name){
	oNode = oNode.nextSibling;
	while(oNode.nodeType != 1)	oNode = oNode.nextSibling;
	return scanChildNodes(event,oNode,name);
}

function addPreviousChild(oNode,oChild){
	oNode.insertBefore(oChild,oNode.firstChild);
	oNode.removeChild(getLastChild(oNode.lastChild));
}

function addNextChild(oNode,oChild){
	oNode.insertBefore(oChild,null);
	oNode.removeChild(getFirstChild(oNode.firstChild));
}

function setTable(e){
	e.setAttribute("cellPadding","0");
	e.setAttribute("cellSpacing","0");
	e.setAttribute("border","0");
}