function getsign(nb) {
		var x = nb.toString();

		if(x.charAt(0)=='-') return '-';
		else return '+';
	}

function abs(nb) {
	return Math.abs(Math.round(nb));
}

function fl(val) {
	return parseFloat(val.replace(",", "."));
}
	
function isNumber(n) {
	return !isNaN(parseFloat(n)) && isFinite(n);
}

function alertMsg(msg, id) {
	//alert('id : ' + id + ' msg' + msg);
	jQuery("#form-msg").remove();
	jQuery('#'+id).before('<div id="form-msg" class="errormsg mcurved">'+msg+'<\/div>');
	jQuery("#form-msg").fadeOut(4000);
	return true;
}

function thousandSep(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ' ' + '$2');
	}
	return x1 + x2;
}

/**http://www.hashbangcode.com/blog/javascript-round-nearest-5-368.html
*/
function round5(x)
{
    return (x % 5) >= 2.5 ? parseInt(x / 5) * 5 + 5 : parseInt(x / 5) * 5;
}

function roundNearest(num, acc){
    if ( acc < 0 ) {
        num *= acc;
        num = Math.round(num);
        num /= acc;
        return num;
    } else {
        num /= acc;
        num = Math.round(num);
        num *= acc;
        return num;
    }
}
