var mainColor			= prepareColor(getStyle("maincolor").color);
var mainAlternate		= prepareColor(getStyle("mainalternate").color);
var mainHeading			= prepareColor(getStyle("mainheading").color);
var mainText			= prepareColor(getStyle("maintext").color);
var mainLink			= prepareColor(getStyle("mainlink").color);

var secondaryColor		= prepareColor(getStyle("secondarycolor").color);
var secondaryAlternate	= prepareColor(getStyle("secondaryalternate").color);
var secondaryHeading	= prepareColor(getStyle("secondaryheading").color);
var secondaryText		= prepareColor(getStyle("secondarytext").color);
var secondaryLink		= prepareColor(getStyle("secondarylink").color);
var mySearchBg			= prepareColor(getStyle("mysearchbg").color = shadeColor(secondaryColor,0.05));
var mainLighter			= prepareColor(getStyle("mainlighter").color = lighterColor(mainColor,0.30));
var mainNav				= prepareColor(getStyle("mainlighter").color = lighterColor(mainColor,0.80));
var mainDarker			= prepareColor(getStyle("maindarker").color = darkerColor(mainColor,0.15));
var mainStripe			= prepareColor(getStyle("stripe").color = darkerColor(mainColor,0.50));
var middle				= prepareColor(getStyle("middle").color = shadeColor(secondaryColor,0.07));
var middleBorder		= prepareColor(getStyle("middleborder").color = shadeColor(middle,0.15));

getStyle("shadowleft").backgroundImage = "url(" +  getImageURL("/images/site/t145/en/images/shadowleft.img", "stage.color="+mainLighter+"&shadow.fill.color="+mainStripe) + ")";
getStyle("shadowright").backgroundImage = "url(" +  getImageURL("/images/site/t145/en/images/shadowright.img", "stage.color="+mainLighter+"&shadow.fill.color="+mainStripe) + ")";
getStyle("body").backgroundColor = mainLighter;
getStyle("middle").backgroundColor = middle;
getStyle("footer").backgroundColor = mainColor;
getStyle("footer").color = mainText;
getStyle("maindarker").backgroundColor = mainDarker;
getStyle("page").backgroundColor = middle;
getStyle("page").color = secondaryText;
getStyle("nav").backgroundColor = middle;
getStyle("nav").color = secondaryText;
getStyle("nav").borderColor = middleBorder;
getStyle("nav2").backgroundColor = secondaryColor;
getStyle("nav2").color = secondaryText;
getStyle("nav2").borderColor = middleBorder;
getStyle("content").backgroundColor = secondaryColor;
getStyle("content").color = secondaryText;
getStyle("content2").color = secondaryText;
getStyle("content").borderColor = middleBorder;

getStyle("middleborder").borderColor = middleBorder;
getStyle("middleborder").backgroundColor = middleBorder;
getStyle("text").color = secondaryText;
getStyle("mainheadings").color = mainHeading;
getStyle("textmain").color = mainText;
getStyle("textaltm").color = mainAlternate;
getStyle("textalts").color = secondaryAlternate;
getStyle("table").backgroundColor = mainColor;
getStyle("table").color = mainText;
getStyle("subpages").borderColor = shadeColor(secondaryColor,0.20);
getStyle("subheadings").backgroundColor = shadeColor(secondaryColor,0.15);
getStyle("subheadings").color = shadeColor(secondaryColor,0.90);
getStyle("secbg").backgroundColor = secondaryColor;
getStyle ("mysearchbg").backgroundColor = mySearchBg;
getStyle("borderlinkelementm").borderColor = mainLink;
getStyle("borderlinkelements").borderColor = secondaryLink;

getStyleBySelector("a:link").color = secondaryLink;
getStyleBySelector("a:visited").color = secondaryLink;
getStyleBySelector("a:hover").color = shadeColor(secondaryLink,0.15);

getStyleBySelector(".mainlinks a:link").color = mainLink;
getStyleBySelector(".mainlinks a:active").color = mainLink;
getStyleBySelector(".mainlinks a:visited").color = mainLink;
getStyleBySelector(".mainlinks a:hover").color = shadeColor(mainLink, 0.15);

function drawPageName(inText)
{
	attributes = "&label.text=" + inText;
	attributes += "&label.fill.color=" + mainHeading;
	attributes += "&stage.color=" + mainColor;
	attributes += "&background.fill.color=" + mainColor;

	drawImage("/images/site/t145/en/images/pagename.img", attributes);
}

function drawLabel(inText)
{
	attributes = "&label.text=" + inText;
	attributes += "&label.fill.color=" + mainHeading;
	attributes += "&stage.color=" + mainColor;
	attributes += "&background.fill.color=" + mainColor;

	drawImage("/images/site/t145/en/images/pagename.img", attributes);
}

function drawBgImage(inTemplateURL, inAttributes, inExtra)
{
	document.write("<td background='" + getImageURL(inTemplateURL,inAttributes) + "'");
	document.write(">");
}
function drawGradient()
{
	attributes =  "shadow.fill.gradient.start.color=" + mainDarker;
	attributes += "&shadow.fill.gradient.end.color=" + mainLighter;
	attributes += "&stage.color=" + mainColor;

	drawBgImage("/images/site/t145/en/images/gradient.img", attributes);
}
function drawLabelColor(inText,inExtra)
{
	attributes =  "background.fill.color=" + mainColor;
	attributes += "&label.text=" + inText;
	attributes += "&stage.color=" + mainColor;
	attributes += "&label.fill.color=" + mainHeading;

	drawImage("/images/site/t145/en/images/label.img", attributes, inExtra);
}

function drawTopButtons(inText,inName,inExtra)
{
	attributes = "stage.color=" + middle;
	attributes += "&label.text=" + inText;
	attributes +=  "&label.fill.color=" + secondaryLink;
	attributes += "&square.fill.color=" + secondaryLink;
	attributes += "&arrow.fill.color=" + secondaryLink;
	attributes += "&button.fill.color=" + secondaryColor;
	attributes += "&button.width=90";

	drawImage("/images/site/t145/en/images/bevelbuttons.img", attributes, inName, inExtra);
}

function drawNumber(inText, inExtra, inBackground, inLabel)
{
	attributes =  "background.fill.color=" + inBackground;
	attributes += "&label.text=" + inText;
	attributes += "&label.fill.color=" + inLabel;
	attributes += "&stage.color=" + inBackground;

	drawImage("/images/site/t145/en/images/number.img", attributes, inExtra);
}

function drawLabel2(inText, inExtra)
{
	attributes = "label.text=" + inText;
	attributes +=  "&background.fill.color=" + mainColor;
	attributes += "&label.fill.color=" + mainHeading;
	attributes += "&stage.color=" + mainColor;

	drawImage("/images/site/t145/en/images/label.img", attributes,inExtra);
}

function drawButtons(inText, inExtra, inOpacity)
{
	attributes = "stage.color=" + middle;
	attributes += "&label.text=" + inText;
	attributes +=  "&label.fill.color=" + secondaryLink;
	attributes += "&square.fill.color=" + secondaryLink;
	attributes += "&arrow.fill.color=" + secondaryLink;
	attributes += "&button.fill.color=" + secondaryColor;

	drawImage("/images/site/t145/en/images/inputbuttons.img", attributes, inExtra);
}

function drawInputButtons(inText, inName, inExtra)
{
	attributes = "stage.color=" + middle;
	attributes += "&label.text=" + inText;
	attributes +=  "&label.fill.color=" + secondaryLink;
	attributes += "&square.fill.color=" + secondaryLink;
	attributes += "&arrow.fill.color=" + secondaryLink;
	attributes += "&button.fill.color=" + secondaryColor;

	drawInputImage("/images/site/t145/en/images/inputbuttons.img", attributes, inName, inExtra);
}

    function drawGoButtons(inText,inName,inExtra)
{
	attributes = "stage.color=" + middle;
	attributes += "&label.text=" + inText;
	attributes +=  "&label.fill.color=" + secondaryLink;
	attributes += "&square.fill.color=" + secondaryLink;
	attributes += "&arrow.fill.color=" + secondaryLink;
	attributes += "&button.fill.color=" + secondaryColor;
	attributes += "&button.width=50";	

        drawInputImage("/images/site/t145/en/images/bevelbuttons.img", attributes, inName, inExtra);
}
function drawNavButtons()
{
	attributes = "stage.color=" + middle;
	attributes += "&label.fill.color=" + secondaryLink;
	attributes += "&label.fill.color.over=" + secondaryText;
	attributes += "&label.fill.color.selected=" + secondaryText;
	attributes += "&label.fill.color.selectedover=" + secondaryLink;
	attributes += "&square.fill.color=" + secondaryLink;
	attributes += "&square.fill.color.over=" + secondaryText;
	attributes += "&square.fill.color.selected=" + secondaryText;
	attributes += "&square.fill.color.selectedover=" + secondaryLink;
	attributes += "&arrow.fill.color=" + secondaryLink;
	attributes += "&arrow.fill.color.over=" + secondaryText;
	attributes += "&arrow.fill.color.selected=" + secondaryText;
	attributes += "&arrow.fill.color.selectedover=" + secondaryLink;
	attributes += "&background.fill.color=" + secondaryColor;

        drawTabs("vertical", 0, 0, "VSPACE=1 BORDER=0", attributes, "/images/site/t145/en/images/nav.img");
}

