$(function() {

	// a tag met de class new-window openen in een nieuw venster
	$('a.new-window').click(function() {
	   window.open(this.href);
	   return false;
	});

	// Make any element clickable, linking to the first a href found inside
	$('.clickable').css('cursor', 'pointer').click(function() {
		$(this).find('a[href]').eq(0).each(function() {
			document.location.href=$(this).get(0).href;
		});
		return false;
	});

	// Buttons
	$('a.button').wrapInner('<span>');
	
	$('input#submit').wrapInner('<span>');

	// Submit buttons
	$('a.submit').click(function() {
		$(this).closest('form').submit();
	});

	// Submit with enter key
	$('input').keypress(function(e) {
		if (e.which == 13) {
			$(this).closest('form').submit();
		}
	});

    $('.languageselect').click(function(){
        $('.language_options').slideToggle();
});
	
});

function currency(price){

	price = price.toString().replace(/\$|\,/g,'');
	if(isNaN(price))
	price = "0";
	sign = (price == (price = Math.abs(price)));
	price = Math.floor(price*100+0.50000000001);
	cents = price%100;
	price = Math.floor(price/100).toString();
	if(cents<10)
	cents = "0" + cents;
	
	return ('€ ' +((sign)?'':'-') + price + ',' + cents);
	

};
