

function dw(str){document.write(str);}

var MainMenu = Array();
var MainColor = "";


var MenuTemplates = {
"active": '<TD width="1" valign="bottom"><img src="/Sites/eng_profile_ru/Images/{COLOR}_tab_l_active.gif" width="6" height="39" alt="" border="0"></TD>\
<TD  valign="bottom" STYLE = "background-image: url(/Sites/eng_profile_ru/Images/{COLOR}_tab_bg_active.gif); background-position : left bottom; background-repeat : repeat-x;padding-bottom:6"  align="center"><A HREF="{URL}"><img src="{IMGON}" width="140" height="20" alt="{TITLE}" border="0"></A></TD>\
<TD width="1" valign="bottom"><img src="/Sites/eng_profile_ru/Images/{COLOR}_tab_r_active.gif" width="6" height="39" alt="" border="0"></TD>',

"usual":'<TD width="1" valign="bottom"><img src="/Sites/eng_profile_ru/Images/{COLOR}_tab_l.gif" width="6" height="39" alt="" border="0"></TD>\
<TD  valign="bottom" STYLE = "background-image: url(/Sites/eng_profile_ru/Images/{COLOR}_tab_bg.gif); background-position : left bottom; background-repeat : repeat-x;padding-bottom:6"  align="center"><A HREF="{URL}"><img src="{IMGOFF}" width="140" height="20" alt="{TITLE}" border="0"></A></TD>\
<TD width="1" valign="bottom"><img src="/Sites/eng_profile_ru/Images/{COLOR}_tab_r.gif" width="6" height="39" alt="" border="0"></TD>',

"last_active":'<TD width="1" valign="bottom"><img src="/Sites/eng_profile_ru/Images/{COLOR}_tab_l_active.gif" width="6" height="39" alt="" border="0"></TD>\
<TD  valign="bottom" STYLE = "background-image: url(/Sites/eng_profile_ru/Images/{COLOR}_tab_bg_active.gif); background-position : left bottom; background-repeat : repeat-x;padding-bottom:6"  align="center"><A HREF="{URL}"><img style="margin-left:10" src="{IMGON}" width="140" height="20" alt="{TITLE}" border="0"></A></TD>\
<TD width="1" valign="bottom" rowspan="2" STYLE="background-image : url(/Sites/eng_profile_ru/Images/{COLOR}_tab_bg_active.gif); background-position : left top; background-repeat : repeat-x"> \
<img style="background-color:{MAINCOLOR}" src="/Sites/eng_profile_ru/Images/tab_r_active.png" style="BEHAVIOR: url(/Sites/eng_profile_ru/Images/png.htc)" height="40" width="32" alt="" border="0"></TD>',

"last_usual" : '<TD width="1" valign="bottom"><img src="/Sites/eng_profile_ru/Images/{COLOR}_tab_l.gif" width="6" height="39" alt="" border="0"></TD>\
<TD  valign="bottom" STYLE = "background-image: url(/Sites/eng_profile_ru/Images/{COLOR}_tab_bg.gif); background-position : left bottom; background-repeat : repeat-x;padding-bottom:6"  align="center"><A HREF="{URL}"><img src="{IMGOFF}" style="margin-left:10" width="140" height="20" alt="{TITLE}" border="0"></A></TD>\
<TD width="1" valign="bottom" rowspan="2" STYLE="background-image : url(/Sites/eng_profile_ru/Images/{COLOR}_tab_bg.gif); background-position : left top; background-repeat : repeat-x"> \
<img src="/Sites/eng_profile_ru/Images/{MAINCOLORNAME}_tab_r.png" style="BEHAVIOR: url(/Sites/eng_profile_ru/Images/png.htc)" height="40" width="32" alt="" border="0"></TD>'}

var MenuTemplates2 = {
"active": '<TD bgcolor="{COLOR}"></TD><TD bgcolor="{COLOR}"></TD><TD bgcolor="{COLOR}"></TD>',

"usual":'<TD></TD><TD></TD><TD></TD>',

"last_active":'<TD bgcolor="{COLOR}"></TD><TD bgcolor="{COLOR}"></TD>',

"last_usual" : '<TD></TD><TD></TD><TD></TD>'}

var arrColors = {"yellow" : "#eddc6e", "red" : "#e6976a","blue" : "#8db6a6","magenta" : "#8c82ab","purple" : "#b87bb5" }


function drawMenu()
{

	dw(	'<TABLE cellpadding="0" cellspacing="0" border="0" width="100%"> \
<TR STYLE = "background-image : url(/Sites/eng_profile_ru/Images/tab_bg.gif); background-position : left top; background-repeat : repeat-x">\
<TD width="1" valign="bottom"><img src="/Sites/eng_profile_ru/Images/tab_l.gif" width="19" height="33" alt="" border="0"></TD>');
	var current = "usual";
	var MainColorName = "";
	var re = new RegExp("{COLOR}","ig");

	for(i=0; i<MainMenu.length;i++)
	{
	var item = MainMenu[i];
	if(current=="active") current="usual";
	var color = ""+item["color"];
	if(color=="" || color=="undefined") color = "yellow";
		
	if(item["active"]=="yes") { current="active";MainColorName = color; MainColor = arrColors[color];}
	if (i==MainMenu.length-1) current = "last_"+current;
	tpl = MenuTemplates[current];

	tpl = tpl.replace("{URL}", item["url"]);
	tpl = tpl.replace("{IMGON}", item["imgon"]);
	tpl = tpl.replace("{IMGOFF}", item["imgoff"]);
	tpl = tpl.replace("{TITLE}", item["title"]);
	tpl = tpl.replace("{MAINCOLORNAME}", MainColorName);
	tpl = tpl.replace("{MAINCOLOR}", MainColor);
	tpl = tpl.replace(re, color);
	dw(tpl);
	}

	dw(	'</TR><TR bgcolor="#FFFFFF"><TD></TD>');

	var current = "usual";
	for(i=0; i<MainMenu.length;i++)
	{
	var item = MainMenu[i];
	if(current=="active") current="usual";
	var color = ""+item["color"];
	if(color=="" || color=="undefined") color = "yellow";

	if(item["active"]=="yes") { current="active";}
	if (i==MainMenu.length-1) current = "last_"+current;
	
	tpl = MenuTemplates2[current];
	tpl = tpl.replace(re, arrColors[color]);
	dw(tpl);
	}
	

	dw(	'</TABLE>');
}

