$(document).ready(function() {

	$('.jq_colorize').each(function(ev) {
		$(this).find('tr').not(':first').hover(
			function(ev) {
				$(this).addClass('table_hover');
			},
			function(ev) {
				$(this).removeClass('table_hover');
			}
		);
	});
	
	$('.small_box').hover(
		function() {
			$(this).addClass('hover');
		},
		function() {
			$(this).removeClass('hover');
		}
	).bind('click', function(ev) {
		var url = $(this).find('a').attr('href');
		if(url) {
			window.location = url;
		}
	});
	
	
	if($('#jq_cart_ref').length) {
		$('#jq_cart_ref').bind('keyup', function(ev) {
			if($(this).val().length > 0) {
				$('#jq_cart_submit')
					.removeAttr('disabled');
				
			} else {
				$('#jq_cart_submit')
					.attr('disabled', 'disabled');
				
			}
		});
		
		$('#jq_cart_submit').attr('disabled', 'disabled');
		
	
		$("#jq_cart_form").bind("submit", function() { 
			if(!confirm("Er du sikker på at du vil sende inn din ordre?")) {
				return false;
			}
		})
	}
	
	// autosize product_boxes
	
	$focus = $('.setfocus:first');
	
	if($focus.length) {
		$focus.focus();
	}
		
});

window.onload = function() {
	var h = 0;
	
	
		$('.product_box')
		.each(function() {
			if($(this).height() > h) {
				h = $(this).height();
			}
		})
		.css('height', h+'px');

}