$(document).ready(function(){
	var opdrachtnummer = 0;
	$('td span.mbOpdrachtNr').addClass('clickable').click(function() {
//		if ($(this).text() == 'Details') {
//			$(this).text('Verberg');
			opdrachtnummer = $(this).text()
			$('#detBestelling').empty();
			$.post('ajax.asp', {
				'a': 'showBestelling',
				'inOrder': $(this).prev().val(),
				'opdrachNr': opdrachtnummer,
				'totaal': $(this).next().val()
			}, function(data) {
				$('#detBestelling').html('Details Opdrachtnummer: <span style="color:#ff9933;">' + opdrachtnummer + '</span>:<br />' + data);
			});
//		} else {
//			$(this).text('Details');
//			$('#detBestelling').empty();
//		}
	});
	
	$('span.mbHover').hover(function() {
		switch($.trim($(this).text())) {
			case 'In behandeling':
				break;
			case 'Wacht op verzending':
				$(this).next().text('Uw bestelling staat klaar om verzonden te worden!');
				break;
			case 'Onbekend':
				$(this).next().text('Geen verder gegevens beschikbaar van uw bestelling!');
				break;
			case 'Afgewerkt':
				if ($(this).children().last().val() == 'trace') {
					$(this).next().text('Track & Trace uw bestelling!');
				} else {
					$(this).next().text('Voor deze bestelling is geen Track & Trace informatie beschikbaar!');
				}
				break;
		}
		$(this).next().addClass('mbShowInformation mbSIPosition1');
	},function() {
		$(this).next().empty();
		$(this).next().removeClass('mbShowInformation mbSIPosition1');
	});
	
	$('span.mbOpdrachtNr').hover(function() {
		$(this).next().next().text('Klik hier voor details van uw opdracht.')
		$(this).next().next().addClass('mbShowInformation mbSIPosition2');
	},function() {
		$(this).next().next().empty();
		$(this).next().next().removeClass('mbShowInformation mbSIPosition2');								  
	});
	
//	$('span.mbSoortBestelling').hover(function() {
//		$(this).next().text('Deze bestellings is afgewerkt. U kunt eventueel bij \'Mijn Facturen\' uw factuur bekijken en downloaden.')
//		$(this).next().addClass('mbShowInformation mbSIPosition2');									   
//   },function() {
//		$(this).next().empty();
//		$(this).next().removeClass('mbShowInformation mbSIPosition2'); 
//   });
});
