function changeProductCode(c, x, n){
	var d = $('#productCodeSource').text();
	$('#productCode').text(d+''+c);
	$('#productCodeInForm').val(c);
	
	$('#productCountSelect').html("<option selected='selected'>1</option>");
	for (i=2; i<=n; i++) $('#productCountSelect').append("<option>"+i+"</option>")

	
	$("a[id^='dydA_']").css("background","#FFFFFF");
	$("#dydA_"+x).css("background","#DBE1E5");
}

function catView(c){
	el = document.getElementById("leftMenuCat"+c);
	if (el.style.display=='none') el.style.display='block'; else el.style.display='none';
}

function changeIMG(i){
	$("#mainPhoto :img").attr("src", "get.php?i."+i+":w.350:h.350");
	$("#mainPhoto :a").attr("href", "get.php?i."+i+":w.1500:h.1500");
}

function validPhone(){
	x = $('#phone_number').val();
	if (x == '') return false;
	if (x == '+370-000-00000') return false;
	var n = x.replace(/[^\d]/g,'');
	var p = "+" + n.substring(0,3) + "-" + n.substring(3, 6) + "-" + n.substring(6);
	if (x == p) return true;
	return false;
}

function addToNewsletter(){
	e = $('#newsLetterEmail').val();
	$.post('ajax.php', {action:"addToNewsletter", email:e}, function(data){
		alert(data);
	});
}

function removeNewsletter(){
	e = $('#newsLetterEmailRemove').val();
	$.post('ajax.php', {action:"removeNewsletter", email:e}, function(data){
		alert(data);
	});
}
