function bestelArtikel(artikelNummer,aantal){
	var url="http://" + window.location.hostname + "/ds_handlers/bestelartikel.php";
	var jSonRequest = new Json.Remote(url,
						{onComplete: mandje}
					);
	jSonRequest.setHeader('Content-type', 'application/x-www-form-urlencoded');
	jSonRequest.send({'artikelnummer':artikelNummer,'aantal':aantal});
}

Custom.BestelAlert = new Class({
		
	options: {
		height: '100px',
		width: '300px',
		buttonText: 'OK',
		opacify: true,
		alertbox: null,
		alerthead: null,
		alertbody: null,
		autoclosetime: 0
	},

	initialize: function(title, text, options) {
		this.title = title;
		this.text = text;
		this.setOptions(options);
		this.alertbox = new Element('div', {
			'id': 'customAlert',
			'styles': {
				'position': 'fixed',
				'top': '50%',
				'left': '50%',
				'z-index': 1000,
				'height': this.options.height,
				'width': this.options.width
			}
		});
		this.overlay = new Element('div', {
			'id': 'customAlertOverlay',
			'styles': {
				'position': 'absolute',
				'top': '0px',
				'left': '0px',
				'width': '100%',
				'height': window.getScrollHeight(),
				'background-image':'url(g.gif)',
				'z-index': 900
			}
		});
		this.mechanize();
		this.fx = new Fx.Style(this.alertbox, 'opacity', {duration:500});
		if(this.options.initialize) this.options.initialize.call(this);
	},
	
	/*
	Method: create
	Description:  creates the custom alert box
	[Example]  
		> var ca = new Custom.Alert('custom alert', 'You cannot access at this page', 
		> {alertbox:'cabox', alerthead: 'cahead', alertbody: 'cabody'});
		> 
		> ca.create();
	[/Example]
	*/
	create: function() {
		this.customize();
		if(this.options.autoclosetime>0){
			if(this.options.opacify){
				this.opacify.delay(this.options.autoclosetime,this);
			} else {
				this.remove.delay(this.options.autoclosetime,this);
			}
		}
	},
	
	mechanize: function() {
		if(this.options['alertbox']) this.alertbox.addClass(this.options['alertbox']);

		this.alertbox.setStyles({
			'margin-left': - this.alertbox.getStyle('width').toInt()/2,
			'margin-top': - this.alertbox.getStyle('height').toInt()/2
		});
		
		this.head = new Element('div').injectInside(this.alertbox);
		if(this.options.alerthead) this.head.addClass(this.options['alerthead']);
		this.head.appendText(this.title);
		
		this.content = new Element('div').injectInside(this.alertbox);
		if(this.options.alerthead) this.content.addClass(this.options['alertbody']);
		this.content.appendText(this.text);
	
		this.closebox = new Element('div').injectInside(this.alertbox);
		this.closebox.setProperty('align', 'center');
	
		this.button = new Element('a').injectInside(this.closebox);
		this.button.setProperty('href', '#');
		this.button.appendText(this.options.buttonText);
		this.button.addEvent('click', function(event) {
			var event = new Event(event).preventDefault();
		});
		if(this.options.opacify)  this.button.addEvent('click', this.opacify.bind(this));
		else this.button.addEvent('click', this.remove.bind(this));
	},
	
	customize: function() {
		if($('customAlert'))  return;
		
		this.alertbox.injectInside(this.overlay);
		this.overlay.injectInside($E('body'));
		
		if(this.options.opacify) this.alertbox.setStyle('opacity', 0);
		this.fx.start(1);
	},
	
	opacify: function() {
		if($('customAlert')){
			this.fx.start(0).chain(function() {
				this.alertbox.remove();
				this.overlay.remove();
			}.bind(this));
		}
	},
	
	remove: function() {
		if($('customAlert')){
			this.alertbox.remove();
			this.overlay.remove();
		}
	},
	
	/*
	Method: setText
	Description:  set the text of the custom alert
	[Example]  
		> // change the previous text
		> ca.setText('Custom Alert with some new text');
	[/Example]
	*/
	setText: function(text) {
		this.content.setHTML(text);
		return this;
	},
	
	/*
	Method: setTitle
	Description:  set the title of the custom alert
	[Example]  
		> // change the previous title
		> ca.setTitle('A new Custom Alert');
	[/Example]
	*/
	setTitle: function(title) {
		this.title = title;	
		return this;
	}
});

Custom.BestelAlert.implement(new Options);
