
if (window.Mothiva == null || window.Mothiva == undefined) {

	var Mothiva = {
	
		version: "1.0",
		
		version_monor: 1,
		
		version_major: 0,
		
		user_agent: navigator.userAgent.toLowerCase(),
		
		isStrict: document.compatMode == "CSS1Compat",
		
		isOpera: navigator.userAgent.toLowerCase().indexOf("opera") > -1,
		
		isSafari: (/webkit|khtml/).test(navigator.userAgent.toLowerCase()),
		
		isIE: navigator.userAgent.toLowerCase().indexOf("opera") == -1 && navigator.userAgent.toLowerCase().indexOf("msie") > -1,
		
		isIE7: navigator.userAgent.toLowerCase().indexOf("opera") == -1 && navigator.userAgent.toLowerCase().indexOf("msie 7") > -1,
		
		isGecko: !((/webkit|khtml/).test(navigator.userAgent.toLowerCase())) && navigator.userAgent.toLowerCase().indexOf("gecko") > -1,
		
		isWindows: (navigator.userAgent.toLowerCase().indexOf("windows") != -1 || navigator.userAgent.toLowerCase().indexOf("win32") != -1),
		
		isMac: (navigator.userAgent.toLowerCase().indexOf("macintosh") != -1 || navigator.userAgent.toLowerCase().indexOf("mac os x") != -1),
		
		isLinux: (navigator.userAgent.toLowerCase().indexOf("linux") != -1),
		
		isSecure: window.location.href.toLowerCase().indexOf("https") === 0,
		
		el: function(id)
		{
			return document.getElementById(id);
		},
		
		wr: function(t)
		{
		
			document.write(t);
			if (arguments.length > 1) 
				for (var i = 1; i < arguments.length; i++) 
					document.write(arguments[i]);
		},
		
		execute: function(code)
		{
			if (window.execScript) 
				window.execScript(code);
			else 
				if (Mothiva.isSafari) 
					// safari doesn't provide a synchronous global eval
					window.setTimeout(code, 0);
				else 
					eval(code);
		},
		
		update: function(node, data)
		{
			node.innerHTML = data;
			if (arguments.length > 2 && arguments[2]) {
				var st = node.getElementsByTagName('SCRIPT');
				for (var i = 0; i < st.length; i++) {
					var code = "";
					if (Mothiva.isSafari) {
						code = st[i].innerHTML;
					}
					else if (Mothiva.isOpera) {
						code = st[i].text;
					}
					else if (Mothiva.isGecko) {
						code = st[i].textContent;
					} else {
						code = st[i].text;
					}
					Mothiva.execute(code);
				}
			}
			
		}
	};
	
	String.prototype.trim = function()
	{
		return this.replace(/^\s+|\s+$/g, "");
	}
	String.prototype.ltrim = function()
	{
		return this.replace(/^\s+/, "");
	}
	String.prototype.rtrim = function()
	{
		return this.replace(/\s+$/, "");
	}
	
	/*
	 String.prototype.trim = function()
	 {
	 var re = /^\s+|\s+$/g;
	 return this.replace(re, "");
	 //return function() { this.replace(re, ""); }
	 }
	 */
}
