function goSearch() {
	search = document.getElementById('search-form');
	search.submit();
}

function buySong(id) {
	if(confirm("Do you want to place this song in your cart?")) {
		location.href = "/buy/"+id;
	}
}

function buyLoop(id) {
	if(confirm("Do you want to place this loop in your cart?")) {
		location.href = "/buyloop/"+id;
	}
}

function validateForm() {
	if(document.getElementById('user-name').value != "" && document.getElementById('user-email').value != "") {
		document.getElementById('register-form').submit();
	}
	else {
		alert("Kontrollera att namn och e-post är ifyllt korrekt.");
	}
}

$(document).ready(function() {
	$('#u-location').change(function() {
		var vat = $(this).val();
		
		if(vat == 1) {
			$('.input_price').each(
				function( intIndex ){
					itemid = $(this).attr("name");
					itemid = itemid.substr(15,itemid.length-15);

					price = parseFloat($(this).val());
					price = price+(price*0.06);
					
					$(this).val(price);
				}
			);
			$('.input_vat').val('6.00');
		}
		else {
			$('.input_price').each(
				function( intIndex ){
					itemid = $(this).attr("name");
					itemid = itemid.substr(15,itemid.length-15);
					
					$(this).val($("#org_"+itemid).val());
				}
			);
			$('.input_vat').val('0.00');
		}
	});
});
