// macoskeys.js

myTibetan = new Tibetan();
		myTibetan.__nameOfInstance__ = "myTibetan";
		
		function initialize() {
			// put in the select Tibetan box
			   // var t = myTibetan.getSelectTibetan();
			   // document.getElementById("mySelect").innerHTML = t;
			myTibetan.getTibetanNodes();
		};
				
		function IEsetLangAttributes() {
			if (isIE) {
				var bo = getElementsByAttributeValue("lang","bo");
				for (var i=0; i<bo.length; i++) {
					bo[i].style.fontFamily = '"Xenotype Tibetan","Microsoft Himalaya","Tibetan Machine Uni"';
					bo[i].style.lineHeight = "1.25em";
					bo[i].style.fontSize = "2em";
					// below CSS specifically works in IE
					// bo[i].style.textAlign = "justify";
					// bo[i].style.textJustify = "newspaper";
					// abnormal tags:
					// these get converted to UPPERCASE!
					if (bo[i].tagName == "H1") {
						bo[i].style.fontSize = "2.5em";
					};
					if (bo[i].tagName == "H1" || bo[i].tagName == "H2") {
						bo[i].style.textAlign = "center";
					};
				};
			};
		};		

		function addWbrTags() {
			myTibetan.toBreakingTsheg();
		};
		
		
		function OldshowLanguages(sValue) {
			var allPs = document.getElementsByTagName("*");
			// first turn them all off
			for (var z=0;z<allPs.length;z++) {
					if (allPs[z].getAttribute("lang") == "bo" ||
						allPs[z].getAttribute("lang") == "en") {
						allPs[z].style.display = "none";
					};
				};
			// turn on just those tags I want
			var arrValue = sValue.split(",");
			for (var i=0; i<arrValue.length;i++) {
				for (var z=0;z<allPs.length;z++) {
					if (allPs[z].getAttribute("lang")==arrValue[i]) {
						allPs[z].style.display = "block";
					};
				};
			};
		};
		function showLanguages(sValue) {
			// the IE 4.0+ way to do it
			// right now, just on class="somelanuage" elements
			if (isIE) {
			// if (document.styleSheets && document.styleSheets[0].addRule) {
				var oStyleSheet=document.styleSheets[0];
				oStyleSheet.addRule(".tibetan","display: none;");
				oStyleSheet.addRule(".english","display: none;");
				var arrValue = sValue.split(",");
					for (var i=0; i<arrValue.length;i++) {
						var selector = (arrValue[i]=="bo") ? ".tibetan" : ".english";
						oStyleSheet.addRule(selector,"display: block;");
					};
				}
				// the more rational, DOM way to do it (works with Firefox and Opera)
				// works on ALL elements with lang="xx" attributes
				else {
					var text = new String();
					text = '*[lang="bo"] {display: none;} '; // turn them off first
					text += '*[lang="en"] {display: none;} ';
					var arrValue = sValue.split(",");
					for (var i=0; i<arrValue.length;i++) {
							text += '*[lang="'+arrValue[i]+'"] {display: block;} ';
					};
					var tStyle = document.createTextNode(text);
					var oStyle = document.createElement("style");
					oStyle.appendChild(tStyle);
					oStyle.type="text/css";
					document.getElementsByTagName("head")[0].appendChild(oStyle);
				};
			};
			
		function OlddlemeshowLanguages(sValue) {
			if (document.styleSheets[0] && document.styleSheets[0].addRule) {
				var oStyleSheet=document.styleSheets[0];
				oStyleSheet.addRule(".tibetan","display: none;");
				oStyleSheet.addRule(".english","display: none;");
				var arrValue = sValue.split(",");
					for (var i=0; i<arrValue.length;i++) {
					var selector = (arrValue[i]=="bo") ? ".tibetan" : ".english";
					oStyleSheet.addRule(selector,"display: block;");
					};
			};
		};
		
		function changeJustification(oSelect) {
			cssStrings = oSelect.options[oSelect.selectedIndex].text;
			// the IE 4.0+ way to dynamically change style sheets properties
			if (document.styleSheets && document.styleSheets[0].addRule) {
				var oStyleSheet=document.styleSheets[0];
				var aCssStrings = cssStrings.split(",");
				for (var i=0;i<aCssStrings.length;i++) {
					oStyleSheet.addRule("*",aCssStrings[i]);
				};
			}
			else {
				alert("IE 4.0+ required for justification demo");
			};
		};