

	/*
	* File: common.js
	* Author: Alex Baskov, Devtrix, 2008.
	*/


	////
	// changes style class of the object (i.e. class="newClass")
	//
	function changeClass(obj, newClass)
	{
		//alert(newClass);
		if (obj != null && newClass != null)
		{
			obj.className = newClass;
		}

		return true;
	} // /changeClass()



	////
	// shows/hides element depending on its state
	//
	function toggleElm(elmID)
	{
		var elm = document.getElementById(elmID);
		
		if (!elm || elm == null) return false;
		
		if (elm.style.display == "none")
		{
			elm.style.display = "block";
		}
		else
		{
			elm.style.display = "none";
		}
		
		return true;
	} // toggleElm()



	/////
	// displays nice format :)
	//
	function formatAsMoney(mnt)
	{
		mnt = parseFloat(mnt);
		mnt = (Math.round(mnt*100))/100;

		if(mnt == Math.floor(mnt))
		{
			retVal = mnt + '.00'
		}
		else
		{
			retVal = (mnt*10 == Math.floor(mnt*10)) ? mnt + '0' : mnt;
		}

		return retVal;
	} // /formatAsMoney()