	function startLoading(mainAreaInternal, mainAreaLoading) {
	  Element.show(mainAreaLoading);
	  Element.hide(mainAreaInternal);
	}
	function finishLoading(mainAreaInternal, mainAreaLoading) {
	  Element.show(mainAreaInternal);
	  setTimeout("Effect.toggle('"+mainAreaLoading+"');", 1000);
	}

	function loadContent(id, mainAreaInternal, mainAreaLoading, module, template) {
	  new Ajax.Updater(mainAreaInternal, '/modules/'+ module +'.php', {method: 'post', postBody:'doc='+ id +'&tpl='+ template +''},
	   function() {
			Cufon.replace('h1', { fontFamily: 'Helvetica' }); 
			Cufon.replace('h1.title', { fontFamily: 'Helvetica' }); 
			Cufon.refresh;
	   }
	  
	  );
	  
	}

	function loadContentEffect(id, mainAreaInternal, mainAreaLoading, module, template) {
	  startLoading(mainAreaInternal, mainAreaLoading);
	  new Ajax.Updater(mainAreaInternal, '/modules/'+ module +'.php', {method: 'post', postBody:'doc='+ id +'&tpl='+ template +''});
	  finishLoading(mainAreaInternal, mainAreaLoading);
	}

	function switchRollerButton(buttonsArray, buttonPrefix, button, buttonClassName) {
		buttonON = buttonPrefix+button;
		for (var i = 0; i < buttonsArray.length; i++) {	
			document.getElementById(buttonsArray[i]).className=buttonClassName+(i+1)+'_off';
		}
		document.getElementById(buttonON).className=buttonClassName+button+'_on';
	}

	function switchRollerButtonPlus(buttonsArray, buttonPrefix, button) {
		buttonON = buttonPrefix+button;
		for (var i = 0; i < buttonsArray.length; i++) {	
			document.getElementById(buttonPrefix+buttonsArray[i]).className='off';
		}
		document.getElementById(buttonON).className='on';
	}


	function nextArrElem(myArray, buttonPrefix, valueAktElem) {
		var indexAktElem=myArray.indexOf(buttonPrefix+valueAktElem);
		if (indexAktElem < myArray.length-1)
			valueNextElem= myArray[indexAktElem+1]
		else
			valueNextElem= myArray[0]
		arrIDs=valueNextElem.split('_');
		return(arrIDs[1])	
	}

	function prevArrElem(myArray, buttonPrefix, valueAktElem) {
		var indexAktElem=myArray.indexOf(buttonPrefix+valueAktElem);
		if (indexAktElem > 0)
			//return myArray[indexAktElem-1]
			valuePrevElem= myArray[indexAktElem-1]
		else
			valuePrevElem= myArray[myArray.length-1]
		
		arrIDs=valuePrevElem.split('_');
		return(arrIDs[1])	
	}
	
	function chContent(itemID, blokInternal, blokLoading, module, tpl, arr, buttonPrefix, buttonClassName) {
		loadContent(itemID, blokInternal, blokLoading, module, tpl); 
		switchRollerButton(arr, buttonPrefix, itemID, buttonClassName); 
	}
	
	function chContentPlus(itemID, blokInternal, blokLoading, module, tpl, arr, buttonPrefix, arrowNextID, arrowPrevID) {
		loadContent(itemID, blokInternal, blokLoading, module, tpl); 
		switchRollerButtonPlus(arr, buttonPrefix, itemID); 
		//prev=prevArrElem(arr, buttonPrefix, itemID);		
		//next=nextArrElem(arr, buttonPrefix, itemID); 
		//document.getElementById(arrowPrevID).onclick=function(){ chContentPlus(prev, blokInternal, blokLoading, module, tpl, arr, buttonPrefix, arrowNextID, arrowPrevID)};
		//document.getElementById(arrowNextID).onclick=function(){ chContentPlus(next, blokInternal, blokLoading, module, tpl, arr, buttonPrefix, arrowNextID, arrowPrevID)};
	}




	function reloadSelectPotrawy(id) {
		//alert(id);	
	  	new Ajax.Updater('userPotrawy', '/modules/calc/ajax_getPotrawy4Select.php', {method: 'post', postBody:'cid='+ id +''});
		
	}
	function getJednostkaPotrawy(id) {
		//alert(id);	
	  	new Ajax.Updater('potrawaJednostka', '/modules/calc/ajax_getJednostkaPotrawy.php', {method: 'post', postBody:'pid='+ id +''});
		
	}


	function addPotrawa(id, ilosc, blok, tpl) {
		//alert(id);	
	  	new Ajax.Updater(blok, '/modules/calc/ajax_addPotrawa.php', {method: 'post', postBody:'pid='+ id +'&ilosc='+ilosc+'&tpl='+tpl+''});
		
	}
	function delPotrawa(id, blok, tpl) {
		//alert(id);	
	  	new Ajax.Updater(blok, '/modules/calc/ajax_delPotrawa.php', {method: 'post', postBody:'pid='+ id +'&tpl='+tpl+''});
		
	}

	function setZapotrzebowanie(wiek, waga, wzrost, plec, aktywnosc) {
		//alert(id);	
	  	new Ajax.Updater('null', '/modules/calc/ajax_setZapotrzebowanie.php', {method: 'post', postBody:'wiek='+ wiek +'&waga='+waga+'&wzrost='+wzrost+'&plec='+plec+'&aktywnosc='+aktywnosc+''});
		
	}

	function getFishGallery(blok, from) {
		Element.hide(blok);
	  	new Ajax.Updater(blok, '/modules/fishes/ajax_getItems.php', {method: 'post', postBody:'from='+ from +''});
		Element.show(blok);
	}

	function getFishGalleryFull(blok) {
		Element.hide(blok);
	  	new Ajax.Updater(blok, '/modules/fishes/ajax_getAllItems.php');
		Element.show(blok);
		setFGS();
		setFGS();
		setFGS();
		setFGS();
		setFGS();
		setFGS();
		setFGS();setFGS();
		setFGS();
		setFGS();
		setFGS();
		
	}


	function getZajawka(blok, id, pos) {
		Element.hide(blok);
		new Ajax.Updater(blok, '/modules/zajawki/ajax_getItem.php', {method: 'post', postBody:'akt='+ id +'&pos='+ pos +''});
		Element.show(blok);
	}

