function add_to_cart (id,formname,webshopid) {
	str=getPostBody(formname);
//	alert(formname);
//	alert(str);
	var opts = {
			method: 'post',
			postBody:'action=add&'+str+'&id='+id+'&webshop_id='+webshopid,
			onSuccess: function(t){
					display_small();
					alert("A termék a kosárba került!");
				}
			}
		new Ajax.Request(getAjaxIndexDir()+'cart_ajax.php', opts);	
		var formElements = getObjfromIdorObj(formname).elements;
		for (key = 0; key < formElements.length; key++) {
			switch (formElements[key].name) {
				case "comment":
					formElements[key].value="Megjegyzés";
				break;
				case "amount":
					formElements[key].value="1";
				break;
			}
		}


		return false;

}

function display_small()
{
	var opts = {
	method: 'post',
	postBody:'action=display&cart_type=smallx',
	onSuccess: function(t) {
	},
	on404: function(t) {
		alert('Error 404: location "' + t.statusText + '" was not found.');
	},
	onFailure: function(t) {
		alert('Error ' + t.status + ' -- ' + t.statusText);
	}
	}
	new Ajax.Updater('shopping_cart_area', getAjaxIndexDir()+'cart_ajax.php', opts);
	bigcart_refresh();
	return false;
}

function bigcart_refresh(){
	if (document.getElementById('shopping_cart_big_area'))
	{
		document.getElementById('shopping_cart_big_area').innerHtml="";
			var opts2 = {
	method: 'post',
	postBody:'action=display&cart_type=big',
	onSuccess: function(t) {
	},
	on404: function(t) {
		alert('Error 404: location "' + t.statusText + '" was not found.');
	},
	onFailure: function(t) {
		alert('Error ' + t.status + ' -- ' + t.statusText);
	}
	}
		
		new Ajax.Updater('shopping_cart_big_area', getAjaxIndexDir()+'cart_ajax.php', opts2);
	
	}
	

}



function del_from_cart (id) {
	var opts = {
			method: 'post',
			parameters:'action=del&id='+id,
			onSuccess: display_small
			}
		new Ajax.Request(getAjaxIndexDir()+'cart_ajax.php', opts);	
		return false;

}

function del_from_cart_option (id,linkpre) {
	var opts = {
			method: 'post',
			parameters:'action=del_option&id='+id,//+'&indexlink_prefix_base64='+linkpre,
			onSuccess: display_small
			}
		new Ajax.Request(getAjaxIndexDir()+'cart_ajax.php', opts);	
		return false;

}


