function ValidateSubscriber(email, optin) {
	var xmlRequest;

	xmlRequest = new XmlRequest();
	xmlRequest.ServerPage = applicationPath + "XmlHttp/ValidateEmail.aspx";
	return xmlRequest.ExecuteScalar(
		"<root>" +
			"<email>" + email + "</email>" +
			"<tour>" + optin + "</tour>" +
		"</root>");
}

function AddToShoppingCart(itemID) {
	alert(itemID);
	var cartItemID,
		xmlHttp;

	xmlHttp = XmlHttpObject();
	xmlHttp.open("POST", applicationPath + "XmlHttp/AddToShoppingCart.aspx", false);
	xmlHttp.send("<root><itemid>" + itemID + "</itemid><quantity>1</quantity></root>");
	if (XmlHttpResponse(xmlHttp, document.body, false) == 0) {
		responseRecordID(xmlHttp);
		GotoShoppingCart();
	}
}

function GotoShoppingCart() {
	window.location.href = applicationPath + "afrekenen.aspx";
}

function SetCoupon(coupon) {
	var httpRequest,
		xmlRequest,
		xml;

	xml = "<root coupon=\"" + coupon + "\" />";
	xmlRequest = new XmlRequest(applicationPath + "XmlHttp/SetCoupon.aspx");
	xmlRequest.Debug = false;
	try {
		if ((httpRequest = xmlRequest.ExecuteRequest(xml)) != null) {
			if (responseErrors(httpRequest) == 0) {
				return null;
			}
			else
				return evaluateXPath(httpRequest.responseXML, "response/error");
		}
	}
	catch (exception) {
		alert(exception.message);
	}
}

(function ($) {
	$.fn.textShadow = function (option) {
		if (!$.browser.msie) return;
		var IE6 = $.browser.version < 7;
		return this.each(function () {
			var el = $(this);
			var shadow = el.textShadowParse(this.currentStyle["text-shadow"]);
			shadow = $.extend(shadow, option);

			el.textShadowRemove();

			if (shadow.x == 0 && shadow.y == 0 && shadow.radius == 0) return;

			if (el.css("position") == "static") {
				el.css({ position: "relative" });
			}
			el.css({ zIndex: "0" });
			if (IE6) {
				el.css({ zoom: "1" });
			}

			var span = document.createElement("span");
			$(span).addClass("jQueryTextShadow");
			$(span).html(el.html());
			$(span).css({
				padding: this.currentStyle["padding"],
				width: el.width(),
				position: "absolute",
				zIndex: "-1",
				color: shadow.color != null ? shadow.color : el.css("color"),
				left: (-parseInt(shadow.radius) + parseInt(shadow.x)) + "px",
				top: (-parseInt(shadow.radius) + parseInt(shadow.y)) + "px"
			});

			if (shadow.radius != 0) {
				if (shadow.opacity != null) {
					$(span).css("filter", "progid:DXImageTransform.Microsoft.Blur(pixelradius=" + parseInt(shadow.radius) + ", enabled='true', makeShadow='true', ShadowOpacity=" + shadow.opacity + ")");
				} else {
					$(span).css("filter", "progid:DXImageTransform.Microsoft.Blur(pixelradius=" + parseInt(shadow.radius) + ", enabled='true')");
				}
			}
			el.append(span);

		});
	};

	$.fn.textShadowParse = function (value) {
		value = String(value)
			.replace(/^\s+|\s+$/gi, '')
			.replace(/\s*!\s*important/i, '')
			.replace(/\(\s*([^,\)]+)\s*,\s*([^,\)]+)\s*,\s*([^,\)]+)\s*,\s*([^\)]+)\s*\)/g, '($1/$2/$3/$4)')
			.replace(/\(\s*([^,\)]+)\s*,\s*([^,\)]+)\s*,\s*([^\)]+)\s*\)/g, '($1/$2/$3)')

		var shadow = {
			x: 0,
			y: 0,
			radius: 0,
			color: null
		};

		if (value.length > 1 || value[0].toLowerCase() != 'none') {
			value = value.replace(/\//g, ',');
			var color;
			if (value.match(/(\#[0-9a-f]{6}|\#[0-9a-f]{3}|(rgb|hsb)a?\([^\)]*\)|\b[a-z]+\b)/i) && (color = RegExp.$1)) {
				shadow.color = color.replace(/^\s+/, '');
				value = value.replace(shadow.color, '');
			}

			value = value
				.replace(/^\s+|\s+$/g, '')
				.split(/\s+/)
				.map(function (item) {
					return (item || '').replace(/^0[a-z]*$/, '') ? item : 0;
				});

			switch (value.length) {
				case 1:
					shadow.x = shadow.y = value[0];
					break;
				case 2:
					shadow.x = value[0];
					shadow.y = value[1];
					break;
				case 3:
					shadow.x = value[0];
					shadow.y = value[1];
					shadow.radius = value[2];
					break;
			}
			if ((!shadow.x && !shadow.y && !shadow.radius) || shadow.color == 'transparent') {
				shadow.x = shadow.y = shadow.radius = 0;
				shadow.color = null;
			}
		}

		return shadow;
	};

	$.fn.textShadowRemove = function () {
		if (!$.browser.msie) return;
		return this.each(function () {
			$(this).children("span.jQueryTextShadow").remove();
		});
	};
})(jQuery);

if (typeof Array.prototype.map == 'undefined') {
	Array.prototype.map = function (fnc) {
		var a = new Array(this.length);
		for (var i = 0; i < this.length; i++) {
			a[i] = fnc(this[i]);
		}
		return a;
	}
}

jQuery.fn.initMenu = function () {
	return this.each(function () {
		var theMenu = $(this).get(0);
		$('.acitem', this).hide();
		$('li.expand > .acitem', this).show();
		$('li.expand > .acitem', this).prev().addClass('active');
		$('li a', this).click(
            function (e) {
            	e.stopImmediatePropagation();
            	var theElement = $(this).next();
            	var parent = this.parentNode.parentNode;
            	if ($(parent).hasClass('noaccordion')) {
            		if (theElement[0] === undefined) {
            			window.location.href = this.href;
            		}
            		$(theElement).slideToggle('normal', function () {
            			if ($(this).is(':visible')) {
            				$(this).prev().addClass('active');
            			}
            			else {
            				$(this).prev().removeClass('active');
            			}
            		});
            		return false;
            	}
            	else {
            		if (theElement.hasClass('acitem') && theElement.is(':visible')) {
            			if ($(parent).hasClass('collapsible')) {
            				$('.acitem:visible', parent).first().slideUp('normal',
                            function () {
                            	$(this).prev().removeClass('active');
                            }
                        );
            				return false;
            			}
            			return false;
            		}
            		if (theElement.hasClass('acitem') && !theElement.is(':visible')) {
            			$('.acitem:visible', parent).first().slideUp('normal', function () {
            				$(this).prev().removeClass('active');
            			});
            			theElement.slideDown('normal', function () {
            				$(this).prev().addClass('active');
            			});
            			return false;
            		}
            	}
            }
    );
	});
};
