/***********************************************
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

function genericOnLoad(functionName) {
	if(typeof window.addEventListener != 'undefined'){
		window.addEventListener('load', functionName, false);
	}
	else if(typeof document.addEventListener != 'undefined'){
		document.addEventListener('load', functionName, false);
	}
	else if(typeof window.attachEvent != 'undefined'){
		window.attachEvent('onload', functionName);
	}
}
document.getElementsByClassName = function(cl) {
	var retnode = [];
	var myclass = new RegExp('\\b'+cl+'\\b');
	var elem = this.getElementsByTagName('*');
	for (var i = 0; i < elem.length; i++) {
		var classes = elem[i].className;
		if (myclass.test(classes)) retnode.push(elem[i]);
	}
	return retnode;
};


function leftTrim(sString){
	while (sString.substring(0,1) == ' '){
		sString = sString.substring(1, sString.length);
	}
	return sString;
}

function rightTrim(sString) {
	while (sString.substring(sString.length-1, sString.length) == ' '){
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}

function trimAll(sString){
	while (sString.substring(0,1) == ' '){
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' '){
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}

function openPopup(p, w, h){
	var left = (screen.availWidth/2) - (w/2);
	var top = (screen.availHeight/2) - (h/2);
	window.open(p, '', 'width='+w+',height='+h+',resizable=yes,scrollbars=yes,status=no,left='+left+',top='+top);
}
function gotoURL(url){
	document.location.href=url;
}
