function NoError() { return (true) }
onError = NoError

d = document

tab = "&nbsp;&nbsp;&nbsp; "

menu_hash = new Array
(
//'News', "news",
'About Poligon', "poligon",
tab+'Description', "description",
//tab+'Articles', "articles",
tab+'Screenshots', "slides",
tab+'Price-list', "price",
//tab+'FAQ', "faq",
'Demo', "demo",
'Customers', "users",
tab+'Orders', "users_orders",
tab+'Customers', "users_list",
'Contact us', "contact",
'Links', "links",
'Main menu', "index"
)

count = menu_hash.length
var dir = 'eng/'

var fn = new String( window.location.href )
up = fn.lastIndexOf(dir)+3 != fn.lastIndexOf('/') ? "..\\": ""
fn = fn.substring( fn.lastIndexOf('/') + 1 )	// filename

cur = -1	// индекс _ключа_ в хеше для текущего htm

for( var i = 1; i < count; i+=2 )
	if( menu_hash[i]+".htm" == fn )
		cur = Math.floor(i/2)


//	ВЕРХ

function write_header( strTitle, vert_space )
{
// vert_space - если правда, то после полосы с темой будет отступ вниз 20px

// SpyLOG - верхняя часть
//Mu="u2936.64.spylog.com";Mnv=navigator;Mp=1;Mn=(Mnv.appName.substring(0,2)=="Mi")?0:1;
//Mrn=Math.random();Mt=(new Date()).getTimezoneOffset();Mz="p="+Mp+"&rn="+Mrn+"&tl=0&ls=0&ln=0&t="+Mt;
//d.write("<img src='http://"+Mu+"/cnt?cid=293664&"+Mz+"&r="+escape(d.referrer)+"&pg="+escape(window.location.href)+"' border=0 width=1 height=1>")

d.write(
"<div align=center><center>",
"<table border=0 cellpadding=0 cellspacing=0>",
"	<tr><td background="+up+"logo.gif>",
"	<table background='' width=612 border=0 cellpadding=0 cellspacing=0>",
"		<tr style=cursor:hand>",
"			<td width=283 onclick=\"window.location.href='http://www.poligonsoft.ru'\">&nbsp;</td>",
"			<td width=329 height=33 class=poligon><a id=poligon_lnk href="+up+"../index.htm>CAE-SYSTEM FOR FOUNDRY PROCESSES</a></td>",
"		</tr>",
"		<tr>",
"			<td colspan=2 height=12 class=right_link><a id=const_lnk href="+up+"../rus/index.htm title='Switch to Russian'>Russian</a></td>",
"		</tr>",
"	</table>",
"	</td></tr>",
"	<tr><td height=30><SPACER height=30 width=1 type=block></td></tr>",
"</table>")

d.write(
"<table border=0 cellpadding=0 cellspacing=0>",
"	<tr><td colspan=2><image src="+up+"../line_topic.gif width=612 height=2></td></tr>",
"	<tr bgcolor=f5f5f5>",
"		<td background="+up+"../topic_fon.gif class=v_centr><p class=topic>", strTitle, "</p></td>")

write_menu()

d.write(
"	</tr>",
"	<tr><td colspan=2><image src="+up+"../line_topic.gif width=612 height=2></td></tr>",
(!vert_space? "": "<tr><td colspan=2 height=20><SPACER height=20 width=1 type=block></td></tr>"),
"</table>",
"</center></div>")
}


//	МЕНЮ

function new_location( obj )
{
	var url = obj.options[obj.selectedIndex].value
	obj.selectedIndex = cur
	if( url != ".htm" ) window.location.href = up+url
}

function write_menu()
{
	d.write("<form><td align=right><SELECT onchange=new_location(this)>")

	if( cur == -1 )
		d.write( "<OPTION></OPTION>" )

	for( var i = 1; i < count; i+=2 )
	{
		var	lnk = menu_hash[i]+".htm", 
			txt = "&nbsp;"+menu_hash[i-1],
			sel = i-1 == cur*2? " selected class=cur_topic": ""

		// выделяем Главное меню
		if( d.all  &&  i == count-1 ) sel+=" style=color:#006;background:#f0f0f0"

		d.write( "<OPTION value="+lnk+sel+'>'+txt+"</OPTION>" )
	}

	d.write("</SELECT></td></form>")
}


//	НИЗ

function write_footer( fEmail )
{
// для подраздела - текстовое горизонт. меню
if( cur >=0  &&  new String(menu_hash[cur*2]).indexOf(tab) != -1 )
{
	// ищем ключ первого подраздел в текущем разделе
	for( var i = cur*2; i >= 0; i-=2 )
		if( new String(menu_hash[i]).indexOf(tab) == -1 )
			break;

	var min = i<0? 0: (i+2)/2;

	// ищем последний подраздел
	for( i = cur*2; i < count; i+=2 )
		if( new String(menu_hash[i]).indexOf(tab) == -1 )
			break;

	var max = i>=count? count/2: (i-2)/2;

	d.write( "<p class=horiz_menu>" )

	for( var i = min; i <= max; i++ )
	{
		var str = "<a id=const_lnk href="

		if( i==cur )
			str += "#top class=clear_link>"
		else
			str += up + menu_hash[i*2+1] + ".htm>"

		d.write( str + new String(menu_hash[i*2]).substring(tab.length) + "</a>" )

		if( i != max ) d.write("&nbsp; | &nbsp;")
	}
}

d.write(
"<div align=center><center>",
"<table border=0 cellpadding=0 cellspacing=0>",
"	<tr>",
"		<td colspan=3 height=20><SPACER height=20 width=1 type=block></td>",
"	</tr>",
"	<tr>",
"		<td colspan=3><image src="+up+"../line_footer.gif width=636 height=3></td>",
"	</tr>",
"	<tr>",
"		<td width=88 class=copyright>Poligon&nbsp;&copy;&nbsp;2009/td>",
"		<td width=", fEmail? 484: 488, " background="+up+"../lines.gif><p style=padding-left:20><a id=stamina_lnk href=http://www.stamina.ru target=_blank title='Design: A.Kazantsev\n    www.stamina.ru\n    alex@stamina.ru'>Designed by Stamina</a></p></td>",
"		<td bgcolor=white width=", fEmail? 40: 36, " class=right_link><a id=const_lnk href=", fEmail? "mailto:poligon@poligonsoft.ru?Subject=Poligon title='Contact us'>E-mail": up+"index.htm title='Main menu\n(site map)'>Menu", "</a></td>",
"	</tr>",
"</table>",
"</center></div>")

// SpyLOG - кнопка
//d.write("<img src='http:\/\/u2936.64.spylog.com/cnt?cid=293664&p=1&f=4&rn="+Math.random()+"' border=0 width=1 height=1>")
}
