



	var MSIE  = false;
	var MSI6  = false;
	var DOM2  = false;
	var CSS1  = false;

	var tmplURL = 'fileadmin/templates/';
	var mdfyURL = '';

	/* -------------------------------------------------------------------------------------- */
	if (navigator.appName.substr(0,9) == 'Microsoft')
		MSIE = true;
	else if (navigator.appName.substr(0,8) == 'Netscape')
		DOM2 = true;
	if (document.compatMode == 'CSS1Compat')
		CSS1 = true;
	if (!(typeof document.addEventListener != 'function' && window.XMLHttpRequest))
		MSI6 = MSIE && true;

	if (!Array.indexOf) {
	    Array.prototype.indexOf = function(obj) {
	        for (var i = 0; i < this.length; i++)
	            if (this[i] == obj)
	                return i;

	        return -1;
	    }
	}

	function setFontSize(size) {
		document.body.style.fontSize = '' + size + 'px';
		setCookieValue('fontsize', size);
	}

	function getFontSize() {
		if ((size = getCookieValue('fontsize', null)))
		document.body.style.fontSize = '' + size + 'px';
	}

	function getPosition(elm, rel) {
		var left = 0;
		var top  = 0;

		while (elm && (elm.id != rel)) {
			left += elm.offsetLeft;
			top  += elm.offsetTop;

			elm = elm.parentNode;
		}

		return [left, top];
	}

	function getPrevTag(sibling, tag) {
		var prev = sibling;

		while (prev = prev.previousSibling) {
			if (prev.tagName && (prev.tagName.toLowerCase() == tag))
				break;
		}

		return prev;
	}

	function getNextTag(sibling, tag) {
		var prev = sibling;

		while (prev = prev.nextSibling) {
			if (prev.tagName && (prev.tagName.toLowerCase() == tag))
				break;
		}

		return prev;
	}

	/* ------------------------------------------------------------------ */

	function addEvent(obj, evt, fnc) {
		if (typeof obj.addEventListener != 'undefined')
			obj.addEventListener(evt, fnc, false);
		else if (typeof obj.attachEvent != 'undefined') {
			obj.attachEvent('on' + evt, fnc);
		}
		else {
			if (obj[evt] != null) {
				var oldEvt = obj[evt];
				obj[evt] = function (e) {
					oldEvt(e);
					obj[fnc]();
				};
			}
			else
				obj[evt] = fnc;
		}
	}

	function subEvent(obj, evt, fnc) {
		if (typeof obj.removeEventListener != 'undefined')
			obj.removeEventListener(evt, fnc, false);
		else if (typeof obj.detachEvent != 'undefined') {
			obj.detachEvent('on' + evt, fnc);
		}
		else {
			if (obj[evt] != null) {
				obj[evt] = null;
			}
		}
	}

	/* ------------------------------------------------------------------ */
	function shuffleParent() {
		var here = document.getElementsByTagName('script');
		var node = here[here.length - 1].parentNode;
		var actl = node.firstChild;
		var list = [];

		while (actl) {
			var next = actl.nextSibling;
			if (actl.tagName && (actl.tagName.toLowerCase() != 'script')) {
				actl.parentNode.removeChild(actl);
				list.push(actl);
			}
			actl = next;
		}

		for(var j, x, i = list.length; i; j = parseInt(Math.random() * i), x = list[--i], list[i] = list[j], list[j] = x);
	//	list.sort(function() {return 0.5 - Math.random();});

		while ((actl = list.pop()))
			node.appendChild(actl);
	}

	/* ------------------------------------------------------------------ */

	function assignNavAction(elm, func, start, repeat) {
		elm.onmouseover = function() {
			elm.ts = new Date(); clearTimeout(elm.trigger); clearTimeout(elm.timer); elm.stopped = false; elm.abort = false; elm.trigger = setTimeout(elm.onenter, start); return false; };
		elm.onmouseout = function() {
			elm.ts = new Date(); clearTimeout(elm.trigger); clearTimeout(elm.timer); elm.stopped =  true; elm.abort =  true; return false; };
		elm.onclick = function() {
			elm.mn = new Date(); clearTimeout(elm.trigger); clearTimeout(elm.timer); elm.stopped =  true; elm.abort = false; elm.action(); elm.abort = true; return false; };
		elm.onenter = function() {
			elm.ts = new Date(); clearTimeout(elm.trigger); clearTimeout(elm.timer); elm.stopped = false; elm.abort = false; elm.action(); elm.timer = setTimeout(elm.action, repeat); return false; };

		elm.action = function() {
			elm.ac = (!elm.stopped ? new Date() : elm.ac);
			elm.qck = Math.abs(elm.mn - elm.ac) < 500;

			clearTimeout(elm.trigger); clearTimeout(elm.timer);

			if (elm.stopped && elm.qck) { return false; }
			if (elm.abort) { return false; }
			if (func() && !elm.stopped) { elm.timer = setTimeout(elm.action, repeat); } else elm.stopped = true;

			return false;
		};
	}

	/* ------------------------------------------------------------------ */

	var colors = [
		[  0,	  0, 127,  46],
		[ 31,	  0,  68, 146],
		[ 65,	176,  11,  27],
		[100,	251, 248,  30],
	];

	function getFromFade(pos) {
		var e = 1;

		while (pos > colors[e][0])
			e++;

		var s = colors[e - 1][0];
		var t = colors[e - 0][0];
		var o = (pos - s) / (t - s);

		var r = Math.floor(0.5 + colors[e - 1][1] + (o * (colors[e - 0][1] - colors[e - 1][1])))
		var g = Math.floor(0.5 + colors[e - 1][2] + (o * (colors[e - 0][2] - colors[e - 1][2])))
		var b = Math.floor(0.5 + colors[e - 1][3] + (o * (colors[e - 0][3] - colors[e - 1][3])))

		var clr = 'rgb(' + r + ',' + g + ',' + b + ')';

		return clr;
	}

	/* dynamic effects ----------------------------------------------------------------------
	 *
	 * Developed by Robert Nyman, http://www.robertnyman.com
	 * Code/licensing: http://code.google.com/p/getelementsbyclassname/
	 */
	var getElementsByClassName = function (className, tag, elm){
		if (elm.getElementsByClassName) {
			getElementsByClassName = function (className, tag, elm) {
				elm = elm || document;
				var elements = elm.getElementsByClassName(className),
					nodeName = (tag)? new RegExp("\\b" + tag + "\\b", "i") : null,
					returnElements = [],
					current;
				for(var i=0, il=elements.length; i<il; i+=1){
					current = elements[i];
					if(!nodeName || nodeName.test(current.nodeName)) {
						returnElements.push(current);
					}
				}
				return returnElements;
			};
		}
		else if (document.evaluate) {
			getElementsByClassName = function (className, tag, elm) {
				tag = tag || "*";
				elm = elm || document;
				var classes = className.split(" "),
					classesToCheck = "",
					xhtmlNamespace = "http://www.w3.org/1999/xhtml",
					namespaceResolver = (document.documentElement.namespaceURI === xhtmlNamespace)? xhtmlNamespace : null,
					returnElements = [],
					elements,
					node;
				for(var j=0, jl=classes.length; j<jl; j+=1){
					classesToCheck += "[contains(concat(' ', @class, ' '), ' " + classes[j] + " ')]";
				}
				try	{
					elements = document.evaluate(".//" + tag + classesToCheck, elm, namespaceResolver, 0, null);
				}
				catch (e) {
					elements = document.evaluate(".//" + tag + classesToCheck, elm, null, 0, null);
				}
				while ((node = elements.iterateNext())) {
					returnElements.push(node);
				}
				return returnElements;
			};
		}
		else {
			getElementsByClassName = function (className, tag, elm) {
				tag = tag || "*";
				elm = elm || document;
				var classes = className.split(" "),
					classesToCheck = [],
					elements = (tag === "*" && elm.all)? elm.all : elm.getElementsByTagName(tag),
					current,
					returnElements = [],
					match;
				for(var k=0, kl=classes.length; k<kl; k+=1){
					classesToCheck.push(new RegExp("(^|\\s)" + classes[k] + "(\\s|$)"));
				}
				for(var l=0, ll=elements.length; l<ll; l+=1){
					current = elements[l];
					match = false;
					for(var m=0, ml=classesToCheck.length; m<ml; m+=1){
						match = classesToCheck[m].test(current.className);
						if (!match) {
							break;
						}
					}
					if (match) {
						returnElements.push(current);
					}
				}
				return returnElements;
			};
		}

		return getElementsByClassName(className, tag, elm);
	};

	/* trigger it all  ----------------------------------------------------------------------- */
	function makeSlides(elm, typ, tag) {
		var blcks = getElementsByClassName('fce-slide', 'div', elm);
		var queue = [];
		var w = 9999,
		    h = 9999,
		    oh = 0;

//		if (blcks.length <= 1)
//			return;

		/* defaults */
		tag = tag ? tag : 'img';
		typ = typ ? typ : 'leftright';

		/* determine rectangle */
		for (var b = 0; b < blcks.length; b++) {
			var slids = blcks[b].getElementsByTagName(tag);

			if (blcks[b].previousSibling && (blcks[b].previousSibling.nodeType == 3))
				blcks[b].parentNode.removeChild(blcks[b].previousSibling);
			if (blcks[b].nextSibling && (blcks[b].nextSibling.nodeType == 3))
				blcks[b].parentNode.removeChild(blcks[b].nextSibling);

			for (var s = 0; s < slids.length; s++) {
				/* only first level */
				if (slids[s].parentNode == blcks[b]) {
					slids[s].blk = blcks[b];

					if (slids[s].offsetWidth)
					  w = Math.min(slids[s].offsetWidth, w);
					else if (slids[s].width)
					  w = Math.min(slids[s].width, w);
					else if (slids[s].style.width)
					  w = Math.min(parseInt(slids[s].style.width), w);

					if (slids[s].offsetHeight)
					  h = Math.min(slids[s].offsetHeight, h);
					else if (slids[s].height)
					  h = Math.min(slids[s].height, h);
					else if (slids[s].style.height)
					  h = Math.min(parseInt(slids[s].style.height), h);

					slids[s].style.zIndex = (b < 2 ? b + 1 : 0);
					slids[s].style.display = (b < 2 ? 'block' : 'none');
					slids[s].style.opacity = (b ? '0.0' : '1.0');
					slids[s].style.filter = 'Alpha(opacity=' + (b ? '0' : '100') + ')';

					slids[s].rel = getNextTag(slids[s], 'div');
					slids[s].rel.onmouseover = function() { elm.stop = true; };
					slids[s].rel.onmouseout = function() { elm.stop = false; };

					if (typ == 'leftright') {
						slids[s].rel.style.marginBottom = (b ? (13 + ( 50 * Math.random())) + 'px' : '');
						slids[s].rel.style.marginLeft   = (b ? (13 + (150 * Math.random())) + 'px' : '');

						var h2 = slids[s].rel.getElementsByTagName('h2')[0];
						var div = getNextTag(h2, 'div');
						h2.style.height = (oh ? oh : oh = h2.offsetHeight) + 'px';
						h2.style.position = 'absolute';
						h2.style.top = '-1px';
						h2.style.cursor = 'pointer';
						h2.onclick = function() { clearTimeout(elm.running); animSlideLR(); }
						h2.title = 'Acess more information';
						div.style.paddingTop = (oh - 1) + 'px';
					//	div.style.visibility = 'hidden';

						slids[s].sub = div;
					}

					queue.push(slids[s]);
				}
			}
		}

		if (((w == 9999) || (h == 9999)) && (tag == 'img'))
			return;
		if ((w == 0) || (h == 0))
			w = 400, h = 300;
		    
		/* ---------------------------------------------------------- */
		var initSlideLR = function(img, s) {
			elm.loadq += img.complete ? 1 : 0;
			img.onload = function() { elm.loadq++ }

			return img;
		}

		var animSlideLR = function() {
			var queue = elm.queue;
			var s;
			var l = queue[0]; var ll = l.rel;
			var r = queue[1]; var rr = r.rel;
			var aq, q = 1.0 - parseFloat(r.style.opacity); q = q - (0.01 + (aq = 0.07 * Math.sin(3.14 * q))); /*l.style.opacity = q; l.style.filter = 'Alpha(opacity=' + parseInt(q * 100) + ')';*/
			var ao, o =       parseFloat(r.style.opacity); o = o + (0.01 + (ao = 0.07 * Math.sin(3.14 * o)));   r.style.opacity = o; r.style.filter = 'Alpha(opacity=' + parseInt(o * 100) + ')';
			var qq = (q * w); ll.style.left = (2.0 * (qq - w)) + 'px'; // ll.innerHTML = aq;
			var oo = (o * w); rr.style.left = (2.0 * (w - oo)) + 'px'; // rr.innerHTML = ao;

			l.sub.style.visibility = 'hidden';
			r.sub.style.visibility = 'hidden';

			if ((q > 0.0) &&
			    (o < 1.0))
				elm.running = setTimeout(animSlideLR, 100);
			else {
				l.style.opacity = '0.0'; l.style.filter = 'Alpha(opacity=0)';
				r.style.opacity = '1.0'; r.style.filter = 'Alpha(opacity=100)';
				ll.style.left = (2.0 * w) + 'px';
				rr.style.left = (2.0 * 0) + 'px';
				ll.style.marginBottom = (13 + ( 50 * Math.random())) + 'px';
				ll.style.marginLeft   = (13 + (150 * Math.random())) + 'px';

				r.sub.style.visibility = 'visible';

				l = queue.shift(); queue.push(l);
				for (s = 0; s < queue.length; s++) {
					queue[s].style.zIndex = (s < 2 ? s + 1 : 0);
					queue[s].style.display = (s < 2 ? 'block' : 'none');
				}

				rr = (ll = l.parentNode).parentNode;
				rr.removeChild(ll);
				rr.appendChild(ll, rr.firstChild);

				elm.running = setTimeout(animContLR, 0);
			}
		}

		var animPauseLR = function() {
			if (elm.stop || !elm.queue[1].complete)
				elm.running = setTimeout(animPauseLR, 100);
			else
				elm.running = setTimeout(animSlideLR, 100);
		}

		var animContLR = function() {
			elm.running = setTimeout(animPauseLR, 2000 + parseInt(Math.floor(3000 * Math.random())));
		}

		if (typ == 'leftright') {
			if (blcks.length <= 1)
				return;

			elm.queue = queue;
			elm.loadq = 0;
			elm.style.backgroundImage = 'none';
			elm.style.width  = w + 'px';
			elm.style.height = h + 'px';
			for (var b = 0; b < blcks.length; b++) {
				blcks[b].style.width  = w + 'px';
				blcks[b].style.height = h + 'px';
				blcks[b].className = blcks[b].className + ' valid';
			}

			/* center pictures in the rectangle */
			for (var s = 0; s < queue.length; s++) {
				queue[s] = initSlideLR(queue[s], s);

			//	queue[s].style.left = ((w - queue[s].offsetWidth ) >> 1) + 'px';
			//	queue[s].style.top  = ((h - queue[s].offsetHeight) >> 1) + 'px';
				queue[s].rel.style.top = 'auto';
				queue[s].rel.style.height = 'auto';
				queue[s].rel.style.bottom = (0) + 'px';
				queue[s].rel.style.left = (s ? w : 0) + 'px';
			}

			elm.running = setTimeout(animContLR, 0);
		}

		/* ---------------------------------------------------------- */
		var initMoveDI = function(spn, s) {
			var img = document.createElement('img');
			var cnt = spn.parentNode;

			img.onload = function() { elm.loadq++ }
		//	img.src = spn.style.backgroundImage.split('"')[1];
			img.src = spn.style.backgroundImage.match(/url\(\"?([^\"]*)\"?\)/)[1];
			img.rel = spn.rel;
			img.style.position = 'absolute';
			img.style.zIndex  = spn.style.zIndex ;
			img.style.display = spn.style.display;
			img.style.opacity = spn.style.opacity;
			img.style.filter  = spn.style.filter ;

			cnt.insertBefore(img, spn);
			cnt.removeChild(spn);
		//	spn.appendChild(img, spn);

			var rest = function(elm, dir) {
				switch (dir) {
					default:
					case 't': elm.style.bottom = ''; elm.style.top    = '0px'; break;
					case 'l': elm.style.right  = ''; elm.style.left   = '0px'; break;
					case 'b': elm.style.top    = ''; elm.style.bottom = '0px'; break;
					case 'r': elm.style.left   = ''; elm.style.right  = '0px'; break;
				}
			}

			if (s && (Math.random() > 0.5)) img.dirX = 'r'; else img.dirX = 'l';
			if (s && (Math.random() > 0.5)) img.dirY = 'b'; else img.dirY = 't';

			rest(img, img.dirX);
			rest(img, img.dirY);

			return img;
		}

		var clearMoveDI = function() {
			var rest = function(elm, dir) {
				switch (dir) {
					default:
					case 't': elm.style.bottom = ''; elm.style.top    = '0px'; break;
					case 'l': elm.style.right  = ''; elm.style.left   = '0px'; break;
					case 'b': elm.style.top    = ''; elm.style.bottom = '0px'; break;
					case 'r': elm.style.left   = ''; elm.style.right  = '0px'; break;
				}
			}

			var queue = elm.queue;
			var s;
			var u = queue[0]; var uu = u.rel;
			var d = queue[1]; var dd = d.rel;

			if (Math.random() > 0.5) {
				if (u.dirX == 'l') d.dirX = 'r'; else d.dirX = 'l'; d.dirY = u.dirY; }
			else {
				if (u.dirY == 't') d.dirY = 'b'; else d.dirY = 't'; d.dirX = u.dirX; }

		//	rest(u, u.dirX);
		//	rest(u, u.dirY);
			rest(d, d.dirX);
			rest(d, d.dirY);
		}

		var animMoveDI = function() {
			var move = function(elm, dir) {
				switch (dir) {
					default:
					case 't': var t = parseInt(elm.style.top   ); if (t > -100) elm.style.top    = (t - 1) + 'px'; break;
					case 'l': var l = parseInt(elm.style.left  ); if (l > -100) elm.style.left   = (l - 1) + 'px'; break;
					case 'b': var b = parseInt(elm.style.bottom); if (b > -100) elm.style.bottom = (b - 1) + 'px'; break;
					case 'r': var r = parseInt(elm.style.right ); if (r > -100) elm.style.right  = (r - 1) + 'px'; break;
				}
			}

			var queue = elm.queue;
			var s;
			var u = queue[0]; var uu = u.rel;
			var d = queue[1]; var dd = d.rel;

			/* wait for images to load */
		//	if (!d.complete)
		//		return;
			if (elm.lastChild.className == 'progress')
				elm.removeChild(elm.lastChild);

			move(u, u.dirX);
			move(u, u.dirY);
			move(d, d.dirX);
			move(d, d.dirY);
		}

		var initSlideDI = function() {
			var queue = elm.queue;
			var s;
		//	var u = queue[1]; var uu = u.rel;
			var d = queue[0]; var dd = d.rel;

		//	var aq, q = 1.0 - (parseFloat(uu.style.top) + h - 30) / h; q = q - (0.01 + (aq = 0.07 * Math.sin(3.14 * q)));
			var ao, o =       (parseFloat(dd.style.top) + h - 30) / h; o = o + (0.01 + (ao = 0.07 * Math.sin(3.14 * o)));
		//	var qq = (q * h); uu.style.top = ( 1.0 * (qq - h) + 30) + 'px'; // uu.innerHTML = aq;
			var oo = (o * h); dd.style.top = (-1.0 * (h - oo) + 30) + 'px'; // dd.innerHTML = ao;

			if (/*(q > 0.0) &&*/
			    (o < 1.0))
				elm.running = setTimeout(initSlideDI, 100);
			else {
		//		uu.style.top = ( 1.0 * h + 30) + 'px';
				dd.style.top = (-1.0 * 0 + 30) + 'px';

				elm.running = setTimeout(animContDI, 0);
			}
		}

		var animSlideDI = function() {
			var queue = elm.queue;
			var s;
			var u = queue[0]; var uu = u.rel;
			var d = queue[1]; var dd = d.rel;

			var aq, q = 1.0 - parseFloat(d.style.opacity); q = q - (0.01 + (aq = 0.07 * Math.sin(3.14 * q))); /*u.style.opacity = q; u.style.filter = 'Alpha(opacity=' + parseInt(q * 100) + ')';*/
			var ao, o =       parseFloat(d.style.opacity); o = o + (0.01 + (ao = 0.07 * Math.sin(3.14 * o)));   d.style.opacity = o; d.style.filter = 'Alpha(opacity=' + parseInt(o * 100) + ')';
			var qq = (q * h); uu.style.top = ( 1.0 * (qq - h) + 30) + 'px'; // uu.innerHTML = aq;
			var oo = (o * h); dd.style.top = (-1.0 * (h - oo) + 30) + 'px'; // dd.innerHTML = ao;

			if ((q > 0.0) &&
			    (o < 1.0))
				elm.running = setTimeout(animSlideDI, 100);
			else {
				u.style.opacity = '0.0'; u.style.filter = 'Alpha(opacity=0)';
				d.style.opacity = '1.0'; d.style.filter = 'Alpha(opacity=100)';
				uu.style.top = ( 1.0 * h + 30) + 'px';
				dd.style.top = (-1.0 * 0 + 30) + 'px';

				u = queue.shift(); queue.push(u);
				for (s = 0; s < queue.length; s++) {
					queue[s].style.zIndex = (s < 2 ? s + 1 : 0);
					queue[s].style.display = (s < 2 ? 'block' : 'none');
				}

				dd = (uu = u.parentNode).parentNode;
				dd.removeChild(uu);
				dd.appendChild(uu, dd.firstChild);

				elm.running = setTimeout(animContDI, 0);
			}
		}

		var animPauseDI = function() {
			/*clearInterval(elm.movings);*/ clearMoveDI();

			if (elm.stop || !elm.queue[1].complete)
				elm.running = setTimeout(animPauseDI, 100);
			else
				elm.running = setTimeout(animSlideDI, 100);
		}

		var animContDI = function() {
			var time = 4000 + parseInt(Math.floor(1000 * Math.random()));

			clearInterval(elm.movings);
			clearTimeout(elm.running);

			elm.movings = setInterval(animMoveDI, time / 25);
			elm.running = setTimeout(animPauseDI, time);
		}

		if (typ == 'dropin') {
			if (blcks.length <= 1)
				return;

			elm.queue = queue;
			elm.loadq = 0;
			elm.style.backgroundImage = 'none';
			elm.style.width  = 'auto';//'100%';
			elm.style.height = h + 'px';
			for (var b = 0; b < blcks.length; b++) {
				blcks[b].style.width  = 'auto';//'100%';
				blcks[b].style.height = h + 'px';
				blcks[b].className = blcks[b].className + ' valid';
			}

			/* center pictures in the rectangle */
			for (var s = 0; s < queue.length; s++) {
				queue[s] = initMoveDI(queue[s], s);

			//	queue[s].style.left = ((w - queue[s].offsetWidth ) >> 1) + 'px';
			//	queue[s].style.top  = ((h - queue[s].offsetHeight) >> 1) + 'px';
				queue[s].rel.style.top = (-0.5 * h + 30) + 'px';
				queue[s].rel.style.height = 'auto';
				queue[s].rel.style.bottom = 'auto';
				queue[s].rel.style.left = (MSIE ? '-3px' : '-1px');
			}

			elm.movings = setInterval(animMoveDI, 160);
			elm.running = setTimeout(initSlideDI, 0);
		}

		/* ---------------------------------------------------------- */
		var initAppearVI = function(spn, r) {
			var inr = document.createElement('div');
			var img = document.createElement('img');
			var cnt = spn.blk, chd;
			if (!cnt)
				return null;

			img.onload = function() { elm.loadq++; elm.lastChild.innerHTML = Math.floor(100 * elm.loadq / elm.queue.length) + '%'; }
		//	img.src = spn.style.backgroundImage.split('"')[1];
			img.src = spn.style.backgroundImage.match(/url\(\"?([^\"]*)\"?\)/)[1];

			while ((chd = cnt.firstChild)) {
				cnt.removeChild(chd);
				inr.appendChild(chd);
			}

			cnt.appendChild(inr);
			inr.rel = spn;
			inr.blk = spn.blk;

			spn.style.opacity = 0.0;
			spn.style.filter = 'Alpha(opacity=0)';

			/* IE: if element not absolute positioned it blends with white instead of transparent */
			if (MSIE) {
				inr.style.position = 'relative';
				spn.style.position = 'absolute';
				spn.style.top = '18px';
				spn.style.left = '2px';
				spn.style.bottom = '8px';
				spn.style.right = '2px';

		//		/* trying compositing */
		//	//	spn.rndsrc = spn.style.backgroundImage.split('"')[1];
		//		spn.rndsrc = spn.style.backgroundImage.match(/url\(\"?([^\"]*)\"?\)/)[1];
                //
		//		spn.revert = function(spn) {
		//			spn.style.filter = '';
                //
		//			spn.style.backgroundColor = 'transparent';
		//			spn.style.backgroundImage = 'url(' + spn.rndsrc + ')';
		//		};
                //
		//		spn.render = function(spn) {
		//			spn.style.filter =
		//				'progid:DXImageTransform.Microsoft.Compositor(Function=4) ' +
		//				'progid:DXImageTransform.Microsoft.Alpha(Opacity=' + Math.floor(0.5 + 100 * parseFloat(spn.style.opacity)) + ')';
                //
		//			var flt = spn.filters.item('DXImageTransform.Microsoft.Compositor');
                //
		//			spn.style.backgroundColor = 'transparent';
		//			spn.style.backgroundImage = 'url(' + spn.rndsrc + ')';
		//			flt.Apply();
		//			spn.style.backgroundImage = 'url(' + tmplURL + 'pics/BGs/diagonal.gif)';
		//			flt.Play();
                //
		//			flt.Function = 6;
		//		};
			}

			spn.rel.style.display = 'none';
			spn.rel.style.opacity = 0.0;
			spn.rel.style.filter = 'Alpha(opacity=0)';

			if (r) {
				spn.rel.style.right = '20px';
				spn.rel.style.left = 'auto';
			}
			else {
				spn.rel.style.left = '20px';
				spn.rel.style.right = 'auto';
			}

			return inr;
		}

		var exitAppearVI = function(dir) {
			if (elm.lastChild.className == 'progress-hidden') {
				elm.lastChild.style.display = 'block';
				elm.lastChild.innerHTML = '<span>' +
					elm.queue.length + ' razones<br />' +
					'para dar kolor<br />' +
					'a su punto<br />' +
					'de venta.</span>';
				elm.lastChild.className = 'backlayer';

				elm.lastChild.style.backgroundPosition = '0 0';
			//	elm.lastChild.style.borderWidth = '21px 51px 8px 51px';
			//	elm.lastChild.style.borderStyle = 'solid';
				elm.lastChild.style.color = 'white';
				elm.lastChild.style.color = 'black';
			//	elm.removeChild(elm.lastChild);
			}

			if ((dir < 0) && (elm.lastChild.className == 'backlayer')) {
				var rnd = Math.floor(Math.random() * elm.queue.length);

				elm.lastChild.style.backgroundImage = elm.queue[rnd].rel.style.backgroundImage;
			//	elm.lastChild.lastChild.style.backgroundColor = elm.queue[rnd].style.backgroundColor;
			}

			function deny() {
				elm.lastChild.style.display = 'block';
				for (var s = 0; s < queue.length; s++) {
					queue[s].id = s + '_' + Math.random();
					queue[s].style.cursor = 'default';
					queue[s].onmouseover = null;
					queue[s].onmouseout  = null;
				//	$(queue[s]).observe('mouseenter', null);
				//	$(queue[s]).observe('mouseleave', null);
				}
			}

			function intermediate() {
				clearInterval(elm.appearing); deny();
				clearTimeout(elm.automatic);
				elm.appearing = setInterval(function() { animAppearVI(dir); }, 16);
			}

			function allow() {
				elm.lastChild.style.display = 'none';
				for (var s = 0; s < queue.length; s++) {
					queue[s].id = s + '_' + Math.random();
					queue[s].style.cursor = 'pointer';
					queue[s].onmouseover = function() { var pos = this.id; animContVI( 1, pos); };
					queue[s].onmouseout  = function() { var pos = this.id; animContVI(-1, pos); };
				//	$(queue[s]).observe('mouseenter', function() { var pos = this.id; animContVI( 1, pos); });
				//	$(queue[s]).observe('mouseleave', function() { var pos = this.id; animContVI(-1, pos); });
				}
			}

			function interactive() {
				clearInterval(elm.appearing); if (dir < 0) allow();
				clearTimeout(elm.automatic);
				elm.automatic = setTimeout(intermediate, (dir < 0 ? 10000 : 1000));

			//	elm.automatic = setTimeout( function() {
			//		var rnd = Math.floor(Math.random() * elm.queue.length);
                        //
			//		animContVI(1, elm.queue[rnd].id);
			//		elm.automatic = setTimeout( function() {
			//			animContVI(-1, elm.queue[rnd].id);
			//		}, 5000);
			//	}, 5000);
			}

			interactive();

			elm.onmouseover = function() { clearTimeout(elm.automatic); };
			elm.onmouseout  = function() { elm.automatic = setTimeout(intermediate, (dir < 0 ? 10000 : 1000)); };
		}

		var animAppearVI = function(dir) {
			var queue = elm.queue;

			/* wait for images to load */
			if (elm.loadq < elm.queue.length)
				return;

			if (elm.lastChild.className == 'progress') {
				elm.lastChild.style.display = 'none';
				elm.lastChild.className = 'progress-hidden';
			//	elm.removeChild(elm.lastChild);
			}

			for (var s = 0; s < queue.length; s++) {
				var u = queue[s];
				var d = u.parentNode;

				var q = parseFloat(d.style.opacity), f;
				var p = parseFloat(u.rel.style.opacity);
				var w = parseFloat(d.style.width) + parseFloat(d.style.marginLeft) + parseFloat(d.style.marginRight);

				if ((dir > 0) && (q == 1.0) && (p == 1.0)) {
					if (s == (queue.length - 1))
						return exitAppearVI(-1);
				}

				if ((dir > 0) && (q >= 1.0)) {
					var o = parseFloat(u.rel.style.opacity);

					d.style.marginLeft  = '0%';		/* IE can't do math */
					d.style.marginRight = '0%';		/* IE can't do math */
					d.style.width       = w + '%';

					if (o < 1.0) {
					//	o = o + (0.01 + (0.07 * Math.sin(3.14 * (o - 0.0))));
						o = o + 0.1;
						o = Math.min(1.0, o);
						o = ((1.0 - o) <= 0.01 ? 1.0 : o);	/* IE can't do math */

						u.rel.style.display = 'block';
						u.rel.style.opacity = o;
						u.rel.style.filter = 'Alpha(opacity=' + Math.floor(0.5 + (100 * o)) + ')';

		//				/* trying compositing */
		//				if (u.rel.render)
		//					u.rel.render(u.rel);

						if (p == 0.0)
							break;

						continue;
					}

					continue;
				}

				if ((dir < 0) && (q == 0.0) && (p == 0.0)) {
					if (s == (queue.length - 1))
						return exitAppearVI(1);
				}

				if ((dir < 0) && (p > 0.0)) {
					var o = parseFloat(u.rel.style.opacity);

					d.style.marginLeft  = '0%';		/* IE can't do math */
					d.style.marginRight = '0%';		/* IE can't do math */
					d.style.width       = w + '%';

					if (o > 0.0) {
					//	o = o - (0.01 + (0.07 * Math.sin(3.14 * (1.0 - o))));
						o = o - 0.1;
						o = Math.max(0.0, o);
						o = ((o - 0.0) <= 0.01 ? 0.0 : o);	/* IE can't do math */

						u.rel.style.display = 'block';
						u.rel.style.opacity = o;
						u.rel.style.filter = 'Alpha(opacity=' + Math.floor(0.5 + (100 * o)) + ')';

		//				/* trying compositing */
		//				if (u.rel.render)
		//					u.rel.render(u.rel);

						if (o >= 0.4)
							break;
						if (p == 1.0)
							break;

						continue;
					}
				}

				if (dir > 0) {
					q = q + 0.1;
					q = ((1.0 - q) <= 0.01 ? 1.0 : q);		/* IE can't do math */

					f = (w - (w * q)) * 0.5;
					f = ((f - 0.0) <= 0.01 ? 0.0 : f);		/* IE can't do math */

					d.style.marginLeft  = f + '%';			/* IE can't do math */
					d.style.marginRight = f + '%';			/* IE can't do math */
					d.style.width       = (w - parseFloat(d.style.marginLeft) - parseFloat(d.style.marginRight)) + '%';
				}

				if (dir < 0) {
					q = q - 0.1;
					q = ((q - 0.0) <= 0.01 ? 0.0 : q);		/* IE can't do math */

					f = (w - (w * q)) * 0.5;
					f = ((f - 0.0) <= 0.01 ? 0.0 : f);		/* IE can't do math */

					d.style.width       = (w - f - f) + '%';
					d.style.marginLeft  = f + '%';			/* IE can't do math */
					d.style.marginRight = f + '%';			/* IE can't do math */
					d.style.width       = (w - parseFloat(d.style.marginLeft) - parseFloat(d.style.marginRight)) + '%';
				}

				d.style.opacity = q;
				d.style.filter = 'Alpha(opacity=' + Math.floor(0.5 + (100 * q)) + ')';

				if ((dir > 0) && (q <= 0.5))
					break;
			//	if ((dir < 0) && (q >= 0.5))
			//		break;
			}
		}

		var animSpreadVI = function(dir, pos) {
			var queue = elm.queue;
			var timer = true;

			function fade() {
				for (var s = 0, timer = true; s < queue.length; s++) {
					var u = queue[s];
					var d = u.parentNode;

					var q = parseFloat(u.rel.style.opacity);

		//			do {
						if ((dir < 0) || (u.id == pos)) {
							if (q >= 1.0)
                                        			continue;
		//						break;

							q = q + 0.05;
							q = Math.min(1.0, q);
							q = ((1.0 - q) <= 0.01 ? 1.0 : q);		/* IE can't do math */

							timer = timer && (q == 1.0);
						}
						else {
							if (q <= 0.0)
                                        			continue;
		//						break;

							q = q - 0.05;
							q = Math.max(0.0, q);
							q = ((q - 0.0) <= 0.01 ? 0.0 : q);		/* IE can't do math */

							timer = timer && (q == 0.0);
						}
		//			} while(0);

					u.rel.style.opacity = q;
					u.rel.style.filter = 'Alpha(opacity=' + Math.floor(0.5 + (100 * q)) + ')';

		//			/* trying compositing */
		//			if ((dir > 0) && (q == 1.0) && (u.id == pos)) {
		//				if (u.rel.revert)
		//					u.rel.revert(u.rel);
		//			}
		//			else {
		//				if (u.rel.render)
		//					u.rel.render(u.rel);
		//			}
				}

				if (!timer) {
					elm.running = setTimeout(function() { animSpreadVI(dir, pos); }, 32);
					return true;
				}
			}

			function slide() {
				for (var s = 0, timer = true; s < queue.length; s++) {
					var u = queue[s];
					var d = u.parentNode;

					var q = parseFloat(d.style.width);
					var o = parseFloat(u.style.paddingLeft);
					var t = (dir > 0 ? (u.id == pos ? 67 : 33 / (queue.length - 1)) : 100 / (queue.length - 0));
					var r = (dir > 0 ? (u.id == pos ? 56 :  2                     ) :   2                     );

					/* TODO: precision problem! doesnt sum up to 100 with roundig! */
					q = (q + t) * 0.5; if (Math.abs(q - t) <= 0.1) q = t;
					o = (o + r) * 0.5; if (Math.abs(o - r) <= 0.1) o = r;

					d.style.width = q + '%';
					u.style.paddingLeft = o + 'px';
					u.style.paddingRight = o + 'px';

					/* IE: if element not absolute positioned it blends with white instead of transparent */
					if (MSIE) {
						u.rel.style.left = o + 'px';
						u.rel.style.right = o + 'px';
					}

					timer = timer && (q == t);

					var position = Element.cumulativeOffset(queue[s]);
					var dimension = document.body.offsetWidth;

					queue[s].style.backgroundPosition =
						'' + (-1238 + ((dimension >> 1) - position[0])) + 'px ' +
						'' + ( -330                     - position[1] ) + 'px';
						/* 330 (from CSS) - 80 (header) */
				}

				if (!timer) {
					elm.running = setTimeout(function() { animSpreadVI(dir, pos); }, 16);
					return true;
				}
			}

			function show(mode) {
				for (var s = 0, timer = true; s < queue.length; s++) {
					var u = queue[s];
					var d = u.parentNode;

					var q = parseFloat(u.rel.rel.style.opacity);

					if (mode == 1) {
						if (u.id == pos) {
							if (q >= 1.0)
								continue;

							q = q + 0.05;
							q = Math.min(1.0, q);
							q = ((1.0 - q) <= 0.01 ? 1.0 : q);		/* IE can't do math */

							timer = timer && (q == 1.0);
						}
					}
					else {
						if ((u.id != pos) || (mode == -1)) {
							if (q <= 0.0)
								continue;

							q = q - 0.05;
							q = Math.max(0.0, q);
							q = ((q - 0.0) <= 0.01 ? 0.0 : q);		/* IE can't do math */

							timer = timer && (q == 0.0);
						}
					}

					u.rel.rel.style.display = (q > 0 ? 'block' : 'none');
					u.rel.rel.style.opacity = q;
					u.rel.rel.style.filter = 'Alpha(opacity=' + Math.floor(0.5 + (100 * q)) + ')';

					var position = Element.cumulativeOffset(u.rel.rel);
					var dimension = document.body.offsetWidth;

					u.rel.rel.style.backgroundPosition =
						'' + (-1238 + ((dimension >> 1) - position[0])) + 'px ' +
						'' + ( -330                     - position[1] ) + 'px';
						/* 330 (from CSS) - 80 (header) */
				}

				if (!timer) {
					elm.running = setTimeout(function() { animSpreadVI(dir, pos); }, 16);
					return true;
				}
			}

			if (dir > 0) {
				if (show (0)) return;
				if (fade  ()) return;
				if (slide ()) return;
				if (show (1)) return;
			}
			else if (dir < 0) {
				if (show(-1)) return;
				if (slide ()) return;
				if (fade  ()) return;
			}
		}

		var animPauseVI = function(dir, pos) {
			if (elm.stop)
				elm.running = setTimeout(function() { animPauseVI(dir, pos); }, 100);
			else
				elm.running = setTimeout(function() { animSpreadVI(dir, pos); }, 16);
		}

		var animContVI = function(dir, pos) {
			clearTimeout(elm.running);

			elm.running = setTimeout(function() { animPauseVI(dir, pos); }, 0);
		}

		if (typ == 'vintage') {
			if (blcks.length <= 1)
				return;

			elm.queue = queue;
			elm.loadq = 0;
		//	elm.style.backgroundImage = 'none';
			elm.style.width  = 'auto';//'100%';
			elm.style.height = 380 + 'px';
			for (var b = 0, bsum = 0; b < blcks.length; b++) {		/* IE can't do math */
				blcks[b].style.width   = 0;
				blcks[b].style.height  = 380 + 'px';
				blcks[b].className = blcks[b].className + ' valid';

			//	blcks[b].style.left        = (  b * (100 - bsum) / (blcks.length - b)) + '%';
				blcks[b].style.marginLeft  = (0.5 * (100 - bsum) / (blcks.length - b)) + '%';
				blcks[b].style.marginRight = (0.5 * (100 - bsum) / (blcks.length - b)) + '%';
				blcks[b].style.opacity     = 0.0;
				blcks[b].style.filter      = 'Alpha(opacity=0)';

				/* IE sh*tf*ck */
			//	blcks[b].style.display    = 'inline-block';
				blcks[b].style.display    = 'block';
				blcks[b].style.cssFloat   = 'left';
				blcks[b].style.styleFloat = 'left';
				blcks[b].style.visibility = 'visible';
				blcks[b].style.overflow   = 'hidden';

				bsum += parseFloat(blcks[b].style.marginLeft) + parseFloat(blcks[b].style.marginRight);
			}

			/* center pictures in the rectangle */
			for (var s = 0; s < queue.length; s++) {
				queue[s] = initAppearVI(queue[s], s <= (queue.length >> 1));
				if (!queue[s])
					continue;

				queue[s].style.height  = 350 + 'px';
				queue[s].style.paddingLeft = '2px';
				queue[s].style.backgroundColor = getFromFade(((0.5 + s) * 100 / queue.length));
				queue[s].rel.rel.style.backgroundColor = getFromFade(((0.5 + s) * 100 / queue.length));

				var position = Element.cumulativeOffset(queue[s]);
				var dimension = document.body.offsetWidth;

				queue[s].style.backgroundPosition =
					'' + (-1238 + ((dimension >> 1) - position[0])) + 'px ' +
					'' + ( -330                     - position[1] ) + 'px';
					/* 330 (from CSS) - 80 (header) */
			}

			elm.appearing = setInterval(function() { animAppearVI(1); }, 16);
		}
	}

	/* trigger it all  ----------------------------------------------------------------------- */
	function makeTabs(container) {
		var bar = getElementsByClassName('fce-tabbar'     , 'div', container)[0];
		var cnt = getElementsByClassName('fce-tabcontents', 'div', container)[0];
		if (!bar)
			return;

		var prv = getElementsByClassName('prev', 'img', container)[0];
		var nxt = getElementsByClassName('next', 'img', container)[0];
		var act = null;

		for (var u = 0; u < cnt.childNodes.length; u++) {
			var elm = cnt.childNodes[u];
			if (!elm || !elm.tagName || (elm.tagName.toLowerCase() != 'div'))
				continue;

			for (var l = 0; l < elm.childNodes.length; l++) {
				var hed = elm.childNodes[l];
				if (!hed || !hed.tagName || (hed.tagName == "!"))
					continue;
				if (hed.tagName.toLowerCase() != 'h3')
					break;

				hed.parentNode.removeChild(hed);
				bar.appendChild(hed);

				if (!act && (act = hed)) {
					hed.className = 'active';
					elm.style.display = 'block';
					bar.assoc = hed;
				}

				hed.container = elm;
				hed.onclick = function() {
					this.parentNode.assoc.className = '';
					this.parentNode.assoc.container.style.display = 'none';

					this.className = 'active';
					this.container.style.display = 'block';

					this.parentNode.assoc = this;
					this.parentNode.lastChild.style.backgroundPosition = '' + (-1237 + (this.offsetWidth / 2) + this.offsetLeft) + 'px top';

					prv.style.visibility = (getPrevTag(this, "h3") ? 'visible' : '');
					nxt.style.visibility = (getNextTag(this, "h3") ? 'visible' : '');

					/* fce galeries */
					var gals = getElementsByClassName('fce-gallery', 'div', this.container);
					while (gals.length) {
						var gal = gals.pop();

					//	setTimeout(function() {
							makeGallery(gal);
							makeGalleryPages(gal);
					//	}, 0);
					}

					/* IE-fix */
					if (this.container.className == 'fce-gallery') {
					//	setTimeout(function() {
							makeGallery(this.container);
							makeGalleryPages(this.container);
					//	}, 0);
					}
				};

				hed.style.borderColor = 'transparent';

				break;
			}
		}

		if (bar.assoc) {
			prv.style.visibility = '';

			assignNavAction(prv, function() {
				/* get current active */
				if (bar.assoc) {
					var act = bar.assoc;
					if (act && (act.previousSibling.onclick || act.previousSibling.click)) {
						/* IE7 */ try {
						act.previousSibling.onclick(); } catch(e) { 
						act.previousSibling.click(); }
						return true;
					}
				}
			}, 2000, 5000);

			nxt.style.visibility = 'visible';

			assignNavAction(nxt, function() {
				/* get current active */
				if (bar.assoc) {
					var act = bar.assoc;
					if (act && (act.nextSibling.onclick || act.nextSibling.click)) {
						/* IE7 */ try {
						act.nextSibling.onclick(); } catch(e) { 
						act.nextSibling.click(); }
						return true;
					}
				}
			}, 2000, 5000);
		}

		/* reverse tabs */
		if (!bar.lastChild || !bar.lastChild.tagName || (bar.lastChild.tagName.toLowerCase() != 'div')) {
			var img = document.createElement('img');
			var msk = document.createElement('div');

			img.src = tmplURL + 'pics/BGs' + mdfyURL + '/gradient.png';
			img.className = 'ht';
			img.alt = ' ';

			msk.style.backgroundPosition = '' + (-1237 + (bar.assoc.offsetWidth / 2) + bar.assoc.offsetLeft) + 'px top';
			msk.className = 'mask';

			bar.appendChild(img);
			bar.appendChild(msk);

			bar.style.borderColor = 'transparent';
			cnt.className = cnt.className + ' valid';
		}
		else if (bar.lastChild && bar.lastChild.tagName) {
			var msk = bar.lastChild;

			msk.style.backgroundPosition = '' + (-1237 + (bar.assoc.offsetWidth / 2) + bar.assoc.offsetLeft) + 'px top';
		}
	}

	/* trigger it all  ----------------------------------------------------------------------- */
	function zoomGallery() {
		var orig = this;
		if (orig.parentNode.tagName.toLowerCase() == 'a')
			orig = orig.parentNode;
		if (orig.parentNode.tagName.toLowerCase() == 'div') if (parseInt(orig.parentNode.style.width))
			orig = orig.parentNode;

		orig.position = Element.cumulativeOffset(orig);

		var copy = orig.cloneNode(true);
		var root = document.getElementById('below');
		var zoms = getElementsByClassName('zoomed', copy.tagName.toLowerCase(), root);

		while (zoms.length) {
			var zom = zoms.pop();
			zom.orig.style.visibility = '';
			root.removeChild(zom);
		}

		var oleft = orig.position[0];
		var otop  = orig.position[1];

		if (MSIE) {
			oleft += (orig.className == 'active' ? 0 : 0);
			otop  += (orig.className == 'active' ? 0 : 0);
		}
		else {
			oleft += (orig.tagName.toLowerCase() == 'div' ? 1 : 1);
			otop  += (orig.tagName.toLowerCase() == 'div' ? 1 : 1);
		}

		copy.orig = orig;
	//	copy.title = (this.parentNode.tagName.toLowerCase() == 'a' ? this.parentNode.title : copy.title);
		copy.className = 'zoomed';
		copy.style.position = 'absolute';
		copy.style.zIndex = 10;
		copy.style.left = oleft + 'px';
		copy.style.top  = otop  + 'px';
		copy.onclick = function() { /* IE7 */ try { return orig.onclick(); } catch(e) { return orig.click(); } return false; }
		copy.onmouseout = function() {
			copy.orig.style.visibility = '';
			if (copy && root && copy.parentNode)
				root.removeChild(copy);
		}

		copy.cwidth  = copy.style.width  ? parseInt(copy.style.width ) : orig.offsetWidth ;
		copy.cheight = copy.style.height ? parseInt(copy.style.height) : orig.offsetHeight;
		copy.ctop    = parseInt(copy.style.top );
		copy.cleft   = parseInt(copy.style.left);
		copy.steps   = (MSIE ? 5 : 10);
		copy.zoom    = 0;

		var imag = copy.getElementsByTagName('img')[0];

		imag.src = this.getAttribute('longdesc');
		imag.h  = this.height;
		imag.w  = this.width ;
		imag.dh = this.height * 1.5 / copy.steps;
		imag.dw = this.width  * 1.5 / copy.steps;

		copy.zooming = function() {
			var h = Math.floor(imag.h + (copy.zoom + 1) * imag.dh);
			var w = Math.floor(imag.w + (copy.zoom + 1) * imag.dw);

			if (1) {
				var dw = ((w - imag.w) >> 1);
				var dh = ((h - imag.h) >> 0);

				var nw = (copy.cleft - dw);
				var nh = (copy.ctop  - dh);

				copy.style.left = nw + 'px';
				copy.style.top  = nh + 'px';
			}

			if (copy.tagName.toLowerCase() == 'div') {
				var dw = ((w - imag.w) >> 0);
				var dh = ((h - imag.h) >> 0);

				var nw = (copy.cwidth  + dw);
				var nh = (copy.cheight + dh);

				copy.style.width  = nw + 'px';
				copy.style.height = nh + 'px';
			}

			imag.height = h;
			imag.width  = w;

			if (copy.zoom < copy.steps) {
				copy.zoom++;
				copy.timer = setTimeout(copy.zooming, 10);
			}
		};

		root.appendChild(copy, root.firstChild);

		copy.orig.style.visibility = 'hidden';
		copy.timer = setTimeout(copy.zooming, 10);
	}

	/* trigger it all  ----------------------------------------------------------------------- */
	function makeGallery(container) {
		var pge = getElementsByClassName('fce-gallerypaging', 'div', container)[0];
		var stp = getElementsByClassName('fce-galleryarea'  , 'div', container)[0];
		if (!stp)
			return;

		var typ = stp.parentNode.className;
		var lft = getElementsByClassName((typ.match(/vertical/) ? 'up'   : 'left' ), 'img', container)[0];
		var rgt = getElementsByClassName((typ.match(/vertical/) ? 'down' : 'right'), 'img', container)[0];
		var pfx = false;
		var ovf = false;
		var hgt = 0;
		var wth = 0;

		/* calculate height based on external CSS or stretch */
		if (stp.style.height == 'auto')
			stp.style.height = stp.offsetHeight + 'px';

		for (var u = 0; u < stp.childNodes.length; u++) {
			var elm = stp.childNodes[u];
			if (!elm || !elm.tagName || (elm.tagName == "!"))
				continue;

			/* more to show */
			if (elm.offsetTop >= parseInt(stp.style.height))
				ovf = true;
			if (elm.className == 'none')
				pfx = true;
			if (elm.offsetHeight > hgt)
				hgt = elm.offsetHeight;
			if (elm.offsetWidth > wth)
				wth = elm.offsetWidth;

			/* invisiblize */
			if (elm.offsetTop >= parseInt(stp.style.height))
				elm.className = 'hidden';
			/* visiblize */
			else if (elm.className == 'hidden')
				elm.className = '';

			var imgs = elm.getElementsByTagName('img');
			for (var i = 0; i < imgs.length; i++) {
				var img = imgs[i];

				if (typ.match(/vertical/)) {
					var of = img.offsetLeft;
					elm.style.paddingLeft  = of + 'px';
					elm.style.paddingRight = of + 'px';
				//	elm.style.display = 'inline-block';
				}

				if (typ.match(/huge/))
					continue;

			//	img.title = ':' + img.position;
				img.onmouseover = zoomGallery;
			}
		}

		if (typ.match(/vertical/)) {
			rgt.style.left = ((wth + 4 - 11) / 2) + 'px';
			lft.style.left = ((wth + 4 - 11) / 2) + 'px';
		}
		else {
			rgt.style.top  = ((hgt + 4 - 11) / 2) + 'px';
			lft.style.top  = ((hgt + 4 - 11) / 2) + 'px';
		}

		if (ovf) {
			if ( ovf) rgt.style.display = 'block';
			if (!pfx) lft.style.display = '';
			else      lft.style.display = 'block';

			if (pge) {
				var hed = pge.getElementsByTagName('h6')[0];

				assignNavAction(lft, function() {
					/* get current active */
					if (hed.assoc) {
						var act = hed.assoc;
						if (act && (act.previousSibling.onclick || act.previousSibling.click)) {
							/* IE7 */ try {
							act.previousSibling.onclick(); } catch(e) { 
							act.previousSibling.click(); }
							return true;
						}
					}
				}, 250, 3000);

				assignNavAction(rgt, function() {
					/* get current active */
					if (hed.assoc) {
						var act = hed.assoc;
						if (act && (act.nextSibling.onclick || act.nextSibling.click)) {
							/* IE7 */ try {
							act.nextSibling.onclick(); } catch(e) { 
							act.nextSibling.click(); }
							return true;
						}
					}
				}, 250, 3000);
			}
			else {
				assignNavAction(lft, function() {
					var _of = false;
					var pos = 0;

					/* scroll */
					for (var u = stp.childNodes.length - 1; u >= 0; u--) {
						var elm = stp.childNodes[u];
						if (!elm || !elm.tagName || (elm.tagName == "!"))
							continue;

						if (elm.className == 'none') {
							elm.className = '';
							rgt.style.display = 'block';
							break;
						}
					}

					/* hide control */
					for (var u = stp.childNodes.length - 1; u >= 0; u--) {
						var elm = stp.childNodes[u];
						if (!elm || !elm.tagName || (elm.tagName == "!"))
							continue;

						/* more to show */
						if (elm.offsetTop >= parseInt(stp.style.height)) {
							elm.className = 'hidden'; _of = true; }
						else if (elm.className == 'hidden')
							elm.className = '';

						if (elm.className == 'none')
							return true;
					}

					lft.style.display = 'none';
					rgt.style.display = (_of ? 'block' : '');

					clearInterval(lft.timer);
				}, 250, 1500);

				assignNavAction(rgt, function() {
					var _px = false;

					/* scroll */
					for (var u = 0; u < stp.childNodes.length; u++) {
						var elm = stp.childNodes[u];
						if (!elm || !elm.tagName || (elm.tagName == "!"))
							continue;

						if (elm.className != 'none') {
							elm.className = 'none';
							lft.style.display = 'block';
							break;
						}
					}

					/* hide control */
					for (var u = 0; u < stp.childNodes.length; u++) {
						var elm = stp.childNodes[u];
						if (!elm || !elm.tagName || (elm.tagName == "!"))
							continue;

						/* more to show */
						if (elm.offsetTop >= parseInt(stp.style.height)) {
							elm.className = 'hidden'; return true; }
						else if (elm.className == 'hidden')
							elm.className = '';

						if (elm.className == 'none')
							_px = true;
					}

					rgt.style.display = 'none';
					lft.style.display = (_px ? 'block' : '');

					clearInterval(rgt.timer);
				}, 250, 1500);
			}
		}
		else {
			if (!ovf) rgt.style.display = '';
			if ( pfx) lft.style.display = 'block';
			else      lft.style.display = '';
		}
	}

	function shiftGallery(container) {
		var pge = getElementsByClassName('fce-gallerypaging', 'div', container)[0];
		var stp = getElementsByClassName('fce-galleryarea'  , 'div', container)[0];
		if (!stp)
			return;

		var lft = getElementsByClassName('left' , 'img', container)[0];
		var rgt = getElementsByClassName('right', 'img', container)[0];
		var pfx = false;
		var ovf = false;

		for (var u = 0; u < stp.childNodes.length; u++) {
			var elm = stp.childNodes[u];
			if (!elm || !elm.tagName || (elm.tagName == "!"))
				continue;

			if (elm.className == 'active') {
				/* shift right */
				if (elm.offsetTop >= parseInt(stp.style.height)) {
					while (elm.offsetTop >= parseInt(stp.style.height)) {
						/* IE7 */ try {
						rgt.onclick(); } catch(e) { 
						rgt.click(); }
					}
				}

				/* shift left */
				/* is implicit */
			}

			/* invisiblize */
			if (elm.offsetTop >= parseInt(stp.style.height))
				elm.className = 'hidden';
		}

		for (var u = 0; u < stp.childNodes.length; u++) {
			var elm = stp.childNodes[u];
			if (!elm || !elm.tagName || (elm.tagName == "!"))
				continue;

			/* more to show */
			if (elm.offsetTop >= parseInt(stp.style.height))
				ovf = true;
			if (elm.className == 'none')
				pfx = true;
		}

		if (ovf) {
			if ( ovf) rgt.style.display = 'block';
			if (!pfx) lft.style.display = '';
			else      lft.style.display = 'block';
		}
		else {
			if (!ovf) rgt.style.display = '';
			if ( pfx) lft.style.display = 'block';
			else      lft.style.display = '';
		}
	}

	/* trigger it all  ----------------------------------------------------------------------- */
	function makeDetailViews(container) {
		var prv = getElementsByClassName('prev', 'img', container)[0];
		var nxt = getElementsByClassName('next', 'img', container)[0];
		var dsp = getElementsByClassName('display', 'div', container)[0];
		var stp = getElementsByClassName('fce-galleryarea', 'div', container)[0];
		if (!stp)
			return;

		var ttl = container.getElementsByTagName('em')[0];
		var rep = dsp.getElementsByTagName('img')[0];
		var clks = stp.getElementsByTagName('a');

		for (var a = 0; a < clks.length; a++) {
			var clk = clks[a];

			clk.onclick = function() {
				var shw = this.getElementsByTagName('img')[0];

				ttl.innerHTML = this.title;
				rep.title  = this.title;
				rep.src    = shw.src;
				rep.alt    = shw.alt;
			//	rep.width  = null;
				rep.width  = 350 * parseInt(shw.width) / parseInt(shw.height);
				rep.height = 350;

				if (ttl.assoc)
					ttl.assoc.className = '';
				ttl.assoc = this;
				ttl.assoc.className = 'active';

				prv.style.visibility = (getPrevTag(this, "a") ? 'visible' : '');
				nxt.style.visibility = (getNextTag(this, "a") ? 'visible' : '');

				shiftGallery(container);

				return false;
			};

			if (!ttl.assoc) {
				ttl.assoc = clk;
				/* IE7 */ try {
				ttl.assoc.onclick(); } catch(e) { 
				ttl.assoc.click(); }
			}
		}

		if (ttl.assoc) {
			prv.style.visibility = '';

			assignNavAction(prv, function() {
				/* get current active */
				if (ttl.assoc) {
					var prev = getPrevTag(ttl.assoc, "a");
					if (prev) {
						/* IE7 */ try {
						prev.onclick(); } catch(e) { 
						prev.click(); }
						return true;
					}
				}
			}, 500, 2000);

			nxt.style.visibility = 'visible';

			assignNavAction(nxt, function() {
				/* get current active */
				if (ttl.assoc) {
					var next = getNextTag(ttl.assoc, "a");
					if (next) {
						/* IE7 */ try {
						next.onclick(); } catch(e) { 
						next.click(); }
						return true;
					}
				}
			}, 500, 2000);
		}
	}

	/* trigger it all  ----------------------------------------------------------------------- */
	function makeGalleryPages(container) {
		var grd = getElementsByClassName('fce-gallerygrid'  , 'div', container)[0];
		var pge = getElementsByClassName('fce-gallerypaging', 'div', container)[0];
		if (!grd)
			return;

		var lft = getElementsByClassName('left' , 'img', container)[0];
		var rgt = getElementsByClassName('right', 'img', container)[0];
		var hed = pge.getElementsByTagName('h6')[0];
		var avl = 0;
		var vis = 0;
		var int = 0;
		var act = null;

		for (var u = 0; u < grd.childNodes.length; u++) {
			var elm = grd.childNodes[u];
			if (!elm || !elm.tagName || (elm.tagName == "!"))
				continue;

			/* permit rendering */
			elm.style.display = '';

			/* more to show */
			avl++;
			if (elm.offsetTop < parseInt(grd.style.height))
				vis++;
		}

		/* number of pages */
		var num = Math.ceil(avl / vis);
		/* get current active */
		var nac = 1;
		if (hed.first)
			nac = 1 + Math.floor(hed.first / vis);

		/* scroll */
		for (var u = 0; u < grd.childNodes.length; u++) {
			var elm = grd.childNodes[u];
			if (!elm || !elm.tagName || (elm.tagName == "!"))
				continue;

			if (int < ((nac - 1) * vis))
				elm.className = 'none';

			int++;
		}

		/* clear */
		while (hed.childNodes.length)
			hed.removeChild(hed.lastChild);

		var dig = document.createElement('em');
		dig.appendChild(document.createTextNode('-'));
		hed.appendChild(dig);

		for (var n = 1; n <= num; n++) {
			var dig = document.createElement('span');

			dig.number = n;
			dig.innerHTML = n;

			if (!act && (nac == n) && (act = dig)) {
				dig.className = 'active';
				hed.first = (n - 1) * vis;
				hed.assoc = dig;
			}

			dig.rel = elm;
			dig.onclick = function() {
				var pos = 0;

				this.parentNode.assoc.className = '';
				this.className = 'active';

				/* scroll */
				for (var u = 0; u < grd.childNodes.length; u++) {
					var elm = grd.childNodes[u];
					if (!elm || !elm.tagName || (elm.tagName == "!"))
						continue;

					if (pos < ((this.number - 1) * vis))
						elm.className = 'none';
					else
						elm.className = '';

					pos++;
				}

				/* hide control */
				if (this.number == 1)
					lft.style.display = 'none';
				if (this.number == num)
					rgt.style.display = 'none';
				if (this.number > 1)
					lft.style.display = 'block';
				if (this.number < num)
					rgt.style.display = 'block';

				this.parentNode.first = (this.number - 1) * vis;
				this.parentNode.assoc = this;
				this.parentNode.parentNode.lastChild.style.backgroundPosition = '' + (-1238 + (this.offsetWidth / 2) + this.offsetLeft) + 'px top';
			};

			hed.appendChild(dig);
		}

		var dig = document.createElement('em');
		dig.appendChild(document.createTextNode('-'));
		hed.appendChild(dig);

		/* reverse tabs */
		if (!pge.lastChild || !pge.lastChild.tagName || (pge.lastChild.tagName.toLowerCase() != 'div')) {
			var img = document.createElement('img');
			var msk = document.createElement('div');

			img.src = tmplURL + 'pics/BGs' + mdfyURL + '/gradient.png';
			img.className = 'hp';
			img.alt = ' ';

			msk.style.backgroundPosition = '' + (-1238 + (act.offsetWidth / 2) + act.offsetLeft) + 'px top';
			msk.className = 'mask';

			pge.appendChild(img);
			pge.appendChild(msk);

			pge.style.borderColor = 'transparent';
		}
		else if (pge.lastChild && pge.lastChild.tagName) {
			var msk = pge.lastChild;

			msk.style.backgroundPosition = '' + (-1238 + (hed.assoc.offsetWidth / 2) + hed.assoc.offsetLeft) + 'px top';
		}
	}

	/* trigger it all  ----------------------------------------------------------------------- */
	function exproc() {
		var content = document.getElementById('content');

	//	subEvent(document, 'resize', exproc);

		/* fce galeries */
		var gals = getElementsByClassName('fce-gallery', 'div', content);
		while (gals.length) {
			var gal = gals.pop();

		//	setTimeout(function() {
				makeGallery(gal);
				makeGalleryPages(gal);
		//	}, 0);
		}
	}

	/* trigger it all  ----------------------------------------------------------------------- */
	function reproc() {
		var content = document.getElementById('content');

		subEvent(document, 'load', reproc);

		/* fce backgrounds */
		var fces = getElementsByClassName('fce', 'div', content);
		while (fces.length) {
			var fce = fces.pop();
			var ofs = -330 - 128 - fce.offsetTop;
			var str = 'center ' + ofs + 'px';

			fce.style.backgroundPosition = str;
		}

		/* fce slides */
		var rainbows = getElementsByClassName('fce-rainbw', 'div', content);
		while (rainbows.length) {
			var rainbow = rainbows.pop();

		//	setTimeout(function() {
				makeSlides(rainbow, 'vintage', 'span');
		//	}, 0);
		}

		/* fce slides */
		var banners = getElementsByClassName('fce-banner', 'div', content);
		while (banners.length) {
			var banner = banners.pop();

		//	setTimeout(function() {
				makeSlides(banner, 'dropin', 'span');
		//	}, 0);
		}

		/* fce slides */
		var teasers = getElementsByClassName('fce-teaser', 'div', content);
		while (teasers.length) {
			var teaser = teasers.pop();

		//	setTimeout(function() {
				makeSlides(teaser, 'leftright', 'img');
		//	}, 0);
		}

		/* fce galeries */
		var gals = getElementsByClassName('fce-gallery', 'div', content);
		while (gals.length) {
			var gal = gals.pop();

		//	setTimeout(function() {
				makeGallery(gal);
				makeGalleryPages(gal);
		//	}, 0);
		}

		/* fce details */
		var dets = getElementsByClassName('fce-detailview', 'div', content);
		while (dets.length) {
			var det = dets.pop();

		//	setTimeout(function() {
				makeDetailViews(det);
		//	}, 0);
		}

		/* box backgrounds */
		var boxes = getElementsByClassName('box', 'div');
		while (boxes.length) {
			var box = boxes.pop();
			var str = 'transparent';

			box.style.backgroundColor = str;
		}
	}

	/* trigger it all  ----------------------------------------------------------------------- */
	function preproc() {
		var content = document.getElementById('content');

		subEvent(document, 'DOMContentLoaded', preproc);
		subEvent(document, 'load', preproc);
		
		getFontSize();

		/* progress */
		var pg = [
			getElementsByClassName('fce-rainbw', 'div', content),
			getElementsByClassName('fce-banner', 'div', content),
			getElementsByClassName('fce-teaser', 'div', content)
		];

		for (var i = 0; i < 3; i++)
			for (var j = 0; j < pg[i].length; j++) {
				var prg = document.createElement('span');
				prg.className = 'progress';
				prg.innerHTML = '&nbsp;';
				if (!pg[i][j].lastChild ||
				    (pg[i][j].lastChild.className != 'progress'))
					pg[i][j].appendChild(prg);
			}

		/* fce tabs (don't need rendered elements) */
		var tabs = getElementsByClassName('fce-tabs', 'div', content);
		while (tabs.length) {
			var tab = tabs.pop();

		//	setTimeout(function() {
				makeTabs(tab);
		//	}, 0);
		}

		/* header lines */
		var hs = [
			content.getElementsByTagName('h1'),
			content.getElementsByTagName('h2'),
			content.getElementsByTagName('h3')	/*,
			content.getElementsByTagName('h4'),
			content.getElementsByTagName('h5'),
			content.getElementsByTagName('h6')	*/
		];
		for (var i = 0; i < 3; i++)
			for (var j = 0; j < hs[i].length; j++) {
				var hed = hs[i][j];
				if (hed.parentNode.className == 'fce-tabbar')
					continue;
				if (hed.parentNode.parentNode.className == 'fce-tabcontents')
					continue;
				if (hed.firstChild && hed.firstChild.className == 'hr')
					continue;

				var img = document.createElement('img');

				img.src = tmplURL + 'pics/BGs' + mdfyURL + '/gradient.png';
				img.className = 'hr';
				img.alt = ' ';

				hed.insertBefore(img, hed.firstChild);
				hed.style.borderColor = 'transparent';
			}

		/* menu overlay */
		var mnu = document.getElementById('menuleft');
		for (var u = 0; u < mnu.childNodes.length; u++) {
			var lst = mnu.childNodes[u];
			if (!lst || !lst.tagName || (lst.tagName.toLowerCase() != 'ul' && lst.tagName.toLowerCase() != 'ol'))
				continue;

			for (var l = 0; l < lst.childNodes.length; l++) {
				var lip = lst.childNodes[l];
				if (!lip || !lip.tagName || (lip.tagName.toLowerCase() != 'li'))
					continue;

				lip.onmouseover = function() {
				//	var objs = document.getElementsByTagName('object');
				//	for (var o = 0; o < objs.length; o++)
				//		objs[o].style.visibility = 'hidden';

					document.getElementById('inlay').style.display = 'block';
				};

				lip.onmouseout = function() {
				//	var objs = document.getElementsByTagName('object');
				//	for (var o = 0; o < objs.length; o++)
				//		objs[o].style.visibility = '';

					document.getElementById('inlay').style.display = 'none';
				};
			}
		}

		/* hover switch */
		var rcts = getElementsByClassName('rect', 'li');
		while (rcts.length) {
			var rct = rcts.pop();

			rct.onmouseover = function() {
				var ims = this.getElementsByTagName('img');
				for (var i = 0; i < ims.length; i++)
					ims[i].src = ims[i].src.replace(/out/, 'over');
			};

			rct.onmouseout = function() {
				var ims = this.getElementsByTagName('img');
				for (var i = 0; i < ims.length; i++)
					ims[i].src = ims[i].src.replace(/over/, 'out');
			};
		}
	}

	if (!MSI6) {
		/* trigger initial switch ----------------------------------- */
		addEvent(document, 'DOMContentLoaded', preproc);
		addEvent(window, 'load', preproc);
		addEvent(window, 'load', reproc);
		addEvent(window, 'resize', exproc);
	}

