/* version 2.0.1.0 */

/* estrada */

window.estrada = {
	"namespace": "var frame = window.estrada.frame; var area = window.estrada.area; var cols = window.estrada.cols; var grab = window.estrada.grab; var attachEvent = window.tilt.attachEvent;var detachEvent = window.tilt.detachEvent;",
	hasClassName: function(node, className) {
		return node && className && (" " + node.className + " ").indexOf(" " + className + " ") >= 0;
	},
	layoutView: {
		"$__layoutView": { },
		set: function(mode) {
			this.$__layoutView = mode;
			if (this.$__layoutView) {
				/*document.body.className += " l-layoutview";*/
				estrada.createNodeClassAttribute = estrada.$createNodeClassAttribute;
				tilt.addLink("layoutview.css");
			}
			else {
				this.createNodeClassAttribute = function() { return "" };
				/*document.body.className.replace("l-layoutview", "");*/
			}
		},
		get: function() {
			return this.$__layoutView;
		},
		isTrue: function() {
			return this.$__layoutView == true;
		}
	},
	setUniqueId: function(node) {
		var id = node && node.id;
		if (!id) {
			if (document.uniqueID) {
				id = document.uniqueID;
			} else {
				if (!arguments.callee.count) arguments.callee.count = 0;
				id = "uid-" + arguments.callee.count++;
			}
			if (node) {
				node.id = id;
			}
		}
		return id;
	},
	"$behaviors": {
	},
	ajah: function(url, callbacks, finalizer) {
		if (url) {
			var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : null;
			if (xhr) {
				var prefix = estrada.setUniqueId(url);
				xhr.onreadystatechange = function() {
					if (xhr.readyState == 4 && xhr.status == 200) {
						var html = xhr.responseText;
						var startPos = html.indexOf("body>");
						if (startPos >= 0) {
							startPos += 5;
							var endPos = html.indexOf("</body", startPos);
							if (endPos >= 0) {
								html = html.substring(startPos, endPos).replace(/id(\s)*=(\s)*"/g, "id=\"" + prefix + "-");
								var store = document.body.appendChild(document.createElement("div"));
								store.style.cssText = "position:absolute;left:-1972px;width:10px;height:10px;overflow:hidden;";
								store.innerHTML = html;
								for(var id in callbacks) {
									var node = document.getElementById(prefix + "-" + id);
									if (node) {
										callbacks[id](node);
									}
								}
								store.parentNode.removeChild(store);
								if (finalizer) {
									finalizer();
								}
							}
						}
					}
				}	
				xhr.open("GET", url, true);
				xhr.send(null);
			}
		}
	},
	behavior: function(name) {
		return this.$behaviors[name] || (this.$behaviors[name] = {
			is: function(decl) {
				this.$decl = decl;
			},
			bindTo: function(node) {
				var decl = this.$decl;
				node = node.nodeName || document.getElementById(node);
				if (node && decl) {
					var behaviorScope = estrada.scope.create(name);
					estrada.scope.create(name, this.nodeId);
					decl.nodeId = estrada.setUniqueId(node);
					decl.attachEvent = function(element, name, handler) {
						var scope = estrada.scope.create(behavior, this.nodeId, name);
						handler.scopeId = scope.id;
						tilt.attachEvent(element, name, handler);
					}
					decl.bind(node, behaviorScope);
				}
			}
		});
	},
	scope: {
		retrieve: function(arg) {
			return this.$store[arg.callee.scopeId];
		},
		create: function(key, id, eventName) {
			var scopeId = key ? key : "";
			if (id) {
				scopeId += "\\" + id;
			}
			if (eventName) {
				scopeId += "\\" + eventName;
			}
			
			return this.$store[scopeId] || (this.$store[scopeId] = {
				"#": id,
				"$key": key,
				"$id": "\\" + id,
				id: scopeId,
				getBehaviorScope: function() {
					return estrada.scope.$store[this.$key];
				},
				getElementScope: function() {
					return estrada.scope.$store[this.$id];
				},
				getBindingScope: function() {
					return estrada.scope.$store[this.id];
				},
				getElement: function() {
					return document.getElementById(this["#"]);
				}
			})
		},
		"$store": {},
		"$keyStore": {},
		"$idStore": {}
	},
	"$buildNode": function(node, parent, id, html) {
		var div = parent.appendChild(document.createElement("div"));
		if (id) {
			div.id = id;
		}
		if (estrada.layoutView.isTrue()) {
			div.className = this.$createNodeClassName(node);
		}
		if (html) {
			div.innerHTML = html;
		}
		return div;	
	},
	"$createNodeId": function(id) {
		return "l-" + id;
	},
	"$addNodeId": function(id, ids) {
		var oldId = ids[id];
		if (oldId) {
			var newId;
			if (typeof(oldId) == "string") {
				newId = this.$createNodeId(id) + "-1";
				ids[id] = [ oldId, newId ];
			}
			else {
				newId = this.$createNodeId(id) + "-" + (old.length - 1);
				oldId.push(newId);
			}
			return newId;
		}
		return ids[id] = this.$createNodeId(id);
	},
	"$createNodeClassName": function(node) {
		return "l-layoutview-" +
			((node.nodeClass.length > 0) ? node.nodeClass : "undefined") +
			((node.className.length > 0) ? " l-layoutview-" + node.className : "");
	},
	"$createNodeClassAttribute": function(node, className) {
		if (estrada.layoutView.isTrue()) {
			return " class=\"" + ((className && className.length > 0) ? className + " " : "" ) + this.$createNodeClassName(node) + "\" ";
		}
		return "";
	},
	createNodeClassAttribute: function() { return "" },
	grab: function(node, buckets) {
		var result = {};
		foreach(node, function(node) {
			push(getClassName());
			
			function push(bucket) {
				if (bucket) {
					var items = result[bucket];
					if (!items) {
						items = [];
						result[bucket] = items;
					}
					items.push(node);
				}
			}
			
			function getClassName() {
				for(var className in buckets) {
					if (foreach(node.className.split(" "), function(nodeClassName) {
						return nodeClassName == className;
					})) {
						return buckets[className];
					}
				}
			}

		});
		return result;
	},
	grabByNodeName: function(node, buckets) {
		var result = {};
		foreach(node, function(node) {
			push(getNodeName());
			
			function push(bucket) {
				if (bucket) {
					var items = result[bucket];
					if (!items) {
						items = [];
						result[bucket] = items;
					}
					items.push(node);
				}
			}
			
			function getNodeName() {
				for(var nodeName in buckets) {
					if (node.nodeName == nodeName) {
						return buckets[nodeName];
					}
				}
			}

		});
		return result;
	},
	getInnerText: function(node) {
		return expand(node);
	
		function expand(node) {
			if (node.nodeType == 3) {
				return node.nodeValue;
			}
			var result = "";
			var child = node.firstChild;
			while(child) {
				result += expand(child);
				child = child.nextSibling;
			}
			return result;
		}
	},
	frame: function(id) {
		var items = [];
		var flags = [];
		for(var i = 1; i < arguments.length; i++) {
			var item = arguments[i];
			if (item.link) {
				item.link(flags);
			}
			items.push(item);
		}
				
		return {
			id: id,
			nodeClass: "frame",
			className: "",
			build: function(node) {
				var ids = {};
				var posts = {};
				var html = this.$write(ids, posts);
				estrada.$buildNode(this, node, estrada.$createNodeId(id), html);
				if (estrada.layoutView.isTrue()) {
					foreach(map(node.getElementsByTagName("div"), function(node) {
						return (node.className && node.id  && estrada.hasClassName(node, "l-layoutview-area")) ? node : null;
					}), function(node) {
						if (node) {
							var label;
							if (node.tagName != "INPUT" && node.tagName != "A") {
								label = node.insertBefore(document.createElement("div"), node.firstChild);
							}
							if (label) {
								label.innerHTML = "<span class=\"l-text\">" + (node.tagName != "DIV" && node.tagName != "SPAN" ? node.tagName.toLowerCase() : "") + (node.id ? "#" + node.id : "") + "</span>";
								node.className += " l-with-label";
							}
							/*
							var content = document.createElement("div");
							content.className = "l-layoutview-content";
							node.appendChild(content);
							*/
						}
			
					});
				}
				return {
					bind: function(behavior) {
						return {
							to: function(area) {
								var b = estrada.behavior(behavior);
								if (b) {
									var decl = b.$decl;
									var node = area.nodeType && area.nodeName ? area : function() {
										var id = ids[area];
										if (id) {
											return document.getElementById(id);
										}
									}();
									if (node && decl) {
										var behaviorScope = estrada.scope.create(behavior);
										estrada.scope.create(behavior, this.nodeId);
										decl.nodeId = estrada.setUniqueId(node);
										decl.attachEvent = function(element, name, handler) {
											var scope = estrada.scope.create(behavior, this.nodeId, name);
											handler.scopeId = scope.id;
											tilt.attachEvent(element, name, handler);
										}
										decl.bind(node, behaviorScope);
									}
								}
							}
						}
					},
					push: function(params) {
						for(var p in params) {
							var dest = ids[p];
							if (dest) {
								var hasData;
								if (typeof(dest) == "string") {
									forDest(dest, function(node) {
										hasData = appendRec(params[p], node);
									});
								}
								else { // array
									var firstDest = dest[0];
									firstDest = forDest(firstDest, function(node) {
										hasData = appendRec(params[p], node);
									});
									if (firstDest) {
										var html = firstDest.innerHTML;
										for(var i = 1; i < dest.length; i++) {
											forDest(dest[i], function(node) {
												node.innerHTML = html;
											});
										}
									}
								}
								if (hasData) {
									foreach(posts[p], function(post) {
										post.raise();
									})
								}
							}
						}
						
						function forDest(id, handler) {
							var dest = document.getElementById(id);
							if (dest) {
								handler(dest);
								return dest;
							}
						}
						
						function appendRec(ref, dest) {
							if (ref) {
								if (typeof(ref) == "string") {
									return append(document.getElementById(ref), dest);
								}
								if (typeof(ref) == "function") {
									return append(ref(), dest);
								}
								if (ref.nodeType) {
									return append(ref, dest);
								}
								if (ref.length) {
									var hasData;
									foreach(ref, function(item) {
										var r = appendRec(item, dest);
										if (r && !hasData) {
											hasData = true;
										}
									})
									return hasData;
								}
							}
						}
						
						function append(target, dest) {
							if (target && target.nodeType) {
								dest.appendChild(target);
								return true;
							}
						}	
					}
				}
			},
			"$write": function(ids, posts) {
				var html = "";
				foreach(items, function(item) {
					if (item.write) {
						html += item.write(ids, posts);
					}
				});
				return html;
			},
			write: function(ids, posts) {
				return "<div id=\"" + estrada.$addNodeId(id, ids) + "\"" + estrada.createNodeClassAttribute(this) + ">" + this.$write(ids, posts) + "</div>";
			},
			link: function(parentFlags) {
				foreach(flags, function(flag) {
					parentFlags.push(flag);
				});
			}
		}
	},
	area: function(id) {
		return {
			id: id,
			nodeClass: "area",
			className: "",
			write: function(ids, posts) {
				return "<div id=\"" + estrada.$addNodeId(id, ids) + "\"" + estrada.createNodeClassAttribute(this) + "></div>";
			},
			build: function(node) {
				$buildNode(node, id);
				return {
				}
			},
			link: function(flags) {
				flags.push(id);
			}
		}
	},
	cols: function(one, two) {
		var oneFlags = [];
		if (one.link) {
			one.link(oneFlags);
		}
		var twoFlags = [];
		if (two.link) {
			two.link(twoFlags);
		}
		one.className = "cols-left";
		two.className = "cols-right";
		var colsBottom = {
			nodeClass: "div",
			className: "cols-bottom"
		};
		return {
			nodeClass: "cols",
			className: "",
			write: function(ids, posts) {
				var oneId = one.id;
				var twoId = two.id;
				var composite = oneId + "-" + twoId;
				var boxId = "l-" + composite;
				var noneFlag = boxId + "--";
				var bothFlag = boxId;
				foreach(oneFlags, function(flag) {
					var post = posts[flag];
					if (!post) {
						post = [];
						posts[flag] = post;
					}
					post.push({
						raise: function() {
							setFlag(oneId);
						}
					})
				})
				foreach(twoFlags, function(flag) {
					var post = posts[flag];
					if (!post) {
						post = [];
						posts[flag] = post;
					}
					post.push({
						raise: function() {
							setFlag(twoId);
						}
					})
				})
				return "<div id=\"" + boxId + "\"" + createClassAttribute(this, noneFlag) + ">" + one.write(ids, posts) + two.write(ids, posts) + "<div id=\"l-bottom-" + composite + "\"" + estrada.createNodeClassAttribute(colsBottom) + "></div></div>";
				function createClassAttribute(node, noneFlag) {
					var layoutViewClass = estrada.$createNodeClassName(node);
					var className = noneFlag + (layoutViewClass & layoutViewClass.length > 0 ? " " + layoutViewClass : "")
					return " class=\"" + className + "\"";
				
				}
				function setFlag(id) {
					var box = document.getElementById(boxId);
					if (box) {
						var flag = box.className;
						var idFlag = "l-" + id;
						if (flag != bothFlag && flag != idFlag) {
							if (flag ==  noneFlag) {
								box.className = idFlag;
							} 
							else {
								box.className = bothFlag;
							}
						}
					}
				}
			},
			link: function(flags) {
				foreach(oneFlags, function(flag) {
					flags.push(flag);
				});
				foreach(twoFlags, function(flag) {
					flags.push(flag);
				});
			}
		}
	}
}

/* common iterator functions */

	function first(col) {
		if (col) {
			if (col.length) {
				return col.length > 0 && col[0];
			}
			else {
				var child = col.firstChild;
				while(child) {
					if (child.nodeType == 1) {
						return child;
					}
					child = child.nextSibling;
				}
			}
		}
		return null;
	}
	
	function map(col, func) {
		var result = [];
		if (col) {
			if (!func) {
				func = function(item) {
					return item;
				}
			}
			var length = col.length;
			if (length) {
				for(var i = 0; i < length; i++) {
					result.push(func(col[i], i, col));
				}
			}
			else {
				var child = col.firstChild;
				var i = 0;
				while(child) {
					if (child.nodeType == 1) {
						result.push(func(child, i, col));
					}
					child = child.nextSibling;
					i++;
				}
			}
		}
		return result;
	}
	
	function filter(col, func) {
		var result = [];
		if (col) {
			var length = col.length;
			if (length) {
				if (!func) {
					func = function() {
						return true;
					}
				}
				for(var i = 0; i < length; i++) {
					var item = col[i];
					if (func(item, i, col)) {
						result.push(item);
					}
				}
			}
			else {
				var child = col.firstChild;
				var i = 0;
				while(child) {
					if (child.nodeType == 1 && func(child, i, col)) {
						result.push(child);
					}
					child = child.nextSibling;
					i++;
				}
			}
		}
		return result;
	}
	
	function foreach(col, func) {
		if (col) {
			var length = col.length;
			if (length) {
				for(var i = 0; i < length; i++) {
					if (func(col[i], i, col)) {
						return true;
					}
				}
			}
			else {
				var child = col.firstChild;
				var i = 0;
				while(child) {
					if (child.nodeType == 1) {
						i++;
						if (func(child, i, col)) {
							return true;
						}
					}
					child = child.nextSibling;
				}
			}
		}
	}
	
	function rationalize(col) {
		if (col) {
			if (col.nodeType)
			{
				return col;
			}
			var hasValues;
			if (col.length > 0) {
				foreach(col, function(item) {
					if (item) {
						hasValues = true;
						return true;
					}
				});
				if (hasValues) {
					return col;
				}
			}
		}
	}


window.tilt = new function()
{
	var safari = document.childNodes && !document.all && !navigator.taintEnabled;
	var head = document.getElementsByTagName ? document.getElementsByTagName("head")[0] : null;
	var layoutHandlers = [];
	var beforeLayoutHandlers = [];
	var layoutErrorHandlers = [];
	
	var scriptBase = function() {
		var scripts = head.getElementsByTagName("script");
		for(var i = 0; i < scripts.length; i++)
		{
			var src = scripts[i].src;
			if (src && src.indexOf("tilt.js") >= 0)
			{
				return src.replace(/tilt\.js/, "");
			}
		}
		return "";
	}();
	
	var linkBase = function() {
		var links = scriptBase + "../styles/";
		return links;
	}();

	setHeadClassName("l-before-layout");
	
	this.attachEvent = function()
	{
		if (window.attachEvent)
		{
			return function(element, name, handler)
			{
				if (!attachLayoutHandlers(element, name, handler))
				{
					element.attachEvent("on" + name, function()
					{
						if (!handler(event.srcElement, event))
						{
							event.returnValue = false;
							event.cancelBubble = true;
						}
					});
				}
			}
		}
		if (window.addEventListener)
		{
			return function(element, name, handler)
			{
				if (!attachLayoutHandlers(element, name, handler))
				{
				    if (safari && name == "click" && element.nodeName == "A") {
				        element.onclick = function(e) {
							var target = e.target;
							if (target.nodeType == 3) target = target.parentNode;
				            return handler(target, e);
				        };
				    } else {
				    element.addEventListener(name, function(e)
				    {
						var target = e.target;
						if (target.nodeType == 3) target = target.parentNode;
					    if (!handler(target, e))
					    {
						    e.stopPropagation();
						    e.preventDefault();
					    }
				    }, false);
				    }
				}
			}
		}
		if (document.getElementById) // IE Mac
		{
			return function(element, name, handler)
			{
				if (!attachLayoutHandlers(element, name, handler))
				{
					var handlerName = "on" + name;
					var oldHandler = element[handlerName];
					if (oldHandler)
					{
						element[handlerName] = function()
						{
							return oldHandler(element) && handler(element);
						}
					}
					else
					{
						element[handlerName] = function()
						{
							return handler(element);
						}
					}
				}
			}
		}
		return function(){};
		
		function attachLayoutHandlers(element, name, handler)
		{
			if (element === document) {
				if (name == "contentreceived" || name == "layout" || name == "DOMContentLoaded") {
					layoutHandlers[layoutHandlers.length] = handler;
					return true;
				} 
				if (name == "beforelayout") {
					beforeLayoutHandlers[beforeLayoutHandlers.length] = handler;
					return true;
				}
				if (name == "layouterror") {
					layoutErrorHandlers[layoutErrorHandlers.length] = handler;
				}
			}
		}
	}();
	
	if (document.addEventListener && !safari) {
		document.addEventListener("DOMContentLoaded", fireFire, false);
	} else {
		// Dean Edwards (http://dean.edwards.name/)
		/*@cc_on @*/
		/*@if (@_win32)
			document.write("<script id=__ie_onload defer src=//:><\/script>");
			var script = document.getElementById("__ie_onload");
			script.onreadystatechange = function() {
				if (this.readyState == "complete") {
					fireFire();
				}
			}
		/*@end @*/
		//this.attachEvent(window, "load", fireFire);
	}

	wait(30000, 100);

	this.detachEvent = function()
	{
		if (window.detachEvent)
		{
			return function(element, name, handler)
			{
				if (!detachOnContentReceived(element, name, handler))
				{
					element.detachEvent("on" + name, handler);
				}
			}
		}
		if (window.removeEventlistener) {
			return function(element, name, handler) {
				if (!detachOnContentReceived(element, name, handler)) {
					element.removeEventListener(name, handler, false);
				}
			}
		}
		return function(){};
		
		function detachOnContentReceived(element, name, handler)
		{
			if (name == "contentreceived" && element === document)
			{
				for(var i = 0; i < this.layoutHandlers.length; i++)
				{
					if (this.layoutHandlers[i] === handler)
					{
						this.layoutHandlers.splice(i, 1);
					}
				}
			}
		}
	}();
	
	this.createTable = function(content, className)
	{
		var table = document.createElement("TABLE");
		table.className = "Layout " + (className != null ? className : "");
		table.cellSpacing = 0;
		var tbody = table.appendChild(document.createElement("TBODY"));

		var colCount = 0;
		var needsColspans;
		for(contentMember in content)
		{
			var rowInfo = content[contentMember];
			if (rowInfo)
			{
				var row = tbody.appendChild(document.createElement("TR"));
				row.className = contentMember;
				var runningColCount = 0;
				if (isContent(rowInfo))
				{
					var cell = row.appendChild(document.createElement("TD"));
					appendContent(cell, rowInfo);
					runningColCount++;
				}
				else
				{
					for(rowInfoMember in rowInfo)
					{
						var cellInfo = rowInfo[rowInfoMember];
						if (!isEmpty(cellInfo))
						{
							var cell = row.appendChild(document.createElement("TD"));
							cell.className = rowInfoMember;
							appendContent(cell, cellInfo);
							runningColCount++;
						}
					}
				}
				if (runningColCount != colCount)
				{
					if (colCount > 0)
					{
						needsColspans = true;
					}
					if (runningColCount > colCount)
					{
						colCount = runningColCount;
					}
				}
			}
		}
		if (needsColspans)
		{
			var rows = tbody.rows;
			var emptyRows = [];
			for(var rowIndex = 0; rowIndex < rows.length; rowIndex++)
			{
				var row = rows[rowIndex];
				var cells = row.cells.length == 0 && row.children ? row.children : row.cells;
				if (cells.length == 0)
				{
					emptyRows[emptyRows.length] = row;
				}
				else
				{
					var colSpan = colCount - cells.length + 1;
					if (colSpan > 1)
					{
						cells[cells.length - 1].colSpan = colSpan;
					}
				}
			}
			for(var emptyRowIndex = 0; emptyRowIndex < emptyRows.length; emptyRowIndex++)
			{
				var row = emptyRows[emptyRowIndex];
				row.parentNode.removeChild(row);
			}
		}
		return table;
	}
	
	this.createDiv = function(content, className)
	{
		if (content) {
			var div = document.createElement("div");
			div.className = className;
			appendContent(div, content);
			return div;
		}
	}

	function fireFire()
	{
		if (!tilt.__fired) {
			tilt.__fired = true;
			var hasErrors;
			var errors = [];
			for(var i = 0; i < beforeLayoutHandlers.length; i++) {
				try {
					beforeLayoutHandlers[i]();
				}
				catch(e) {
					hasErrors = true;
					errors.push(e);
				}
			}
			setHeadClassName("l-layout");
			for(var i = 0; i < layoutHandlers.length; i++)
			{
				try
				{
					layoutHandlers[i]();
				}
				catch(e)
				{
					hasErrors = true;
					errors.push(e);
				}
			}
			if (hasErrors && layoutErrorHandlers.length > 0) {
				for(var i = 0; i < layoutErrorHandlers.length; i++) {
					try {
						layoutErrorHandlers[i](errors);
					}
					catch(e) {
					}
				}
			}
			setHeadClassName("l-layout-complete");
		}
	}
	

	function wait(timeout, delta) {
		if (window.webroot != "yes") {
			var interval = window.setInterval(function() {
				if (tilt.__fired) {
					window.clearInterval(interval);
					// John Resig via Dean Edwards (http://dean.edwards.name/)
				} else if ((safari && /loaded|complete/.test(document.readyState))||timeout < 0) {
					window.setTimeout(fireFire, 0);
				}
				timeout -= delta;
				
			}, delta);
		}
	}
	
	function setHeadClassName(className) {
		document.getElementsByTagName("html")[0].className = className;
	}
	
	function isEmpty(obj)
	{
		if (obj)
		{
			if (isInstanceOf(obj, Array))
			{
				for(var i = 0; i < obj.length; i++)
				{
					if (obj[i])
					{
						return false;
					}
				}
				return true;
			}
			return false;
		}
		return true;
	}
		
	function isInstanceOf(obj, type)
	{
		return obj.constructor === type;
	}
	
	function isContent(data)
	{
		return isInstanceOf(data,Array) || typeof(data) == "string" || data.nodeName;
	}
	
	function appendContent(node, content)
	{
		if (content)
		{
			var contentType = typeof(content);
			if (contentType == "string")
			{
				node.appendChild(document.createTextNode(content));	
			}
			else if (isInstanceOf(content, Array))
			{
				for(var i = 0; i < content.length; i++)
				{
					appendContent(node, content[i]);
				}
			}
			else if (content.nodeName)
			{
				node.appendChild(content);
			}
		}
	}

	this.createClassNameBag = function(node)
	{
		return new function(node)
		{
			var child = node.firstChild;
			while(child)
			{
				if (child.nodeType == 1 && child.className && child.className.length > 0)
				{
					var classNames = child.className.split(" ");
					for(var i = 0; i < classNames.length; i++)
					{
						var className = classNames[i];
						if (this[className])
						{
							var singleValue = this[className];
							var array = [singleValue,child];
							this[className] = array;
						}
						else
						{
							this[className] = child;				
						}
					}
				}
				child = child.nextSibling;
			}
		}(node);
	};
	
	this.addScript =  safari ? function(script) {
		if (script && head) {
			var e = document.createElement("script");
			e.type = "text/javascript";
			e.src = scriptBase + script;
			head.appendChild(e);
		}
	}: function(script) {
		if (script && head) {
			var e = head.appendChild(document.createElement("script"));
			e.type = "text/javascript";
			e.src = scriptBase + script;
		}
	}
	
	this.addLink =  safari ? function(link) {
		if (link && head) {
			var e = document.createElement("link");
			e.type = "text/css";
			e.rel = "stylesheet";
			e.href = linkBase + link;
			head.appendChild(e);
		}
	}: function(link) {
		if (link && head) {
			var e = head.appendChild(document.createElement("link"));
			e.type = "text/css";
			e.rel = "stylesheet";
			e.href = linkBase + link;
		}
	}
}

for(var name in tilt) {
	estrada[name] = tilt[name];
}

window.flashManager = new function() {

	this.flashReplacement = function() {
		foreach(map(document.getElementsByTagName("img")), function(img) {
			var oSrc = img.src;
			if (oSrc && oSrc.indexOf(".swf.") > 0) {
				replaceWithFlash(img);
			}
		});	
	}

	function replaceWithFlash(img) {
		var width = img.currentStyle ? img.currentStyle.width.replace(/px/, "") : img.width;			
		var height = img.currentStyle ? img.currentStyle.height.replace(/px/, "") : img.height;
		var src = img.src;
		if (width && height && src) {
			var movie = src.replace(/\.swf\..+/, ".swf");
			var version = 4;
			var useNetscapePlugins = navigator.plugins && navigator.mimeTypes.length;
			if (detectFlash())
			{
				var child = img;
				var oParent = img.parentNode;
				if (oParent.nodeName.toUpperCase() == "A") {
					child = oParent;
					oParent = oParent.parentNode;
				}
				var classname = child.className;
				var flashDiv = document.createElement("div");
				flashDiv.className = classname;
				flashDiv.innerHTML = createMovieHtml();
				oParent.replaceChild(flashDiv, child);
			}
			
		}

		function createMovieHtml()
		{
			var sizeAttributes = "width=\"" + width + "\" height=\"" + height + "\"";
			return useNetscapePlugins ?
				"<embed type=\"application/x-shockwave-flash\" src=\"" + movie + "\" " + sizeAttributes + "></embed>"
				:
				"<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" " + sizeAttributes + "><param name=\"movie\" value=\"" + movie + "\" /></object>";
		}
		
		function detectFlash()
		{
			return getFlashVersion() >= version;

			function getFlashVersion()
			{
				if (useNetscapePlugins)
				{
					var plugin = navigator.plugins["Shockwave Flash"];
					if(plugin && plugin.description)
					{
						var description = plugin.description;
						return description.charAt(description.indexOf('.')-1);
					}
				} 
				else
				{
					var version = 0;
					for(var i = 4; i >= 3; i--)
					{
						var testObject;
						try
						{
							testObject = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." +  i);
						}
						catch(e)
						{
							continue;
						}
						return i;
					}
				}
				return 0;
			}
		}
	}
}