var ru_eng_chars = new Array();

ru_eng_chars['à'] = 'a';
ru_eng_chars['á'] = 'b';
ru_eng_chars['â'] = 'v';
ru_eng_chars['ã'] = 'g';
ru_eng_chars['ä'] = 'd';
ru_eng_chars['å'] = 'e';
ru_eng_chars['¸'] = 'yo';
ru_eng_chars['æ'] = 'zh';
ru_eng_chars['ç'] = 'z';
ru_eng_chars['è'] = 'i';
ru_eng_chars['é'] = 'y';
ru_eng_chars['ê'] = 'k';
ru_eng_chars['ë'] = 'l';
ru_eng_chars['ì'] = 'm';
ru_eng_chars['í'] = 'n';
ru_eng_chars['î'] = 'o';
ru_eng_chars['ï'] = 'p';
ru_eng_chars['ð'] = 'r';
ru_eng_chars['ñ'] = 's';
ru_eng_chars['ò'] = 't';
ru_eng_chars['ó'] = 'u';
ru_eng_chars['ô'] = 'f';
ru_eng_chars['õ'] = 'h';
ru_eng_chars['ö'] = 'c';
ru_eng_chars['÷'] = 'ch';
ru_eng_chars['ø'] = 'sh';
ru_eng_chars['ù'] = 'sch';
ru_eng_chars['ú'] = 'i';
ru_eng_chars['û'] = 'y';
ru_eng_chars['ü'] = 'i';
ru_eng_chars['ý'] = 'e';
ru_eng_chars['þ'] = 'yu';
ru_eng_chars['ÿ'] = 'ya';

ru_eng_chars['À'] = 'A';
ru_eng_chars['Á'] = 'B';
ru_eng_chars['Â'] = 'V';
ru_eng_chars['Ã'] = 'G';
ru_eng_chars['Ä'] = 'D';
ru_eng_chars['Å'] = 'E';
ru_eng_chars['¨'] = 'Yo';
ru_eng_chars['Æ'] = 'Zh';
ru_eng_chars['Ç'] = 'Z';
ru_eng_chars['È'] = 'I';
ru_eng_chars['É'] = 'Y';
ru_eng_chars['Ê'] = 'K';
ru_eng_chars['Ë'] = 'L';
ru_eng_chars['Ì'] = 'M';
ru_eng_chars['Í'] = 'N';
ru_eng_chars['Î'] = 'O';
ru_eng_chars['Ï'] = 'P';
ru_eng_chars['Ð'] = 'R';
ru_eng_chars['Ñ'] = 'S';
ru_eng_chars['Ò'] = 'T';
ru_eng_chars['Ó'] = 'U';
ru_eng_chars['Ô'] = 'F';
ru_eng_chars['Õ'] = 'H';
ru_eng_chars['Ö'] = 'C';
ru_eng_chars['×'] = 'Ch';
ru_eng_chars['Ø'] = 'Sh';
ru_eng_chars['Ù'] = 'SCH';
ru_eng_chars['Ú'] = 'I';
ru_eng_chars['Û'] = 'Y';
ru_eng_chars['Ü'] = 'I';
ru_eng_chars['Ý'] = 'E';
ru_eng_chars['Þ'] = 'Yu';
ru_eng_chars['ß'] = 'Ya';

function translite_ru_eng(ru_text, cnt) {
	var en_text = "";
	var charEng = "";
	for (var i = 0;i < ru_text.length;i++) {
		charEng = transliteChar(ru_text.substr(i, 1));
		en_text = en_text.substr(0, en_text.length) + charEng;
	}
	if (cnt == 1) {
		return en_text.substr(0, 1);
	} else {
		return en_text;
	}
}

function transliteChar(ru_char) {
	return ru_eng_chars[ru_char] ? ru_eng_chars[ru_char] : ru_char;
}

function rp_f_translit() {
	document.getElementById("person_lname").value = translite_ru_eng(document.getElementById("person_r_lname").value);
	document.getElementById("person_fname").value = translite_ru_eng(document.getElementById("person_r_fname").value);
	document.getElementById("person_ot").value = translite_ru_eng(document.getElementById("person_r_ot").value, 1);
}

function rp_y_translit() {
	document.getElementById("org").value = translite_ru_eng(document.getElementById("org_r").value);
}
