

$(document).ready(function(){

/*	-------------------------------------------
	HIDE BR BEFORE MODULES / KILL EMPTY ARTICLES
	----------------------------------------- */
	
	$(".module_contents").each(function(){
		if($(this).prev('br').length == 1){
			$(this).prev('br').remove();
		}
	});
	$(".article,.title").each(function(){
		if(!$.trim($(this).text()) && !$(this).find('img,object,embed,form,input,frame,.sIFR-replaced').length){
			$(this).remove();
		}
	});

/*	-------------------------------------------
	CHANGE SHOP LISTING
	----------------------------------------- */
	
	$(".store_module .listing div.article").hover(
		function(){
			$(this).addClass('hover');
		},
		function(){
			$(this).removeClass('hover');
		}		
	);

/*	-------------------------------------------
	SHOP SPEC MENU
	----------------------------------------- */
	$(".store_module .listing .spec_group_menu select").change(function(){
		this.form.submit();
	});
	
	/*	-------------------------------------------
	ORDER BUTTON
	----------------------------------------- */
	$(".store_module div.ui .submit").mousedown(function(){
		o = $(this).parents('.ui').find('.input');
		if(!o.val()){
			o.val(1);
		}
	});
	if($('.store_module .listing').length){
		v = $('.store_module .listing form:eq(1) input.submit:eq(0)').val();
		$('.store_module .listing form:eq(1) input.submit').remove();
		f = $('.store_module .listing form:eq(1)');
		f.attr('action','/winkelmand').append('<input style="float:right;" class="dynBut" type="submit" value="' +v+ '" />');	

	}

	$('.store_shoppingcart_module.shoppingcart	table.item_list tr.item_spacer td br').remove();

/*	-------------------------------------------
	DYNAMIC MENU
	----------------------------------------- */
	$('#menu ul li:first ul').css('margin-left', '5px');
	$("#menu > ul > li").mouseover(
		function(){
			if(!$(this).hasClass('current_buttonID') && !$(this).parents('li:last').hasClass('current_buttonID')){
				i = $(this).children('ul:eq(0)');
				if(i.is(":hidden")){
					i.show();
				}
				$('#menu > ul > li.current_buttonID').addClass('off');
				$('#menu ul li.current_buttonID ul').hide();
			}
		}
	);
	$("#menu > ul > li").mouseout(
		function(){
			if(!$(this).hasClass('current_buttonID') && !$(this).parents('li:last').hasClass('current_buttonID')){
				i = $(this).children('ul:eq(0)');
				if(i.is(":visible")){
					i.hide();
				}
				$('#menu > ul > li.current_buttonID').removeClass('off');
				$('#menu ul li.current_buttonID ul').show();
			}
		}
	);
	$('#menu ul ul li.current_buttonID').parents('li').addClass('current_buttonID').find('a:first').addClass('current_buttonID');
	$('#menu ul li.current_buttonID ul').show();

});

