// global functions
function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}

function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

function dID( idFun ) {
	return document.getElementById( idFun );
}

function dTAG( tagFun , obFun ) {
	var ob = document;
	
	if( !tagFun ) { tagFun = '*'; }
	if( obFun ) { ob = obFun; }
	
	if( ob ) {
		return ob.getElementsByTagName( tagFun );
	}
}


function dCLASS( classFun , tagFun ) {
	if( !classFun ) { classFun = ''; }
	if( !tagFun ) { tagFun = '*'; }
	
	var divList 	= dTAG( tagFun );
	var classList 	= new Array();
	
	if( divList ) {
		for( var el in divList ) {
			if( ( divList[ el ].className == classFun ) ) {
				classList.push( divList[ el ] );
			}
		}
	}
	
	return classList;
}

