
function toInt (n) {
	return parseInt(n.toString().replace(/[^0-9\-]/g,''));
}

function toFloat (n) {
	return parseFloat(n.toString().replace(/\,/g,'.').replace(/[^0-9\.\-]/g,''));
}

function puntuar (n) {
	n=toInt(n); if(isNaN(n)) n=0;
	n=n.toString();
	for (var i=0;i<Math.floor((n.length-(1+i))/3);i++)
		n=n.substring(0,n.length-(4*i+3))+'.'+ n.substring(n.length-(4*i+3));
	if (n.substring(0,2)=="-.")
		n="-"+n.substring(2,n.length);
	if (n[0]=='-')
		n="- "+n.substring(1,n.length);
	return n;
}

function safeString (s) {
	return s.toString().replace(/[^a-z0-9 _\-]/gi,'');
}

function get_obj (id) {
	return document.getElementById(id);
}

function get_value (id) {
	return document.getElementById(id).value;
}

function set_value (id,_value) {
	document.getElementById(id).value = _value;
}

function get_class (id) {
	return document.getElementById(id).className;
}

function set_class (id,_class) {
	document.getElementById(id).className = _class;
}

function item_in_array (item,arr) {
	var len=arr.length;
	for (var aux=0; aux<=len; aux++) if (item==arr[aux]) return true;
	return false;
}
