// JavaScript Document

function display(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'
		}
	}
	if(id!=''){
		if(document.getElementById(id)){
			var obj = document.getElementById(id).style
			if(obj.display=='none'){
				obj.display='block'
			}
		}
	}
	return false
}

//functie voor setten van checkboxen
function check(v,id,input) {
	var obj = document.getElementById(input)
	var rest
	if(obj.value.indexOf(','+v+',')==-1){
		if(obj.value==''){
			obj.value=','
		}
		if(obj.value!=''){
			obj.value=obj.value+v+',';
		}
		document.getElementById(id).src = document.getElementById(id).src.replace('.gif','_o.gif')
	}else{
		obj.value = obj.value.replace(','+v+',',',')
		if(obj.value.length==1) obj.value=''
		document.getElementById(id).src = document.getElementById(id).src.replace('_o.gif','.gif')
	}
}

// Versie 1.7 (JS)
function addCouponCode(val, path) {
	$('#error-coupon').hide();
	$.ajax({
		type: "POST",
		url: path + 'xml/AddCouponCode?typeid=11&code=' + val,
		data: {},
		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: {},
		dataType: "html",
		success: function(html) {
			if (html == 'True') {
				location.reload(true);
				
			} else {
				$('#error-coupon').show();
			}
		}
	});
}	
