/* ### AJAX basket ### */

/**
 * 
 * @param string formid ID formularza
 * @param string element ID elementu
 */
function submit_form(formid,element,$close) {
	$(formid).request({
		evalScripts: true,
		onComplete: function(transport) {
			//$(element).innerHTML = transport.responseText;
			get_url('basket.php?action=show_products_in_basket',$(element));
			if ($close) { $('category_window').style.display = "none"; }
		},
		onError : function() { $(element).innerHTML = 'ERROR while loading';	}		
	});
}

/**
 * 
 * @param string path sciezka z ktorej pobraze zostana dane
 * @param string element ID elementu
 */
function get_url(url,element) {
	if(!element) element = 'main_content';
	new Ajax.Updater(element,url,{
		method: 'get',
		evalScripts: true,
		onComplete: function() {},
		onError : function() { $(element).innerHTML = 'ERROR while loading';	}
	});
}

/**
 * 
 * @param string path sciezka z ktorej pobraze zostana dane
 * @param string element ID elementu
 */
function show_products(element,category) {
	new Ajax.Updater(element,'basket.php?action=show_products&category='+category,{
		method: 'get',
		evalScripts: true,
		onComplete: function() { $(element).style.display = "block"; },
		onError : function() { $(element).innerHTML = 'ERROR while loading';	}
	});
}
