/*	unicode.js
	copyleft Thomas Baspeyras 2004-2005

index :
	String.prototype.hasKanji()
	String.prototype.hasKana()
	String.prototype.kanjiAt(index)
	String.prototype.kanaAt(index)
*/

String.prototype.hasKanji = function() {
/*	true if some characters are in CJK Unified Ideographs Unicode range
	vrai si des caractères sont dans l'interval Unicode CJK Idéographes Unifiés
*/
	for (var i = 0; i < this.length; i++) if (this.charCodeAt(i) >= 0x4E00) if (this.charCodeAt(i) <= 0x9FFF) return true;
	return false;
}

String.prototype.hasKana = function() {
/*	true if some characters are in Hiragana or Katakana Unicode range
	vrai si des caractères sont dans l'interval Unicode Hiragana ou Katakana
*/
	for (var i = 0; i < this.length; i++) if (this.charCodeAt(i) >= 0x3040) if (this.charCodeAt(i) <= 0x30FF) return true;
	return false;
}

String.prototype.kanjiAt = function(index) {
/*	true if character at index is in CJK Unified Ideographs Unicode range
	vrai si le caractère à index est dans l'interval Unicode CJK Idéographes Unifiés
*/
	if (this.charCodeAt(index) >= 0x4E00) if (this.charCodeAt(index) <= 0x9FFF) return true;
	return false;
}

String.prototype.kanaAt = function(index) {
/*	true if character at index is in Hiragana or Katakana Unicode range
	vrai si le caractère à index est dans l'interval Unicode Hiragana ou Katakana
*/
	if (this.charCodeAt(index) >= 0x3040) if (this.charCodeAt(index) <= 0x30FF) return true;
	return false;
}
