function GetElement(id) {
	var	obj	= d.getElementById(id);
	if(obj==null)	throw "Element is null";
	else			return obj;		
}
function GetNamedElements(id) {
	var	obj	= d.getElementsByName(id);
	if(obj.length < 1)	throw "Element is null";
	else				return obj;		
}
function Get(Node,Find) {
	var	slct	= GetNode(Node,Find),
	txt	= "";
	if(slct!=null) {
		for( i = 0; i < slct.childNodes.length; i++ )
			txt	+=slct.childNodes[0].nodeValue;
		return txt;
	}
	return "";
}
function GetNode(Node,Find) {
	var	pths	= Find.split('/'),
	nds	= Node,
	slct	= null,
	txt	= "";
	for( i = 0; i < pths.length; i++) {
		slct		= null;
		for(var j = 0; j < nds.childNodes.length; j++) {
			var	nd	= nds.childNodes[j];
			if(pths[i].toLowerCase() == nd.nodeName.toLowerCase()) {
				slct	= 
				nds	= nd;
				break;
			}
		}
	}
	return slct==null?Node:slct;
}
function GetChildNodes(ele,tag) {
	var	eles	= new Array(),
	eleC	= ele.childNodes;
	for(var gpcI = 0; gpcI < eleC.length; gpcI++) 
		if(eleC[gpcI].tagName != undefined)
			eles.push(eleC[gpcI]);
	return eles;
}
function GetByClass(ele,tag,cl) {
	var	eles	= new Array(),
	eleC	= ele.getElementsByTagName(tag);
	for(var gpcI = 0; gpcI < eleC.length; gpcI++) 
		if( eleC[gpcI].className.toLowerCase().indexOf(cl.toLowerCase()) > -1)
			eles.push(eleC[gpcI]);
	return eles;
}

function CreateElement(tag,att,appChild) {
	var ele		= d.createElement(tag);
	if(att != null) {
		ApplyAttribute(ele,"id",att.id);
		ApplyAttribute(ele,"id",att.idName);
		ApplyAttribute(ele,"name",att.idName);
		ApplyAttribute(ele,"value",att.value
					   );
		if(att.classNm != null)
			ele.className = att.classNm;
		ApplyAttribute(ele,"rows",att.rows);
		ApplyAttribute(ele,"cols",att.cols);
		ApplyAttribute(ele,"cellPadding",att.padSpace);
		ApplyAttribute(ele,"cellSpacing",att.padSpace);
		ApplyAttribute(ele,"cellPadding",att.pad);
		ApplyAttribute(ele,"cellSpacing",att.space);
		ApplyAttribute(ele,"width",att.w);
		ApplyAttribute(ele,"height",att.h);
		ApplyAttribute(ele,"href",att.href);
		ApplyAttribute(ele,"src",att.src);
		ApplyAttribute(ele,"type",att.type);
		ApplyAttribute(ele,"dir",att.dir);
		ApplyAttribute(ele,"style",att.style);
		ApplyAttribute(ele,"title",att.title);
		ApplyAttribute(ele,"alt",att.alt);
		ApplyAttribute(ele,"name",att.name);
		ApplyAttribute(ele,"border",att.border);
		ApplyAttribute(ele,"align",att.align);
		ApplyAttribute(ele,"valign",att.valign);
		ApplyAttribute(ele,"spellcheck",att.spellcheck);
		ApplyAttribute(ele,"action",att.action);
		ApplyAttribute(ele,"method",att.method);
		ApplyAttribute(ele,"maxLength",att.maxChars);
		if(att.forId != null)
			ele.htmlFor	= att.forId;
		if(att.html != null)
			ele.innerHTML	= att.html;
		if(att.submit != null)
			ele.onsubmit	= att.submit;
		if(att.mouseover != null)
			ele.onmouseover	= att.mouseover;
		if(att.mouseout != null)
			ele.onmouseout	= att.mouseout;
		if(att.keyup != null)
			ele.onkeyup	= att.keyup;
		if(att.keypress != null)
			ele.onkeypress	= att.keypress;
		if(att.keydown != null)
			ele.onkeydown	= att.keydown;
		if(att.change != null)
			ele.onchange	= att.change;
		if(att.focus != null)
			ele.onfocus	= att.focus;
		if(att.blur != null)
			ele.onblur	= att.blur;
		if(att.click != null)
			ele.onclick	= att.click;
	}
	if(appChild != null)
		ele.appendChild(appChild);
	return ele;
}
function ApplyAttribute(ele,att,value) {
	if(value != null)
		ele.setAttribute(att,value);
}


function ThrowMessage(apply,message) {
	if(apply) {
		var	divId		= "throwMessageDiv",
		throwEle;
		if(d.getElementById(divId) == null) {
			throwEle			= d.createElement("div");
			throwEle.id			= divId;
			throwEle.className	= "ThrowMessage";
			d.body.appendChild(throwEle);
		} else
			throwEle			= GetElement(divId);
		throwEle.innerHTML		= message;
		throwEle.style.display	= "block";
	}
}
function ClearThrowMessage (){
	var	divId		= "throwMessageDiv";
	if(d.getElementById(divId) != null)
		GetElement(divId).style.display	= "none";
}

