/*
 * Copyright (c) 1995-2011 by 4system Polska Sp. z o.o.
 * All Rights Reserved. v4
 */

function InitializeStandardTree()
{
	var tree_frame = player.findFrame("tree");
	if (tree_frame && tree_frame.initialize) {
		tree_frame.initialize();
	}
};

function trim(str)
{
   if (typeof(str) != "undefined") {
		return str.replace(/^\s*|\s*$/g, "");
	} else {
		return "";
	}
};

function intToLetter(number)
{
	var result = "";	
	var sLetters = "abcdefghijklmnopqrstuvwxyz".split("");
	var bLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
	if (number < 10) result = number;
	else if (number < 36) result = sLetters[number-10];
	else if (number < 62) result = bLetters[number-36];
	
	return result;
};

function letterToInt(letter)
{
	var result = "";	
	var sLetters = "abcdefghijklmnopqrstuvwxyz";
	var bLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	if (parseInt(letter) < 10) result = parseInt(letter);
	else if (sLetters.indexOf(letter) > -1) result = 10 + sLetters.indexOf(letter);
	else if (bLetters.indexOf(letter) > -1) result = 36 + bLetters.indexOf(letter);
	
	return result;
};

function pad (str, max) {
  return str.length < max ? pad("0" + str, max) : str;
}
