//________________________________--
var cC3_ModNm = "C3_Common_SizesLangFuncs.js";
var cC3_cpyra = "©2011 Rako DP Enterprises";
//   
/*jsl:ignoreall*/
//________________________________--


function fC3g_GetLegibilityFromCookie (pUsage)  {
	var wCookieStr; 
	if (pUsage > 1) {
		wCookieStr = parent.vC0Ag_UI_Cookie_Array[cC0Bg_UI_LegibilityOptsCkIx]; 
		}
	else {
		wCookieStr = vC0Ag_UI_Cookie_Array[cC0Bg_UI_LegibilityOptsCkIx]; 
		}
	if (wCookieStr != "") {
		wCookieStr = wCookieStr + ", X:0"; 
		var wLegOpts = wCookieStr.split(","); 
		var wLegOpts_Cnt = wLegOpts.length; 
		var wLegOptPar; 
		var wLegOptValue; 
		for (i = 0; i < wLegOpts_Cnt; i++) {
			wLegOptPar = wLegOpts[i].split(":");
				if (isNaN(wLegOptPar[1])) {
					wLegOptPar[1] = 1;}
				if (typeof(wLegOptPar[1]) == "string") {
					wLegOptPar[1] = Number(wLegOptPar[1]); }
			switch (wLegOptPar[0]) {
				case cC0Bg_Chg_Size:
					vA0bg_Curr_Font_Size_BtnObj_Ix = wLegOptPar[1]; 
					vC0Ag_Curr_Text_Size = wLegOpts[i]; 
					wLegOptValue = cS0g_RakoCntl_Sizes_Other[vA0bg_Curr_Font_Size_BtnObj_Ix]; 
					if (pUsage > 0) {
						fC3g_ChangeLegibilityStyles (wLegOptPar[0], wLegOptValue); }
					break; 
				case cC0Bg_Chg_Weight:
					vA0bg_Curr_Font_Weight_BtnObj_Ix = wLegOptPar[1]; 
					wLegOptValue = cS0g_RakoCntl_Weights[vA0bg_Curr_Font_Weight_BtnObj_Ix]; 
					vC0Ag_Curr_Text_Weight = wLegOpts[i]; 
					if (pUsage > 0) {
						fC3g_ChangeLegibilityStyles (wLegOptPar[0], wLegOptValue); }
					break; 
				case cC0Bg_Chg_Colour:
					vA0bg_Text_Contrast_BtnObj_Ix = wLegOptPar[1]; 
					wLegOptValue = cS0g_Site_LEG_Text_Colours[vA0bg_Text_Contrast_BtnObj_Ix]; 
					vC0Ag_Curr_Text_Colour = wLegOpts[i]; 
					if (pUsage > 0) {
						fC3g_ChangeLegibilityStyles (wLegOptPar[0], wLegOptValue); }
					break; 
				case cC0Bg_Chg_BGColour:
					vA0bg_Text_Contrast_BtnObj_Ix = wLegOptPar[1]; 
					vC0Ag_Curr_Text_BGColour = wLegOpts[i]; 
					wLegOptValue = cS0g_Site_LEG_BackGround_Colours[vA0bg_Text_Contrast_BtnObj_Ix]; 
					if (pUsage > 0) {
						fC3g_ChangeLegibilityStyles (wLegOptPar[0], wLegOptValue); }
					break; 
				case cC0Bg_Chg_NavSize:
					vA0bg_Curr_Index_Font_Size_BtnObj_Ix = wLegOptPar[1]; 
					wLegOptValue = wLegOptPar[1]; 
					if (pUsage < 2) {
						fC3g_ChangeLegibilityStyles (wLegOptPar[0], wLegOptValue); }
					break; 
				}
			}
		}
	else {
		if (pUsage > 1) {
			parent.fF11Ag_Write_Cookie_Legibility(); }
		}
}  // ________________ end of function:  fC3g_GetLegibilityFromCookie() {

//  ____________________________

function fC3g_ChangeLegibilityStyles (pType, pChoice) {
	var wTestSelector; 
	var wSelectorToChange = ""; 
	var wLPtr; 
	var wMayChangeFontSize = false; 
	var wStdFontSize = 12; 
	var wMultiplicator; 
	var wNewValue; 
	var wCurrLine_Height; 
	var wCurrLine_HeightDiff; 
	var wMayChangeFont_Weight = false; 
	var wMayChangeFontColour = false; 
	var wMayChangeBGColour = false; 
	var wChoiceIsString; 
	var wChar1; 
	var wCurrRuleType; 
	var wFontParamChg = false; 
	wChoiceIsString = (typeof(pChoice) == "string"); 
	var wChoice = pChoice; 
	switch (pType) {
		case cC0Bg_Chg_Size:
			if (wChoiceIsString) {
				wChoice = Number(pChoice); }
			wMultiplicator = wChoice; //cS0g_RakoCntl_Sizes_Other[wChoice]; 
			wFontParamChg = true; 
			break; 
		case cC0Bg_Chg_Weight:
			if (wChoiceIsString) {
				wChoice = Number(pChoice); }
			wNewValue = wChoice; //cS0g_RakoCntl_Weights[wChoice]; 
			wFontParamChg = true; 
			break; 
		case cC0Bg_Chg_Colour:
			wNewValue = wChoice; //cS0g_Site_LEG_Text_Colours[wChoice]; 
			break; 
		case cC0Bg_Chg_BGColour:
			wNewValue = wChoice; //cS0g_Site_LEG_BackGround_Colours[wChoice]; 
			break; 
		}
	if (vC0Ag_Style_Sheet_Cnt >0 ) {  // L1
		for (var i = 0; i < vC0Ag_Style_Sheet_Cnt; i++) {  // L2
				vC0Ag_Curr_Sheet_Nr = i; 
				vC0Ag_Curr_Sheet = document.styleSheets[i]; 
				vC0Ag_Rules_In_Curr_Sheet = vC0Ag_Curr_Sheet.cssRules? vC0Ag_Curr_Sheet.cssRules: vC0Ag_Curr_Sheet.rules; 
				vC0Ag_Rules_Cnt = vC0Ag_Rules_In_Curr_Sheet.length; 
				if (vC0Ag_Rules_Cnt > 0) {	 
					for (var j = 0; j < vC0Ag_Rules_Cnt; j++) {
						vC0Ag_Curr_Rule_Nr = j; 
						vC0Ag_Curr_Rule = vC0Ag_Rules_In_Curr_Sheet[j]; 
						wCurrRuleType=vC0Ag_Curr_Rule.type; 
						vC0Ag_Curr_Selector = vC0Ag_Curr_Rule.selectorText; 
						if (vC0Ag_Curr_Selector != "") {  
							if (vC0Ag_Curr_Rule.style) {  
								if (vRPRIp_REU_Browser_Is_IE6 && typeof(wCurrRuleType) == "undefined") {
									wChar1 = vC0Ag_Curr_Selector.charAt(0); 
									if (wChar1 == "@") {
										wCurrRuleType=0; }
									else  {
										wCurrRuleType=1; }
									}
								if (wCurrRuleType == 1) {
									wTestSelector = vC0Ag_Curr_Selector.toLowerCase(); 
			 						wLPtr = wTestSelector.indexOf(cC0Bg_RakoCntl_Style); 
									if (wLPtr > 0) {   //  cC0Bg_RakoCntl_Style   // 7
										wSelectorToChange = wTestSelector.slice(0, wLPtr - 1); 
										var wTestSize = vC0Ag_Curr_Rule.style.fontSize; 
										wMayChangeFontSize = (wTestSize != ""); 
										if ( wMayChangeFontSize) {
											wLPtr = wTestSize.indexOf("pt"); 
											wStdFontSize = wTestSize.slice(0, wLPtr); 
												wCurrLine_Height = vC0Ag_Curr_Rule.style.lineHeight; 
												if (wCurrLine_Height != "") {
													wLPtr = wCurrLine_Height.indexOf("pt"); 
													if (wLPtr > 0) {
														wCurrLine_Height = wCurrLine_Height.slice(0, wLPtr); 
														wCurrLine_HeightDiff = wCurrLine_Height - wStdFontSize; 
														}
													}
											}
										wMayChangeFont_Weight = (vC0Ag_Curr_Rule.style.fontWeight != ""); 
										wMayChangeFontColour = (vC0Ag_Curr_Rule.style.color != ""); 
										wMayChangeBGColour = (vC0Ag_Curr_Rule.style.backgroundColor != ""); 
										}
									else {
										if (wSelectorToChange != "") {
											wLPtr = wSelectorToChange.length; 
											wTestSelector = wTestSelector.slice(0, wLPtr); 
											if (wTestSelector == wSelectorToChange) {   // L9
												switch (pType) {
													case cC0Bg_Chg_Size:
														if (wMayChangeFontSize) {	// L11
															wTestSize = Math.round(wStdFontSize*wMultiplicator/100); 
															vC0Ag_Curr_Rule.style.fontSize = wTestSize + "pt"; 
															wCurrLine_Height = vC0Ag_Curr_Rule.style.lineHeight; 
															if ( (wCurrLine_Height != "") && (typeof(wCurrLine_HeightDiff) == "number") ) {
																wLPtr = wCurrLine_Height.indexOf("pt"); 
																if (wLPtr > 0) {
																	wTestSize = wCurrLine_HeightDiff + wTestSize; 
																	vC0Ag_Curr_Rule.style.lineHeight = wTestSize + "pt"; 
																	}
																}
														}
														break; 
													case cC0Bg_Chg_Weight:
														if (wMayChangeFont_Weight) {
															var wOldWeight = vC0Ag_Curr_Rule.style.fontWeight; 
															vC0Ag_Curr_Rule.style.fontWeight = wNewValue; 
														  }
														break; 
													case cC0Bg_Chg_Colour:
														if (wMayChangeFontColour) {
															vC0Ag_Curr_Rule.style.color = wNewValue; 	}
														break; 
													case cC0Bg_Chg_BGColour:
														if (wMayChangeBGColour) {
															vC0Ag_Curr_Rule.style.backgroundColor = wNewValue; 	}
														break; 
													}
												wSelectorToChange = ""; 
												}
											}
										}
									}
								}
							}
						}
					}
			}
		if (wFontParamChg) {
			fE0gg_Adjust_Heights(); 
			parent.fA6g_Set_Invisible_Parts_Info(); 
			}
	}
}  // ________________ end of function:  ChangeLegibilityStyles

function fC3g_Get_ObjInfo_Width (pInfoHolder) {
		var wInfoText_Width = pInfoHolder.offsetWidth; 
		var wInfoText_Height = pInfoHolder.offsetHeight; 
		var wPaddingLeft = pInfoHolder.style.padding; 
		var wWidthReducer = 100; 
		do {
			wInfoText_Width = wInfoText_Width - wWidthReducer; 
			if (wInfoText_Width < 1) {
				break; }
			pInfoHolder.style.width = wInfoText_Width + "px"; 
			} while (pInfoHolder.offsetHeight == wInfoText_Height); 
		wInfoText_Width = wInfoText_Width + wWidthReducer; 
		pInfoHolder.style.width = wInfoText_Width + "px"; 
		wWidthReducer = 20; 
		do {
			wInfoText_Width = wInfoText_Width - wWidthReducer; 
			if (wInfoText_Width < 1) {
				break; }
			pInfoHolder.style.width = wInfoText_Width + "px"; 
			} while (pInfoHolder.offsetHeight == wInfoText_Height); 
		wInfoText_Width = wInfoText_Width + wWidthReducer; 
		pInfoHolder.style.width = wInfoText_Width + "px"; 
		return wInfoText_Width; 

}  // ________________ end of function:  fC3g_Get_ObjInfo_Width

function fC3ge_Select_Clicked_Text_Id (pField_Id)	{
	document.getElementById(pField_Id).select();
}  // ________________ end of function:  fC3ge_Select_Clicked_Text_Id

function fC3g_Select_Clicked_Text_Obj (pField_Obj)	{
	pField_Obj.select();
}  // ________________ end of function:  fC3g_Select_Clicked_Text_Obj
//  

