/**
 * @author: Martes Zibellina ( http://martes-zibellina.com ), mailto:info[@]martes-zibellina.com
 * @copyright: Martes Zibellina ( http://martes-zibellina.com )
 * @mailto: info[@]martes-zibellina.com
 * @version: 1.0.0.0
 */

var INT_PATTERN_ERROR		= 'INT_PATTERN_ERROR';
var FLOAT_PATTERN_ERROR		= 'FLOAT_PATTERN_ERROR';
var CURRENCY_PATTERN_ERROR	= 'CURRENCY_PATTERN_ERROR';

var _intPattern			= /^\d{1,}$/;
var _floatPattern		= /^\d{1,}$/;
var _carrencyPattern	= /^\d{0,9}[\.]{0,1}\d{0,2}$/;

/**
 * @param {String} id
 */
function __validateInt(id)
{
	var item = document.getElementById(id);
	
	if(item == null || item == 'undefined')
	{
		alert(INT_PATTERN_ERROR);
		return false;
	}
	if(item.value == NaN || item.value == null || item.value == '')
	{
		alert(INT_PATTERN_ERROR);
		return false;
	}
	if(!_intPattern.test(item.value))
	{
		alert(INT_PATTERN_ERROR);
		return false;
	}
	else
	{
		return true;
	}
}

function __validateFloat()
{
	
}

function __validateCurrency()
{
	
}

/**
 * @param {String} message
 */
function __confirmAction(message)
{
	return confirm(message);
}
/**
 * @param {String} itemId
 */
function __doItemFolding(itemId){
	var item = document.getElementById(itemId);
	if(item == null || item == 'undefined')
		return;
	if(item.style.display == '' || item.style.display == 'none')
	{
		item.style.display = 'block';
		return;
	}
	item.style.display = 'none';
}
