/*
 * Xpage Internet Studio 7
 * Copyright (c) 2004 - 2012, XDEV Software and/or its affiliates. All rights reserved.
 */
var overlayOpen = [];

function preloadImages() {
	if (document.images) {
		for ( var i = 0; i < preloadImages.arguments.length; i++) {
			new Image().src = preloadImages.arguments[i];
		}
	}
}

function registerButtonHandler() {
	$(".buttoncontrol").each(function() {
		var buttonID = this.parentNode.id;
		var buttonData = layerbuttons[buttonID];
		for ( var i = 0; i < 4; i++) {
			if (buttonData.layer[i] != null) {
				var layer = $("#" + buttonData.layer[i]);
				buttonData.layer[i] = layer;
			}
		}
		buttonShowLayer(buttonID, showButtonSelected(buttonData) ? [ 2, 0 ] : [ 0 ]);
		$(this).mouseenter(function(event) {
			if (buttonData.group == null)
				buttonSetOverlayVisible(buttonData, true);
			buttonShowLayer(buttonID, showButtonSelected(buttonData) ? [ 3, 2, 0 ] : [ 1, 0 ]);
		});
		$(this).mouseout(function(event) {
			if (buttonData.group == null)
				buttonSetOverlayVisible(buttonData, false);
			buttonShowLayer(buttonID, showButtonSelected(buttonData) ? [ 2, 0 ] : [ 0 ]);
		});
		$(this).mousedown(function(event) {
			if (buttonData.group != null && !buttonData.isMenuButton) {
				for ( var bid in layerbuttons) {
					if (layerbuttons[bid].group == buttonData.group && bid != buttonID) {
						layerbuttons[bid].isSelected = false;
						buttonShowLayer(bid, showButtonSelected(layerbuttons[bid]) ? [ 2, 0 ] : [ 0 ]);
						buttonSetOverlayVisible(layerbuttons[bid], false);
					}
				}
				buttonData.isSelected = true;
				buttonShowLayer(buttonID, [ 3, 2, 0 ]);
				buttonSetOverlayVisible(buttonData, true);
			} else {
				buttonShowLayer(buttonID, [ 2, 1, 0 ]);
			}
		});
		$(this).mouseup(function(event) {
			if (buttonData.group == null)
				buttonShowLayer(buttonID, showButtonSelected(buttonData) ? [ 3, 2, 1, 0 ] : [ 1, 0 ]);
		});
	});
}

function showButtonSelected(buttonData) {
	return buttonData.isSelected || (buttonData.pageLink && document.currentPage == buttonData.pageLink);
}

function buttonShowLayer(buttonID, layerIdx) {
	var buttonData = layerbuttons[buttonID];
	var currentLayer = 0;
	if (buttonData.currentLayer)
		currentLayer = buttonData.currentLayer;
	var nextLayer = 0;
	for ( var i = 0; i < layerIdx.length; i++) {
		var index = layerIdx[i];
		if (buttonData.layer[index] != null) {
			nextLayer = index;
			break;
		}
	}
	if (currentLayer != nextLayer) {
		buttonData.currentLayer = nextLayer;
		currentLayer = buttonData.layer[currentLayer];
		nextLayer = buttonData.layer[nextLayer];
		switchLayers(currentLayer, nextLayer, buttonData.transitionType, buttonData.transitionDuration);
	}
}

function buttonSetOverlayVisible(buttonData, visible) {
	if (buttonData.overlay != null) {
		var overlay = $("#" + buttonData.overlay);
		if (overlay != null && overlay.is(":visible") != visible) {
			overlay.stop(false, true);
			if (visible) {
				overlay.animate({
					height : "show"
				}, 400, "swing");
			} else {
				overlay.animate({
					height : "hide"
				}, 200, "swing");
			}
		}
	}
}

function registerMenuHandler() {
	overlayOpen = [];
	$("div").each(function() {
		var id = this.id;
		if (id == null || id == "" || id.charAt(0) == "X") {
			$(this).mouseenter(function(event) {
				var mbDiv = getMenuButton(this, this.id);
				if (mbDiv != null) {
					var buttonData = layerbuttons[mbDiv.id];
					var group = buttonData.group;
					lwSetOverlayVisible(group, mbDiv.id);
					if (jQuery.inArray(group, overlayOpen) == -1)
						overlayOpen.push(group);
					var last = getLastOverlay();
					while (overlayOpen.length > 0 && last != group) {
						lwSetOverlayVisible(last, null);
						overlayOpen.pop();
						last = getLastOverlay();
					}
				}
			});
			$(this).mouseup(function(event) {
				// delay to give a-hrefs a chance
				$(this).delay(1).queue(function() {
					for ( var bid in layerbuttons) {
						var buttonData = layerbuttons[bid];
						if (buttonData.isMenuButton) {
							buttonSetOverlayVisible(buttonData, false);
						}
					}
					$(this).dequeue();
				});
				overlayOpen = [];
			});
		}
	});
}

function getMenuButton(div, id) {
	var mb = null;
	for ( var bid in layerbuttons)
		if (bid == id)
			mb = document.getElementById(bid);
	if (mb == null) {
		var parentDiv = div.parentNode;
		if (parentDiv != null)
			mb = getMenuButton(parentDiv, parentDiv.id);
	}
	return mb;
}

function getLastOverlay() {
	var length = overlayOpen.length;
	if (length > 0)
		return overlayOpen[length - 1];
	return null;
}

function lwSetOverlayVisible(group, exceptID) {
	for ( var bid in layerbuttons) {
		var buttonData = layerbuttons[bid];
		if (buttonData.isMenuButton && buttonData.group == group) {
			buttonSetOverlayVisible(buttonData, exceptID == bid);
		}
	}
}

function startSlideShow(slideShowID) {
	var slideShow = slideShows[slideShowID];
	slideShow.running = true;
	var duration = slideShow.slides[slideShow.currentSlideIndex].duration;
	$("#" + slideShowID).delay(duration).queue(function() {
		runSlideShow(slideShowID);
		$(this).dequeue();
	});
}

function stopSlideShow(slideShowID) {
	var slideShow = slideShows[slideShowID];
	slideShow.running = false;
	$("#" + slideShowID).stop(true, true);
	for ( var i = 0; i < slideShow.slides.length; i++)
		$("#" + slideShow.slides[i].slideID).stop(true, true);
}

function slideShowPreviousSlide(slideShowID) {
	stopSlideShow(slideShowID);
	var slideShow = slideShows[slideShowID];
	var nextSlideIndex;
	if (slideShow.currentSlideIndex > 0)
		nextSlideIndex = slideShow.currentSlideIndex - 1;
	else
		nextSlideIndex = slideShow.slides.length - 1;
	slideShowSlide(slideShow, nextSlideIndex);
}

function slideShowNextSlide(slideShowID) {
	stopSlideShow(slideShowID);
	var slideShow = slideShows[slideShowID];
	var nextSlideIndex;
	if (slideShow.currentSlideIndex < slideShow.slides.length - 1)
		nextSlideIndex = slideShow.currentSlideIndex + 1;
	else
		nextSlideIndex = 0;
	slideShowSlide(slideShow, nextSlideIndex);
}

function slideShowGotoSlide(slideShowID, nextSlideIndex) {
	var slideShow = slideShows[slideShowID];
	if (nextSlideIndex != slideShow.currentSlideIndex) {
		stopSlideShow(slideShowID);
		if (nextSlideIndex >= 0 && nextSlideIndex < slideShow.slides.length) {
			slideShowSlide(slideShow, nextSlideIndex);
		}
	}
}

function runSlideShow(slideShowID) {
	var slideShow = slideShows[slideShowID];
	if (!slideShow.running)
		return;
	var nextSlideIndex = -1;
	if (slideShow.randomize) {
		do {
			nextSlideIndex = parseInt(Math.random() * (slideShow.slides.length));
		} while (nextSlideIndex == slideShow.currentSlideIndex);
	} else if (slideShow.isDirectionBackwards) {
		nextSlideIndex = slideShow.currentSlideIndex - 1;
		if (nextSlideIndex < 0 && slideShow.pingPong) {
			if (slideShow.passCount)
				slideShow.passCount++;
			else
				slideShow.passCount = 1;
			slideShow.isDirectionForward = true;
			nextSlideIndex = 1;
		}
	} else {
		nextSlideIndex = slideShow.currentSlideIndex + 1;
		if (nextSlideIndex == slideShow.slides.length) {
			if (slideShow.pingPong) {
				slideShow.isDirectionForward = false;
				nextSlideIndex -= 2;
			} else {
				if (slideShow.passCount)
					slideShow.passCount++;
				else
					slideShow.passCount = 1;
				nextSlideIndex = 0;
			}
		}
	}
	if (nextSlideIndex != -1 && (slideShow.randomize || !(slideShow.fixedPassCount > 0 && slideShow.passCount >= slideShow.fixedPassCount))) {
		var pause = slideShow.slides[nextSlideIndex].duration;
		slideShowSlide(slideShow, nextSlideIndex, function() {
			if (slideShow.running) {
				$("#" + slideShowID).delay(pause).queue(function() {
					runSlideShow(slideShowID);
					$(this).dequeue();
				});
			}
		});
	}
}

function slideShowSlide(slideShow, nextSlideIndex, callback) {
	var currentSlide = slideShow.slides[slideShow.currentSlideIndex];
	var nextSlide = slideShow.slides[nextSlideIndex];
	slideShow.currentSlideIndex = nextSlideIndex;
	switchLayers($("#" + currentSlide.slideID), $("#" + nextSlide.slideID), nextSlide.transitionType, nextSlide.transitionDuration, callback);
}

function switchLayers(currentLayer, nextLayer, transitionType, transitionDuration, callback) {
	switch (transitionType) {
	case 0: { // no effect
		currentLayer.stop(false, false);
		nextLayer.stop(false, false);
		nextLayer.fadeTo(0, 1);
		currentLayer.fadeTo(0, 0);
		if (callback) {
			callback();
		}
	}
	break;
	case 1: { // fade
		currentLayer.stop(false, false);
		nextLayer.stop(false, false);
		currentLayer.css('zIndex', 0);
		nextLayer.css('zIndex', 1);
		currentLayer.fadeTo(transitionDuration, 0, "easeOutQuad");
		nextLayer.fadeTo(transitionDuration, 1, "easeInQuad", callback);
	}
	break;
	case 2: { // drop right to left
		moveLayers(currentLayer, nextLayer, transitionDuration, "drop", "right", "left", callback);
	}
	break;
	case 3: { // drop left to right
		moveLayers(currentLayer, nextLayer, transitionDuration, "drop", "left", "right", callback);
	}
	break;
	case 4: { // drop top to bottom
		moveLayers(currentLayer, nextLayer, transitionDuration, "drop", "up", "down", callback);
	}
	break;
	case 5: { // drop bottom to top
		moveLayers(currentLayer, nextLayer, transitionDuration, "drop", "down", "up", callback);
	}
	break;
	case 6: { // clip vertical
		moveLayers(currentLayer, nextLayer, transitionDuration, "clip", "vertical", "vertical", callback);
	}
	break;
	case 7: { // clip horizontal
		moveLayers(currentLayer, nextLayer, transitionDuration, "clip", "horizontal", "horizontal", callback);
	}
	break;
	case 8: { // puff / diagonal
		currentLayer.stop(false, true);
		nextLayer.stop(false, true);
		currentLayer.css('zIndex', 1);
		nextLayer.css('zIndex', 0);
		nextLayer.css('opacity', 1);
		nextLayer.show("puff", transitionDuration, callback);
		currentLayer.hide("puff", transitionDuration);
	}
	break;
	case 9: { // scale
		currentLayer.stop(false, true);
		nextLayer.stop(false, true);
		currentLayer.css('zIndex', 1);
		nextLayer.css('zIndex', 0);
		nextLayer.css('opacity', 1);
		nextLayer.show("scale", transitionDuration, callback);
		currentLayer.hide("scale", transitionDuration);
	}
	break;
	case 10: { // fold
		currentLayer.stop(false, true);
		nextLayer.stop(false, true);
		currentLayer.css('zIndex', 1);
		nextLayer.css('zIndex', 0);
		nextLayer.css('opacity', 1);
		nextLayer.show("fold", {
			horizFirst : false
		}, transitionDuration, callback);
		currentLayer.hide("fold", {
			horizFirst : true
		}, transitionDuration);
	}
	break;
	case 11: { // vertical in, horizontal out
		moveLayers(currentLayer, nextLayer, transitionDuration, "blind", "vertical", "horizontal", callback);
	}
	break;
	case 12: { // horizontal in, vertical out
		moveLayers(currentLayer, nextLayer, transitionDuration, "blind", "horizontal", "vertical", callback);
	}
	break;
	}
}

function moveLayers(currentLayer, nextLayer, transitionDuration, effect, from, to, callback) {
	currentLayer.stop(false, true);
	nextLayer.stop(false, true);
	currentLayer.css('zIndex', 1);
	nextLayer.css('zIndex', 0);
	nextLayer.css('opacity', 1);
	nextLayer.show(effect, {
		direction : from
	}, transitionDuration, callback);
	currentLayer.hide(effect, {
		direction : to
	}, transitionDuration);
}

function runWebcam(wc, imgurl, ms) {
	var d = new Date();
	d = "?" + d.getTime();
	document.images[wc].src = imgurl + d;
	setTimeout("runWebcam('" + wc + "','" + imgurl + "'," + ms + ")", ms)
}

function CXTransform(id, relative, sRect, stepRects, stepDurations) {
	this.id = id;
	this.relative = relative;
	this.sRect = sRect;
	this.stepRects = stepRects;
	this.stepDurations = stepDurations;
	this.curStep = -1;
}

function CXRect(x, y, w, h) {
	this.x = x;
	this.y = y;
	this.w = w;
	this.h = h;
}

function CXGoto(absolute, step, count) {
	this.absolute = absolute;
	this.step = step;
	this.count = count;
	this.stepped = 0;
}

function CXLink(typ, s1, s2, s3, s4, s5, s6, s7) {
	this.typ = typ;
	this.s1 = s1;
	this.s2 = s2;
	this.s3 = s3;
	this.s4 = s4;
	this.s5 = s5;
	this.s6 = s6;
	this.s7 = s7;
}

function performLink(cxlink) {
	var retVal = true;
	if (cxlink.typ == 1 || cxlink.typ == 2) {
		if (cxlink.s2 == '_blank') {
			if (cxlink.s3) {
				window.open(cxlink.s1, cxlink.s4, 'width=' + cxlink.s5 + ',height=' + cxlink.s6 + ',menubar=no,toolbar=no,status=no,scrollbars=yes');
			} else {
				window.open(cxlink.s1);
			}
		} else if (cxlink.s2 == '_top') {
			top.location.href = cxlink.s1;
		} else if (cxlink.s2 == '_parent') {
			parent.location.href = cxlink.s1;
		} else if (cxlink.s2 == '_self' || cxlink.s2 == '') {
			window.location.href = cxlink.s1;
		} else {
			var target = document.getElementById(cxlink.s2);
			if (target != null) {
				target.src = cxlink.s1;
			} else {
				target = top.document.getElementById(cxlink.s2);
				if (target != null)
					target.src = cxlink.s1;
			}
		}
	} else if (cxlink.typ == 3) {
		window.location.href = cxlink.s1;
	} else if (cxlink.typ == 4) {
		var frm = document.getElementById(cxlink.s1);
		if (frm != null) {
			if (checkForm(cxlink)) {
				frm.submit();
			} else {
				retVal = false;
			}
		}
	} else if (cxlink.typ == 5) {
		var frm = document.getElementById(cxlink.s1);
		if (frm != null)
			frm.reset();
	} else if (cxlink.typ == 9) {
		window.print();
	} else if (cxlink.typ == 10) {
		window.close();
	} else if (cxlink.typ == 6) {
		var frmM = document.getElementById(cxlink.s1);
		if (frmM != null) {
			if (checkForm(cxlink)) {
				var frmMoldAction = frmM.action;
				frmM.action = cxlink.s7;
				frmM.submit();
				frmM.action = frmMoldAction;
			}
		}
	}
	return retVal;
}

function checkForm(cxlink) {
	for ( var i = 0; i < cxlink.s2.length; i++) {
		var ok = true;
		if (cxlink.s2[i].indexOf("radio_") == 0) {
			if (cxlink.s3[i][1]) {
				var radios = document.getElementsByName(cxlink.s2[i].substring(6));
				ok = false;
				for ( var ri = 0; ri < radios.length && ok == false; ri++) {
					if (radios[ri].checked) {
						ok = true;
					}
				}
			}
		} else {
			var cpn = document.getElementById(cxlink.s2[i]);
			if (cpn != null) {
				if (cpn.type == "checkbox") {
					if (cxlink.s3[i][1] && !cpn.checked) {
						ok = false;
					}
				} else if (cpn.type.indexOf("select") >= 0) {
					if (cxlink.s3[i][1] && cpn.value.length == 0) {
						ok = false;
					}
				} else {
					if (cxlink.s3[i][1] && cpn.value.length == 0) {
						ok = false;
					} else if (cpn.value.length > 0) {
						if (cxlink.s3[i][0] == 1) {
							if (isNaN(cpn.value)) {
								ok = false;
							} else {
								var intval = parseInt(cpn.value);
								if (cxlink.s3[i][2] && cxlink.s3[i][4]) {
									if (intval < cxlink.s3[i][3] || intval > cxlink.s3[i][5]) {
										ok = false;
									}
								} else if (cxlink.s3[i][2]) {
									if (intval < cxlink.s3[i][3]) {
										ok = false;
									}
								} else if (cxlink.s3[i][4]) {
									if (intval > cxlink.s3[i][5]) {
										ok = false;
									}
								}
							}
						} else if (cxlink.s3[i][0] == 2) {
							var sl = cpn.value.length;
							if (cxlink.s3[i][2] && cxlink.s3[i][4]) {
								if (sl < cxlink.s3[i][3] || sl > cxlink.s3[i][5]) {
									ok = false;
								}
							} else if (cxlink.s3[i][2]) {
								if (sl < cxlink.s3[i][3]) {
									ok = false;
								}
							} else if (cxlink.s3[i][4]) {
								if (sl > cxlink.s3[i][5]) {
									ok = false;
								}
							}
						} else if (cxlink.s3[i][0] == 3) {
							var usr = "([a-zA-Z0-9][a-zA-Z0-9_.-]*|\"([^\\\\\x80-\xff\015\012\"]|\\\\[^\x80-\xff])+\")";
							var domain = "([a-zäöüA-ZÄÖÜ0-9][a-zäöüA-ZÄÖÜ0-9._-]*\\.)*[a-zäöüA-ZÄÖÜ0-9][a-zäöüA-ZÄÖÜ0-9._-]*\\.[a-zA-Z]{2,5}";
							var reg = new RegExp("^" + usr + "\@" + domain + "$");
							ok = reg.test(cpn.value);
						}
					}
				}
			}
		}
		var overlay = $("#" + cxlink.s4[i]);
		if (overlay != null) {
			if (ok)
				overlay.hide();
			else
				overlay.show();
		}
		if (!ok)
			return false;
	}
	return true;
}

function CXVis(id, type) {
	this.id = id;
	this.type = type;
}

function CXStartPos(id, x, y, w, h) {
	this.id = id;
	this.x = x;
	this.y = y;
	this.w = w;
	this.h = h;
}

function CXSearch(ole, oleDiv, txt, x, y, w, h) {
	this.ole = ole;
	this.oleDiv = oleDiv;
	this.txt = txt;
	this.x = x;
	this.y = y;
	this.w = w;
	this.h = h;
}

function CXChange(id, key, val, op) {
	this.id = id;
	this.key = key;
	this.val = val;
	this.op = op;
}

function CXSlideShowControl(id, op, slideIndex) {
	this.id = id;
	this.op = op;
	this.slideIndex = slideIndex;
}

function startAction(id) {
	var retVal = true;
	if (cxactions[id] != null && !cxactions[id][3]) {
		cxactions[id][3] = true;
		retVal = performAction(id);
	}
	return retVal;
}

function performAction(id) {
	var retVal = true;
	if (cxactions[id] != null) {
		var curStep = cxactions[id][2];
		if (cxactions[id][0].length - 1 > curStep) {
			var timeout = 0;
			var nextStep = true;
			var data = cxactions[id][1][curStep];
			switch (cxactions[id][0][curStep]) {
			case 0:
				for ( var i = 0; i < data.length; i++) {
					var cxchange = data[i];
					var elem = document.getElementById(cxchange.id);
					if (elem != null) {
						cxchange.val = parseInt(cxchange.val);
						if (cxchange.key == "opacity") {
							if ($.browser.msie) {
								var init = true;
								if (elem.style.filter.length > 0) {
									var str = elem.style.filter;
									var search = "alpha(opacity=";
									var i = str.indexOf(search);
									if (i >= 0) {
										init = false;
										var before = str.substr(0, i + search.length);
										var after = str.substr(i + search.length);
										i = after.indexOf(")");
										var opacity = parseFloat(after.substr(0, i));
										after = after.substr(i);
										var val = cxchange.val / 255 * 100;
										if (cxchange.op == "=")
											opacity = val;
										else if (cxchange.op == "+")
											opacity += val;
										else if (cxchange.op == "-")
											opacity -= val;
										if (opacity >= 0 && opacity <= 100) {
											opacity = String(opacity);
											if (opacity.length > 5)
												opacity = opacity.substr(0, 5);
											elem.style.filter = before + opacity + after;
										}
									}
								}
								if (init) {
									var opacity = 100;
									var val = cxchange.val / 255 * 100;
									if (cxchange.op == "=")
										opacity = val;
									else if (cxchange.op == "-")
										opacity -= val;
									if (opacity >= 0 && opacity <= 100) {
										opacity = String(opacity);
										if (opacity.length > 5)
											opacity = opacity.substr(0, 5);
										elem.style.filter = "alpha(opacity=" + opacity + ")";
									}
								}
							} else {
								if (cxchange.op == "=") {
									var opacity = cxchange.val / 255;
									if (opacity >= 0.0 && opacity <= 1.0) {
										opacity = String(opacity);
										if (opacity.length > 4)
											opacity = opacity.substr(0, 4);
										elem.style.opacity = opacity;
									}
								} else {
									var opacity = 1.0;
									if (elem.style.opacity)
										opacity = parseFloat(elem.style.opacity);
									if (cxchange.op == "+")
										opacity += cxchange.val / 255;
									else
										opacity -= cxchange.val / 255;
									if (opacity >= 0.0 && opacity <= 1.0) {
										opacity = String(opacity);
										if (opacity.length > 4)
											opacity = opacity.substr(0, 4);
										elem.style.opacity = opacity;
									}
								}
							}
						} else if (cxchange.key == "top") {
							var top = parseInt(elem.style.top);
							if (cxchange.op == "=")
								top = cxchange.val;
							else if (cxchange.op == "+")
								top += cxchange.val;
							else if (cxchange.op == "-")
								top -= cxchange.val;
							elem.style.top = top + "px";
						} else if (cxchange.key == "left") {
							var left = parseInt(elem.style.left);
							if (cxchange.op == "=")
								left = cxchange.val;
							else if (cxchange.op == "+")
								left += cxchange.val;
							else if (cxchange.op == "-")
								left -= cxchange.val;
							elem.style.left = left + "px";
						} else if (cxchange.key == "width") {
							var width = parseInt(elem.style.width);
							if (cxchange.op == "=")
								width = cxchange.val;
							else if (cxchange.op == "+")
								width += cxchange.val;
							else if (cxchange.op == "-")
								width -= cxchange.val;
							elem.style.width = width + "px";
						} else if (cxchange.key == "height") {
							var height = parseInt(elem.style.height);
							if (cxchange.op == "=")
								height = cxchange.val;
							else if (cxchange.op == "+")
								height += cxchange.val;
							else if (cxchange.op == "-")
								height -= cxchange.val;
							elem.style.height = height + "px";
						}
					}
				}
			break;
			case 1:
				if (data.stepRects.length > data.curStep) {
					var scpn = $("#" + data.id);
					if (scpn != null) {
						nextStep = false;
						timeout = -1;
						if (data.curStep < 0) {
							data.curStep = 0;
							if (!data.relative) {
								scpn.css('left', data.sRect.x);
								scpn.css('top', data.sRect.y);
								scpn.css('width', data.sRect.w);
								scpn.css('height', data.sRect.h);
							}
						}
						var r = data.stepRects[data.curStep];
						scpn.animate({
							'left' : r.x,
							'top' : r.y,
							'width' : r.w,
							'height' : r.h
						}, data.stepDurations[data.curStep], 'linear', function() {
							data.curStep++;
							performAction(id);
						});
					}
				} else {
					data.curStep = -1;
				}
			break;
			case 2:
				timeout = data;
			break;
			case 3:
				if (data.count < 0 || data.stepped < data.count) {
					data.stepped++;
					nextStep = false;
					var st = curStep;
					if (data.absolute) {
						st = data.step;
					} else {
						st = curStep + data.step;
					}
					cxactions[id][2] = st;
				} else {
					data.stepped = 0;
				}
			break;
			case 4:
			case 8:
				retVal = performLink(data);
			break;
			case 5:
				var cpn = $("#" + data.id);
				if (cpn != null) {
					switch (data.type) {
					case 0:
						cpn.show();
					break;
					case 1:
						cpn.hide();
					break;
					case 2:
						if (cpn.is(":visible"))
							cpn.hide();
						else
							cpn.show();
					break;
					}
				}
			break;
			case 6:
				var cpn0 = $("#" + data.id);
				if (cpn0 != null) {
					cpn0.animate({
						'left' : data.x,
						'top' : data.y,
						'width' : data.w,
						'height' : data.h
					},1);				
				}
			break;
			case 7:
				var searchString = document.getElementById(data.txt);
				if (searchString != null) {
					searchString = searchString.value;
					var searchPath = "scripts/search.php?q=" + searchString;
					var searchTarget = document.getElementById(data.ole);
					if (searchTarget != null) {
						var oleDiv = document.getElementById(data.oleDiv);
						if (oleDiv != null) {
							oleDiv.style.left = data.x + 'px';
							oleDiv.style.top = data.y + 'px';
							oleDiv.style.width = data.w + 'px';
							oleDiv.style.height = data.h + 'px';
						}
						searchTarget.src = searchPath;
					} else {
						window.location.href = searchPath
					}
				}
			break;
			case 9:
				var cpn = $("#" + data.id);
				if (cpn != null) {
					switch (data.op) {
					case 0:
						stopSlideShow(data.id);
					break;
					case 1:
						startSlideShow(data.id);
					break;
					case 2:
						slideShowNextSlide(data.id);
					break;
					case 3:
						slideShowPreviousSlide(data.id);
					break;
					case 4:
						slideShowGotoSlide(data.id, data.slideIndex);
					break;
					}
				}
			break;
			}
			if (nextStep) {
				cxactions[id][2]++;
			}
			if (timeout >= 0) {
				setTimeout("performAction('" + id + "')", timeout);
			}
		} else {
			cxactions[id][2] = 0;
			cxactions[id][3] = false;
		}
	}
	return retVal;
}
