$(function() {
	/* HTML5 jQuery fix (placeholder attribute)
	 *
	 * Gebruik: <input type="text" placeholder="De standaardwaarde" />
	 */
	$('input[placeholder]').each(function() {
		if( $(this).val() == '' ) $(this).addClass('value-placeholder').val($(this).attr('placeholder')); // Leeg veld? Dan zetten we de placeholder waarde erin
		
		$(this).bind('focus click drop dragend paste mouseup', function() { // Wanneer we iets in het veld typen, erin klikken of iets erin slepen, kijken we of de placeholder weg kan
			if( $(this).val() == $(this).attr('placeholder') ) { // De standaardwaarde staat erin; veld leegmaken en class verwijderen
				$(this).removeClass('value-placeholder').val('');
			}
		});
		
		$(this).bind('blur', function() { // Placeholder herstellen, zodra 't veld de focus verliest
			if( $(this).val() == '' ) { // Lege waarde? Dan zetten we de standaardwaarde weer terug
				$(this).addClass('value-placeholder').val($(this).attr('placeholder'));
			}
		});
	});
	
	$('form').bind('submit', function() {return cleanup(this);});
	$('#product-info').find('br').replaceWith('<p>'); // TODO: Fixen in de Catalogger-import, zodat we geen <br /> maar <p> gebruiken
	$('div.product').bind('mouseover', function() { $(this).addClass('product-hover'); })
	$('div.product').bind('mouseout', function() { $(this).removeClass('product-hover'); })
	$('div.donker').bind('mouseover', function() { $(this).addClass('product-donker-hover'); })
	$('div.donker').bind('mouseout', function() { $(this).removeClass('product-donker-hover'); })
});

function cleanup(el) {
	$(el).find('[placeholder]').each(function() {
		if( $(this).val() == $(this).attr('placeholder') ) $(this).val('');
	});

	return true;
}


