//tag cutocompleter helper


var allowedChars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-+тащи@.';
var submitChars = ', ;';

function tagCheckChars(e, callBack){
	var c = String.fromCharCode(e.which);
	if(e.which == 13 || submitChars.indexOf(c) >= 0 ) {
		callBack();
		e.preventDefault();
		return false;
	} 
	
	if(e.which != 0 && e.which != 8 && allowedChars.indexOf(c) < 0){
		e.preventDefault();
		return false;
	}
}

//Format a single suggested tag
function formatItem(row) {
	lastSelected = -1;
	return "<i>" + row + "</i>";
}

function array_contains(array, el) {
	for(i=0; i < array.length; i++) {
		if(array[i] == el) {
			return true;
		}
	}
	return false;
}

