var gSafeOnload = new Array();

function AddOnload(f) {
	if  (window.onload) {
		if (window.onload != SafeOnload) {
			gSafeOnload[0] = window.onload;
			window.onload = SafeOnload;
		}
		gSafeOnload[gSafeOnload.length] = f;
	} else {
		window.onload = f;
	}
}
function SafeOnload() {
	for (var i=0;i<gSafeOnload.length;i++) {
		gSafeOnload[i]();
	}
}

function is_ie() {
	if (navigator.appName == "Microsoft Internet Explorer") {
		return true;
	}
	
	return false;
}
function redirect(loc) {
	document.location.href = loc;
}
function goto(loc) { redirect(loc); }
function submitOnce(theform) {
	if (document.all || document.getElementById) {
		for (i = 0; i < theform.length; i++) {
			var tempobj = theform.elements[i];
			
			if (!tempobj.tagName || !tempobj.type) {
				continue;
			}
			
			if (tempobj.tagName.toLowerCase() == "input" && (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "button")) {
				tempobj.disabled = true;
			}
		}
	}
}
function enableSubmit(theform) {
	if (document.all || document.getElementById) {
		for (i = 0; i < theform.length; i++) {
			var tempobj = theform.elements[i];
			
			if (!tempobj.tagName || !tempobj.type) {
				continue;
			}
			
			if (tempobj.tagName.toLowerCase() == "input" && (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "button") && tempobj.disabled) {
				tempobj.disabled = false;
			}
		}
	}
}
function trim(str) {
	str = str.replace(/^[ |\n|\s]+(.*)$/, '$1');
	str = str.replace(/^(.*)[ |\n|\s]$/, '$1');
	
	return str;
}