function setPrice(sPrice, sColor, sID)
{
    var cena = document.getElementById('price');
    var kolor = document.getElementById('kolor');
    cena.innerHTML = sPrice;
    kolor.style.backgroundColor = sColor;
    
    document.forms.order.product.value = sID;            
}

function showItem( sID, bVal )
{
	tbody = document.getElementById(sID);
	if( bVal )
	{
		tbody.style.display = '';
	}
	else {
		tbody.style.display = 'none';
	}
}

function sendForm(contentElementID, formID, URL) 
{
	req = new Ajax.Request(URL, {
		 method: 'post',
		 parameters: $(formID).serialize(true),
		 onSuccess: function(transport) {
			 $(contentElementID).innerHTML = transport.responseText;
		}
	});

}

var formsParams = {
	kontaktform: {
		ajaxLoaderId: 'searchloader',
		ajaxOnLoad: function() {
			var formid = false;
			if( this.getElementsByTagName('form').length && this.getElementsByTagName('form')[0].id )
				formid = this.getElementsByTagName('form')[0].id;
			if(formid)
				initForm(formid, formid);
		},
		ajaxFormClass: 'ajax',
		ajaxTargetClass: 'ajaxtarget'
	}
}

function initForm(containerId, paramsBlock) {
	var cont = $(containerId);
	if (cont) {
		if (formsParams[paramsBlock]) {
			FSite2.extendForm(cont, formsParams[paramsBlock] );
			if (typeof formsParams[paramsBlock]['formInit'] == 'function')
				formsParams[paramsBlock].formInit();
		}
		cont.style.display = '';
		if ($('searchloader')) $('searchloader').style.display='none';
		setTimeout(FSite2._callRef(function(cont){cont.style.visibility = '';},cont),100);
	}
}

function initForms() {
	for (containerId in formsParams)
		initForm(containerId, containerId);
}


window.onload = initForms;
