function showHise(action) {
	if (!$('#rharchive div.seznami').is('.selected')) {
		$('#rharchive div.seznami').first().addClass('selected');
	}
	
	if (action == 'next') {
		var nextEl = $('#rharchive div.seznami.selected').next().first();
		if (nextEl.length) {
			$('#rharchive div.seznami').each(function() { $(this).hide(); });
			$('#rharchive div.seznami.selected').removeClass('selected');
			nextEl.addClass('selected').fadeIn('slow');
		}
	} else {
		var prevEl = $('#rharchive div.seznami.selected').prev().first();
		if (prevEl.length) {
			$('#rharchive div.seznami').each(function() { $(this).hide(); });
			$('#rharchive div.seznami.selected').removeClass('selected');
			prevEl.addClass('selected').fadeIn('slow');
		}
	}
}

function putInBasketCheck(num, year, price) {
	if ($('#c' + num).attr('checked')) {
		$('#c' + num).attr('checked', false);
	} else {
		$('#c' + num).attr('checked', true);
	}
	
	if ($('#c' + num).attr('checked')) {
		$('#rhorders').append('<div id="div' + num + '">Št. ' + num + '/' + year + ' (' + price + ' EUR) <a href="#" onclick="putInBasketCheck(' + num + ', ' + year + ', ' + price + '); return false;">odstrani</a></div>');
		$('#rhorders').css('borderBottom', '1px solid #000');
		$('#tprice').html(Number($('#tprice').text()) + Number(price));
		$('#img' + num).css('opacity', '0.5');
	} else {
		$('#div' + num).remove();
		$('#tprice').html(Number($('#tprice').text()) - Number(price));
		$('#img' + num).css('opacity', '1');
	}
}

function putInBasket(num, year, price) {
	if ($('#c' + num).attr('checked')) {
		$('#rhorders').append('<div id="div' + num + '">Št. ' + num + '/' + year + ' (' + price + ' EUR) <a href="#" onclick="putInBasketCheck(' + num + ', ' + year + ', ' + price + '); return false;">odstrani</a></div>');
		$('#rhorders').css('borderBottom', '1px solid #000');
		$('#tprice').html(Number($('#tprice').text()) + Number(price));
		$('#img' + num).css('opacity', '0.5');
	} else {
		$('#div' + num).remove();
		$('#tprice').html(Number($('#tprice').text()) - Number(price));
		$('#img' + num).css('opacity', '1');
	}
}

function sendForm() {
	$('input.sendbutton').attr('disabled', 'disabled');
	var dataString = $('#narocilo-starih-stevilk form').serialize();
	dataString = decodeURIComponent(dataString);
	$.ajax({
		type: 'POST',
		url: 'wp-content/themes/grid-a-licious/assets/javascripts/mail.php',
		data: dataString,
		success: function() {
			window.location = 'http://www.revijahise.com';
		}
	});
	
	return false;
}
