var complianceMatrix = [];
complianceMatrix[6]  = 7;
complianceMatrix[7]  = 9;
complianceMatrix[8]  = 10;
complianceMatrix[9]  = 11;
complianceMatrix[10] = 13;
complianceMatrix[11] = 15;
complianceMatrix[12] = 17;

function trimLeft(sSource, iFontSize, iWidth, fAdjust) {
	var intFontSize = parseInt(iFontSize, 10);
	var intWidth = parseInt(iWidth, 10);
	var floatAdjust = parseFloat(fAdjust);
	if (!complianceMatrix[intFontSize]) {
		return sSource;
	}
	if (sSource.length*complianceMatrix[intFontSize] > intWidth*floatAdjust) {
		return sSource.substr(0, Math.round(intWidth*floatAdjust/complianceMatrix[intFontSize])) + "...";
	} else {
		return sSource;
	}	
}

var wndTRIZ;

function newTRIZWindow(sPath, iWidth, iHeight) {
	var _width = iWidth || 640;
	var _height = iHeight || 480;
	if (wndTRIZ && !wndTRIZ.closed) {
		wndTRIZ.document.location.replace(sPath);
	} else {
		var top = window.screen.availHeight/2 - _height/2;
		var left = window.screen.availWidth/2 - _width/2;
		wndTRIZ = window.open(sPath, 'wndTRIZ', 'directories=no,height=' + _height + ',width=' + _width + ',location=no,menubar=no,resizable=yes,scrollbars=no,titlebar=no,toolbar=no,top=' + top + ',left=' + left);
	}
	wndTRIZ.focus();
}

function newWindow(sPath) {
	window.open(sPath);
}

var sCurrentLanguage = "eng";

try {
	var sLang = getCookie("TRIZ-ChoosedLanguage");
	if (sLang && (sLang == "eng" || sLang == "korean"))  sCurrentLanguage = sLang;
} catch (e) {
}