function openImgPopUp(url, image, height, width, path) {
	var imgWnd = window.open(url + "/lib/img_popup.php?image=" + image, "imgWnd", "height="+height+",width="+width+",status=no,menubar=no,resizable=no,directories=no,locationbar=no");
	wnd.focus();
}

function foreGround(item, url) {
	document.getElementById(item + "Lnk").style.color = "#E10915";
	document.getElementById(item + "Lnk").style.backgroundImage = "url(" + url + "/images/tab_on.gif)";
}

function backGround(item, url) {
	document.getElementById(item + "Lnk").style.color = "#343434";
	document.getElementById(item + "Lnk").style.backgroundImage = "url(" + url + "/images/tab.gif)";
}

function zoom(newImage) {
	document.getElementById('mainImg').src = newImage;
}

function addToBasket(item, url) {
	var quantity = document.getElementById("qty_" + item).value;
	if (isNaN(quantity)) {
		alert("A mennyiséget csak számjeggyel adja meg");
	} else {
		window.location.href = url + "/modules/webshop/add_to_basket.php?item=" + item + "&qtty=" + quantity;
	}
}

function filterForBrand(brand, url, category) {
	window.location.href = url + "?category=" + category + "&brand=" + brand;
}

function countChecked() {
	var filled = 0;
	for (i = 0; i < document.forms.compareForm.elements.length; i++) {
		if (document.forms.compareForm.elements[i].checked) {
			filled++;
		}
	}
	return filled;
}

function checkSelectedItems(elementChecked) {
	if (countChecked() > 3) {
		alert("Maximum három termék összehasonlítására van lehetőség");
		document.getElementById(elementChecked).checked = false;
	}
}

function checkCompareForm() {
	if (countChecked() < 2) {
		alert("Az összehasonlításhoz válasszon ki legalább két terméket");
	} else {
		document.forms.compareForm.submit();
	}
}