﻿var IE = document.all ? true : false

$(document).ready(function() {

	$(this).find(".button").mouseover(function() { $(this).addClass("button_o"); });
	$(this).find(".button").mouseout(function() { $(this).removeClass("button_o"); });

	$("#tabbedbox .bg").mouseover(function() {
		//$(this).find(".title").css("color", "#dd041b");
		$(this).find(".button").addClass("button_o");
	});

	$("#tabbedbox .bg").mouseout(function() {
		//$(this).find(".title").css("color", "inherit");
		$(this).find(".button").removeClass("button_o");
	});

//	$("#nieuwsbrief .button").click(function() {
//		// validate
//		var error = false;
//		if (!isEmail($("#nieuwsbrief_email").val())) {
//			$("#nieuwsbrief_email").addClass("error");
//			error = true;
//		}
//		else
//			$("#nieuwsbrief_email").removeClass("error");

//		var agree = $("#nieuwsbrief_akkoord:checked").val();
//		if (!agree) {
//			$("#nieuwsbrief_akkoord").addClass("error");
//			error = true;
//		}

//		if (!error) {
//			// subscribe

//		}
//	});

	if ($("#subnavslider1").length > 0) {
		$("#subnavslider1").easySlider({
			prevId: 'prevBtn',
			nextId: 'nextBtn',
			prevText: '',
			nextText: '',
			orientation: 'horizontal',
			auto: true,
			pause: 3000,
			continuous: true,
			controlsShow: false,
			controlsFade: false
		});
	}

	if ($("#subnavslider2").length > 0) {
		$("#subnavslider2").easySlider({
			prevId: 'prevBtn',
			nextId: 'nextBtn',
			prevText: '',
			nextText: '',
			orientation: 'horizontal',
			auto: true,
			pause: 3000,
			continuous: true,
			controlsShow: false,
			controlsFade: false
		});
	}

	if ($("#subnavslider3").length > 0) {
		$("#subnavslider3").easySlider({
			prevId: 'prevBtn',
			nextId: 'nextBtn',
			prevText: '',
			nextText: '',
			orientation: 'horizontal',
			auto: true,
			pause: 3000,
			continuous: true,
			controlsShow: false,
			controlsFade: false
		});
	}

	//tabs aan/uitzetten
	$("#tabbedbox .wtab").click(function() {
		if ($(this).find("a").attr("innerHTML") != "") {
			disableTabs();
			enableTab($(this));
		}
	});

	//mouseover buttons bij artikelen	
	$(".article").not(".related").mouseover(function() {
		$(this).find(".button").addClass("button_o");
	});

	$(".article").not(".related").mouseout(function() {
		$(this).find(".button").removeClass("button_o");
	});

//	$(".maatbtn").click(function() {
//		$(".maatbtn").each(function() { $(this).removeClass("maatbtn_a"); });
//		$(this).addClass("maatbtn_a");
//	});

	if ($("#tab_toggle1").length > 0) {
		disableTabs();
		enableTab($("#tab_toggle1"));
	}

	$("input:radio[name='opdruk']").filter("[value=Nee]").attr("checked", true);
	bindArticleDetailsUI();

});

function toggleOpdrukDetails(state) {
	$("#opdruk_details").css("display", state == true ? "block" : "none");
	$("#opdruk_pricelisting").css("display", state == true ? "block" : "none");
	$("#pricelisting").css("display", state == true ? "none" : "block");
}

function bindArticleDetailsUI() {
	toggleOpdrukDetails($("input:radio[name='opdruk']:checked").val() == "Ja" ? true : false);

	// event: OnChange - Shirt opdruk
	$("input:radio[name='opdruk']").click(function() {
		toggleOpdrukDetails($(this).val() == "Ja" ? true : false);
	});

	// init slider
	if ($("#slider").length > 0) {
		$("#slider").slider({
			min: 1,
			max: 100,
			slide: function(event, ui) {
				$("#slider").find("a").attr("innerHTML", ui.value);
			}
		});
		
		// zet waarde van de slider op de slider-handle
		$("#slider").find("a").attr("innerHTML", $("#slider").slider("value"));
	}
}

function enableTab(o) {
	o.addClass("wtab_a");
	o.find("div").each(function() {
		var n = $(this).attr("class");
		if (n.substring(n.length - 2) != "_a") $(this).addClass(n + "_a");
	});

	// enable toggle
	$("#tabbedbox .bg").each(function() { $(this).css("display", "none"); });
	$("#subnavslider" + o.attr("id").substring(o.attr("id").length - 1)).css("display", "block");
}

function disableTabs() {
	$("#tabbedbox .wtab").each(function() {
		$(this).removeClass("wtab_a");
		$(this).find("div").each(function() {
			var n = $(this).attr("class");
			if (n.substring(n.length - 2) == "_a") $(this).removeClass(n.substring(n.indexOf(" "), n.indexOf("_a")) + "_a");
		});
	});
}

function ShowMailaFriend() {AnimateThis('mailafriend')}

function AnimateThis(id) {
	if(!IE){ //werkt niet in IE ???
		$('#' + id).animate({opacity: 0}, 1).animate({opacity: 1}, 500);
	}
}

function showMessage(id){
	display('item-'+ id +'-ok','item-'+ id)
	setTimeout("display('item-"+ id +"','item-"+ id +"-ok')",3000)
}

function ShowShoppingcart() {
    /*
    $('#shoppingcart').animate({
        opacity: 0
    }, 1);
    $('#shoppingcart').animate({
        opacity: 1
    }, 500);
    */
}

function mOn(obj) {
	var ext = obj.src.slice(-3)
	if(obj.src.indexOf('_o.'+ ext)==-1){
		if(obj.src.indexOf('_a.gif')==-1){
			obj.src=obj.src.replace('.'+ ext,'_o.'+ ext)
		}
	}
}
function mOut(obj) {
	var ext = obj.src.slice(-3)
	obj.src=obj.src.replace('_o.'+ext,'.'+ext)
}

function increaseAmount(textid) {
    if (isNaN($('#' + textid).val())) {
        $('#' + textid).val(1);
    } else {
        if (eval($('#' + textid).val()) < 99) {
            $('#' + textid).val(eval($('#' + textid).val()) + 1);
        }
    }
    return true;
}

function decreaseAmount(textid) {
    if (isNaN($('#' + textid).val())) {
        $('#' + textid).val(1);
    } else {
        if (eval($('#' + textid).val()) > 1) {
            $('#' + textid).val(eval($('#' + textid).val()) - 1);
        }
    }
    return true;
}

function toggleCheckbox(id, show, checked){
	//wanneer undefined, bepaal of checkbox aan of uitgezet moet worden...
	if(checked===undefined){
		if(document.getElementById('check_'+id).src.indexOf('_o.gif')>-1){
			checked = false;
		}else{
			checked = true;
		}
	}
	if(checked){
		$('#'+ id).attr('value','1');
		mOn(document.getElementById('check_'+ id));
		$('#'+ show).css('display','block');
	}else{
		$('#'+ id).attr('value','');
		mOut(document.getElementById('check_'+ id));
		$('#'+ show).css('display','none');
	}
}

function toggleTop(obj, id, arr){
	if(arr!=undefined) {
		var a = arr.split(',')
		for(i=0;i<a.length;i++){
			if(document.getElementById(a[i])) document.getElementById(a[i]).style.display='none'
			$('#'+ a[i]).parent().attr('class','');
		}
	}
	$('#'+ id).css('display', 'block');
	$(obj).parent().attr('class','active');
}

// Versie 1.2 (WdS)
function submitNewsletterForm(inputId,trueCont,falseCont,wrongCont,path) {
	if(isEmail($('#' + inputId).attr('value'))){
    $.ajax({
        type: "POST",
        url: path + "xml/SubscribeNewsletter?mail=" + $('#' + inputId).attr('value'),
        dataType: "html",
				data: "{}",
        success: function(txt) {            
            if (txt.toUpperCase() == 'TRUE') {
								$('#' + wrongCont).css("display", "none");
                $('#' + trueCont).css("display","block");
                $('#' + falseCont).css("display","none");
            }
            else {
								$('#' + wrongCont).css("display", "none");
                $('#' + trueCont).css("display", "none");
                $('#' + falseCont).css("display", "block");                
            }
        }
    });
	}else{
		$('#' + wrongCont).css("display", "block");
		$('#' + trueCont).css("display", "none");
    $('#' + falseCont).css("display", "none");
	}
}

// Versie 1.6 (JS)
function submitNewsletterFormId(inputId, trueCont, falseCont, path, id) {
    $.ajax({
        type: "GET",
        url: path + "xml/SubscribeNewsletterId?mail=" + $('#' + inputId).attr('value') + "&catId="+ id,
        dataType: "html",
        success: function(txt) {
            if (txt.toUpperCase() == 'TRUE') {
                $('#' + trueCont).css("display", "block");
                $('#' + falseCont).css("display", "none");
            }
            else {
                $('#' + trueCont).css("display", "none");
                $('#' + falseCont).css("display", "block");
            }
        }
    });
}

// Versie 1.2 (JS)
function RemoveSingleViewedArticles(path,id) {
		$.get(path + 'xml/RemoveSingleViewedArticles?id='+id);
		$('#viewedarticles-'+id).html('');
}

// Versie 1.2 (JS)
function RemoveViewedArticles(path) {
    $.get(path + 'xml/RemoveViewedArticles');
    $('#viewedarticles').html('');
}

function printing(cmd){
	if(cmd){ //activate printing
		radio('1','radio0','bedrukking');
		$('#cont_printing').css('display','block');
//		$('#containter_pricesum').css('display','block');
		$('#pricelisting').css('display','block');
	}else{ //deactivate printing
		radio('','radio1','bedrukking');
		$('#cont_printing').css('display','none');
//		$('#containter_pricesum').css('display','none');
		$('#pricelisting').css('display','none');
//		initializePricelisting();
		//clear
		fill('printingText','naam,nr',1,'defaultNames');
	}
}

// Versie 1.3 (GPS)
function fill(dest, source, clear, predefined){
	var arr = source.split(',');
	var textToInsert = ''; var currentValue = '';
	if(predefined){
		var predefinedObj = document.getElementById(predefined);
		var predefinedArr = predefinedObj.options[predefinedObj.selectedIndex].value.split(',');
	}
	if(!clear){
		$.each(arr, function(count, item){
			if(textToInsert!='') textToInsert += ', ';
			if(predefined){
				currentValue = predefinedArr[count];
				$('#'+ item).val(predefinedArr[count])
			}else{
				currentValue = $('#'+ item).val()
			}
			textToInsert += $('#'+ item +'title').val() + currentValue.toUpperCase();
		})
	}else{ //restore
		predefinedObj.selectedIndex = 0;
		$.each(arr, function(count, item){
			$('#'+ item).val($('#'+ item +'value').val());
		});
	}
	$('#' + dest).val(textToInsert);
}

// Versie 1.2 (WdS)
function updateArticleDetail(articleId, orgSpec1, orgSpec2, htmlCont, path) {
    var selectedSpec01, selectedSpec02, printing
    if (document.getElementById(orgSpec1)) {
        selectedSpec01 = document.getElementById(orgSpec1).options[document.getElementById(orgSpec1).selectedIndex].value
    } else {
        selectedSpec01 = 0
    }
    if (document.getElementById(orgSpec2)) {
        selectedSpec02 = document.getElementById(orgSpec2).options[document.getElementById(orgSpec2).selectedIndex].value
    } else {
        selectedSpec02 = 0
    }
		if(!printing) printing = 0
    $.ajax({
        type: "POST",
        url: path + 'xml/UpdateArticleDetail?Id=' + articleId + '&spec01Id=' + selectedSpec01 + '&spec02Id=' + selectedSpec02 + '&qty=' + $('#qty-'+ articleId).val(),
        dataType: "html",
		data: "{}",
        success: function(html) {
			document.getElementById(htmlCont).innerHTML = html;
			bindArticleDetailsUI();
        }
	});

	
}

// Versie 1.3.2 (JS)
function updateArticleFromAddToOrder(articleId, orgSpec1, orgSpec2, htmlCont, path) {
    var selectedSpec01, selectedSpec02
    if (document.getElementById(orgSpec1)) {
        selectedSpec01 = document.getElementById(orgSpec1).options[document.getElementById(orgSpec1).selectedIndex].value
    } else {
        selectedSpec01 = 0
    }
    if (document.getElementById(orgSpec2)) {
        selectedSpec02 = document.getElementById(orgSpec2).options[document.getElementById(orgSpec2).selectedIndex].value
    } else {
        selectedSpec02 = 0
    }
    $.ajax({
        type: "POST",
        url: path + 'xml/UpdateArticleDetail?Id=' + articleId + '&spec01Id=' + selectedSpec01 + '&spec02Id=' + selectedSpec02 + '&viewName=ArticleAddToOrder',
        data: {},
        dataType: "html",
        success: function(html) {            
            $('#' + htmlCont).html(html);
        }
    });
}

// Versie 1.3.4 (GPS)
//function AddRelatedArticlesToOrder(path, checkout_url) {
//    try {
//        var error = false;
//				//Haal ook de gegevens op van het huidige product
//				var articleId = $('#articleId').val();
//				var articleSpecId = $('#specId').val();
//				var articleAmount = $('#amount-' + articleId).val();
//				var articlePrintingText = $('#printingText').val();
//
//				$.ajax({
//						type: 'GET',
//						url: path + 'xml/AddToShoppingCart',
//						data: 'articleId=' + articleId + '&amount=' + articleAmount + '&printingText='+ articlePrintingText +'&specId=' + articleSpecId,
//						success: function(html) {
//							document.getElementById('shoppingcart').innerHTML = html;
//						}
//				});
//				//einde ophalen gegevens van het huidige product
//
//				$("[name=addToOrder]").each(function() {
//					if($(this).val()!=''){
//						var tmpStr = $(this).attr('id');
//						var id = tmpStr.substr(tmpStr.indexOf('-') + 1);
//						var specId = $('#specId-' + id).val();
//						var amount = $('#amount-' + id).val();
//						if ($('#spec1-' + id).val() == '0' || $('#spec2-' + id).val() == '0') {
//								//alert('Specificatie is niet ingevuld')
//								error = true;
//						} else {
//								$.ajax({
//										type: 'GET',
//										url: path + 'xml/AddToShoppingCart',
//										data: 'articleId=' + id + '&amount=' + amount + '&printingText=&specId=' + specId,
//										success: function(html) {
//											document.getElementById('shoppingcart').innerHTML = html;
//										}
//								});
//						}
//					}
//				});
//				if (error){
//					$('#item-'+ articleId +'-ok-text').css('display','none');
//					$('#item-'+ articleId +'-ok-error').css('display','block');
//					return false;
//				}
//    } catch (err) {
//        alert("Er is iets foutgegaan. Probeer het opnieuw door deze pagina te herladen. " + err.message);
//    }
//}

// Versie 1.3 (JS)
function AddRelatedArticlesToOrder(path, checkout_url, related, element) {
    try {
        var timeout = 0;
        var error = false;
				var id = 0;
				var tmpStr = '';
				var newCart = '';

				//gegevens van hoofdartikel
				var articleId = $('#articleId').val();
				var articleSpecId = $('#specId').val();
				//var articleAmount = $('#slider').find("a").attr("innerHTML");
				var articleAmount = $('#qty-'+ articleId).val();
				var articlePrintingText = $('#printingText').val();
				if (!articlePrintingText) articlePrintingText = '';

				//check of alle specs ingevuld zijn...
				$("[name=addToOrder]:checked").each(function() {
					tmpStr = $(this).attr('id');
					id = tmpStr.substr(tmpStr.indexOf('_') + 1);
					if ($('#spec1-' + id).val() == '0' || $('#spec2-' + id).val() == '0') {

						$("#item-" + articleId + "-ok-error").css("display", "block");
						//display('item-'+ articleId +'-ok-error','my-content-addedToCart');
						//display('my-content-addedToCart', 'item-' + articleId);
						error = true;
					}
				});

				// Indien geen error, dan alle (eventueel) aangevinkte artikelen aan winkelwagen toevoegen.
				if(!error) {
					hs.htmlExpand(element, { contentId: 'my-content-addedToCart', width: 300, targetX: 'content 11px', targetY: 'content 20px' });

					$("[name=addToOrder]:checked").each(function() {
							tmpStr = $(this).attr('id');
							id = tmpStr.substr(tmpStr.indexOf('_') + 1);
							var specId = $('#specId-' + id).val();
							var amount = $('#amount-' + id).val();
							if ($('#spec1-' + id).val() == '0' || $('#spec2-' + id).val() == '0') {
									error = true;
							} else {
									timeout += 600;
									$.ajax({
											type: 'GET',
											url: path + 'xml/AddToShoppingCart',
											data: 'articleId=' + id + '&amount=' + amount + '&printingText=&specId=' + specId
									});
							}
					});

					//Haal ook de gegevens op van het huidige product
					timeout += 600;
					$.ajax({
							type: 'GET',
							url: path + 'xml/AddToShoppingCart',
							data: 'articleId=' + articleId + '&amount=' + articleAmount + '&printingText='+ articlePrintingText +'&specId=' + articleSpecId,
							success: function(html) {
								document.getElementById('shoppingcart').innerHTML = html;
							}
						});
					
					// einde ophalen gegevens van het huidige product
					hs.htmlExpand(element, { contentId: 'my-content-addedToCart', width: 300, targetX: 'content 11px', targetY: 'content 20px' });
				}
				//setTimeout("display('item-" + articleId + "','my-content-addedToCart')", 2000);
				return false;
    } catch (err) {
        alert("Er is iets foutgegaan. Probeer het opnieuw door deze pagina te herladen. " + err.message);
    }
}


//update amount bij gerelateerd artikel en zet addToOrder bitje aan
//function addToList(id){
//	if(($('#specId-'+ id).val() + '')!='0'){
//		$('#amount-'+ id).val(parseInt($('#amount-'+ id).val()) + 1);
//		$('#addToOrder-'+ id).val('1');
//		$('#error_relatedarticles').html('');
//		$('#related-button-'+ id).css('display','none');
//	}else{
//		$('#error_relatedarticles').html(' - U heeft geen specificatie(s) geselecteerd.');
//	}
//	initializePricelisting();
//}

//toon prijslijst bij detail van artikel
//function initializePricelisting(){
//	var listing = "<table cellpadding=0 cellspacing=0 border0 width=100%>" + 
//								 "<col style='width:120px;' />" + 
//								 "<col />"
//	$('.combi .article').each(
//		function(){
//			var itemId = $(this).find('.relatedId').val();
//			var selected = $('#addToOrder-'+ itemId).val();
//			if(selected){
//				var amount = $('#amount-'+ itemId).val();
//				var price = $('#related-price-'+ itemId).val();
//				price = parseInt(amount) * parseFloat(price.replace(',','.'));
//				var total = $('#totalPrice').val();
//				total = parseFloat(total.replace(',','.'));
//				
//				listing += "<tr><td>"+ amount +"x "+ $('#related-title-'+ itemId).val() +"</td><td>"+ currencySign +" "+ price.toFixed(2)  +"</td></tr>";
//				
//				total = (total + price).toFixed(2);
//				$('#totalPrice').val(total);
//				total = currencySign + ' ' + total;
//				$('#total_price').text(total.replace('.',','));
//				$('#pricelisting').css('display','block');
//			}
//		}
//	);
//	listing += "</table>"
//	$('#extra_lines').html(listing);
//
//}

function expandFlash(bool){
	if(bool){
		$('#container_info').css('display','none');
		$('#container_tellafriend').css('display','none');
		$('#container_image').attr('class','image_wide')
	}else{
		$('#container_image').attr('class','image')
		$('#container_info').css('display','block')
		$('#container_tellafriend').css('display','block');
	}
}

function openBig(url){
	if(url!='') $('#bigimage').attr('href',url);
	document.getElementById('bigimage').onclick();
}

function toggleOrder(id){
	$('#item-'+id).css('display','block');
	$('#line-'+id).css('color','#333333');
	var thisurl = $('#arrow-'+id).attr('src');
	if(thisurl.indexOf('_o.gif')==-1){
		$('#arrow-'+id).attr('src',thisurl.replace('.gif','_o.gif'));
	}
}

//functie voor setten van 1 checkbox, geen komma's in value
//v = waarde true
//w = waarde false
function checkThis(v, w, id, input) {
	var obj = document.getElementById(input);
	if (obj.value.indexOf(v) == -1) {
		obj.value = v;
		document.getElementById(id).src = document.getElementById(id).src.replace('.gif', '_o.gif');
	} else {
		obj.value = w;
		document.getElementById(id).src = document.getElementById(id).src.replace('_o.gif', '.gif');
	}
	
	if (id == "check_newsletter") {
		var selectbox = $(obj).parents("DIV").find("SELECT");
		$(selectbox).attr("title", (obj.value == v ? $(selectbox).attr("id") : ""));
	}
}

function AddRelatedArticleToOrder(path,id) {
	var error = false;
	var spec1 = $('#spec1-' + id).val();
	var spec2 = $('#spec2-' + id).val();
	if (spec1 == '0' || spec2 == '0') {
		//$("#item-" + articleId + "-ok-error").css("display", "block");
		//display('item-'+ articleId +'-ok-error','my-content-addedToCart');
		//display('my-content-addedToCart', 'item-' + articleId);
		alert('error');
		error = true;
	}
	if(!error) {
		var amount = $('#amount-' + id).val();
		$.ajax({
			type: 'GET',
			url: path + 'xml/AddToShoppingCartNoRel',
			data: 'articleId=' + id + '&amount=' + amount + '&printingText=&spec1=' + spec1 + '&spec2=' + spec2,
			success: function(html) {
				window.location.reload(); 
				return true;
			},
			error: function(html) {
				alert('error');
			}
		});
	}
	return false;

}

function AddRelatedArticleToOrder2(path,id,formId) {
	var error = false;
	var spec1 = $('#spec1-' + id).val();
	var spec2 = $('#spec2-' + id).val();
	if (spec1 == '0' || spec2 == '0') {
		//$("#item-" + articleId + "-ok-error").css("display", "block");
		//display('item-'+ articleId +'-ok-error','my-content-addedToCart');
		//display('my-content-addedToCart', 'item-' + articleId);
		alert('error');
		error = true;
	}
	if(!error) {
		var amount = $('#amount-' + id).val();
		$.ajax({
			type: 'GET',
			url: path + 'xml/AddToShoppingCartNoRel',
			data: 'articleId=' + id + '&amount=' + amount + '&printingText=&spec1=' + spec1 + '&spec2=' + spec2,
			success: function(html) {
				$('#shoppingcart').html(html);
			},
			error: function(html) {
				alert('error');
			}
		});
	}

	hs.htmlExpand(document.getElementById(formId), { contentId: 'my-cart-message', width: 300, targetX: 'content 11px', targetY: 'content 20px' });

}


function addToCart(formId, path){

	var t;
	var articleId = $('#'+ formId + ' [name=articleId]').val();
	var articleSpecId = $('#'+ formId + ' [name=specId]').val();
	var articleAmount = $('#'+ formId + ' [name=amount]').val();
	
	$.ajax({
			type: 'GET',
			url: path + 'xml/AddToShoppingCart',
			data: 'articleId=' + articleId + '&amount=' + articleAmount + '&printingText=&specId=' + articleSpecId,
			dataType: "html",
			success: function(html) {
				$('#shoppingcart').html(html);
			}
	});

	hs.htmlExpand(document.getElementById(formId), { contentId: 'my-cart-message', width: 300, targetX: 'content 11px', targetY: 'content 20px' });
}

//Versie 1.5 (WdS)
function UpdateSpecInShoppingcart(articleId,spec1,spec2,htmlCont,path,oldRelId,isCheckout) {
    var selectedSpec01, selectedSpec02
    if (document.getElementById(spec1)) {
        selectedSpec01 = document.getElementById(spec1).options[document.getElementById(spec1).selectedIndex].value
    } else {
        selectedSpec01 = 0
    }
    if (document.getElementById(spec2)) {
        selectedSpec02 = document.getElementById(spec2).options[document.getElementById(spec2).selectedIndex].value
    } else {
        selectedSpec02 = 0
    }

    try {
        $.ajax({
            type: 'GET',
            url: path + 'xml/ChangeSpecs',
            data: 'articleId=' + articleId + '&OldRelId=' + oldRelId + '&spec1=' + selectedSpec01 + '&spec2=' + selectedSpec02 + '&isCheckout=' + isCheckout,
            success: function(html) {
                //alert(html);
                //alert('#' + htmlCont)
                $('#' + htmlCont).html(html);
            }            
        });
    } catch (err) {
    alert("Er is iets foutgegaan. Probeer het opnieuw door deze pagina te herladen. " + err.message);
    }    
}

// Versie 1.7 (JS)
function addCouponCode(val, path) {
	$('#error-coupon').hide();
	$.ajax({
		type: "POST",
		url: path + 'xml/AddCouponCode?typeid=7&code=' + val,
		data: {},
		cache: false,
		dataType: "html",
		success: function(html) {
			if (html == 'True') {
				location.reload(true);
			} else {
				$('#error-coupon').show();
			}
		}
	});
}

// Versie 1.7 (JS)
function removeCouponCode(val, path) {
	$('#error-coupon').hide();
	$.ajax({
		type: "POST",
		url: path + 'xml/RemoveCouponCode?code=' + val,
		data: {},
		cache: false,
		dataType: "html",
		success: function(html) {
			if (html == 'True') {
				location.reload(true);
				
			} else {
				$('#error-coupon').show();
			}
		}
	});
}	

