function int(str){
    return ( parseInt(str) || 0 );
}

function inf_msg(str){
	$.gritter.add({
		title: 'Notice',
		text: str,
		image: ROOT_URL + '/img/interface/info.png'
	});	 
}
function err_msg(str){
	$.gritter.add({
		title: 'Error!',
		text: str,
		image: ROOT_URL + '/img/interface/error.png'
	});	 	
}

function strcut(str, str_max_len){
    str_max_len || (str_max_len=32);
    var dots = '\u2026';
    if (str_max_len<=dots.length) return str.length>str_max_len?str.substring(0, str_max_len):str;
    var str_max_left = Math.floor((str_max_len-dots.length)/2);
    var str_max_right = str_max_len - str_max_left - dots.length;
    if (str.length>str_max_len) str = str.substring(0, str_max_left) + dots + str.substring(str.length-str_max_right, str.length);
    return str;
}

function debug_log(str){
	if(DEBUG)
	{
		if(typeof(console)!='undefined' && typeof(console.log) == 'function'){
			console.log(str);
		}
	}
}
