//-----------------------------------------------------------------------------------------------------//

/*
--- Test to see if the Zaltana library has been loaded
*/

if (!Zaltana){var Zaltana={};};

// Begin Zaltana util library

Zaltana.util = {};

// Zaltana util string functions

Zaltana.util.string = {};

Zaltana.util.string.removeWhiteSpace = function() {
	return str.replace(/^\s+/g, '').str(/\s+$/g, '');
}

Zaltana.util.formManip = {};

// form manipulation functions taken from miform.js in the old mistyles
Zaltana.Dom = {};

Zaltana.Dom.getParentElementByClass = function(node, sClass)	{
	var regExp =  new RegExp(sClass,'g'); // TODO test this regexp
	while (node) {
		if(regExp.test(node.className)) {
			return node;
		} else {
			node = node.parentNode;
		}
	}
	return;
}

Zaltana.Dom.getAncestorByTagName = function(node, tagName) {
	while (node) {
		if(node.tagName && node.tagName.toLowerCase() == tagName) {
			return node;
		} else {
			node = node.parentNode;
		}
	}
};