var Termek = {
	addCount: [],
	setValuesNull: function(){
		$$(".termek-value-input").each(function(item){
			item.value = "0";
		});
	},
	addToKosar: function (id, template){
		if ( Termek.addCount[id] == null ) {
			Termek.addCount[id] = 0;
		}
		Termek.addCount[id] = parseInt(Termek.addCount[id]) + 1;
		var value = $("termek-value-"+id).value;
		if ( !(value > 0) ) {
			value = 0;
		}
		setTimeout("Termek.addToKosarAjax('"+id+"', '"+value+"', '"+template+"');", 1000);
	},
	addToKosarAjax: function(id, value, template){
		Termek.addCount[id] = parseInt(Termek.addCount[id]) - 1;
		if ( Termek.addCount[id] == 0 ) {
			if ( template == "summary" ) {
				update_div = 'summary-table';
			} else {
				update_div = 'cart-small';
				if ( $('cart-micro').visible() ) {
					update_div = 'cart-micro';
				}
			}
			new Ajax.Updater(update_div, '/index.php/cart/set',{
				asynchronous: true,
				evalScripts: true,
				parameters: {
					id: id,
					value: value,
					template: template
				}
			});
		}
	},
	setValuesFromKosar: function(id, db){
		if ( $("termek-value-"+id) != null ) {
			$("termek-value-"+id).value = db;
		}
	},
	onKepMouseOver: function(id){
		$("termek-kep-border-"+id).style.display = "inline";
	},
	onKepMouseOut: function(id){
		$("termek-kep-border-"+id).style.display = "none";
	}
}
