﻿var menuId=getmenuId()

var ws_flag=0

var mwidth=screen.width

function inf_post()
{
	if (window.location.search=='?flag=1')
	{
		document.getElementById("rpm").innerHTML='<table width=99%><tr><td align=center><img src="images/m07_000_001.gif" width=300></td></tr></table>'
		document.getElementById("hpm").innerHTML='Новое сообщение'
	}

}


function get_title()
{
	document.write('<h2>'+splitStr(document.title,1,'.')+'</h2>')
}


function get_browser()
{
var bnamestr=navigator.userAgent

	if(bnamestr.indexOf('Chrome')>=0)
		return "Chrome"

	if(bnamestr.indexOf('Opera')>=0)
		return "Opera"

	if(bnamestr.indexOf('Safari')>=0)
		return "Safari"

	if(bnamestr.indexOf('Firefox')>=0)
		return "Firefox"

	if(bnamestr.indexOf('MSIE')>=0)
		return "MSIE"
	else
		return "Other"
}

function l_rstyle()
{
		
	if (mwidth==1280)
	{
		document.getElementById("nbody").className="r1280";
		document.getElementById("ntop").className="tr1280";
		document.getElementById("npan").className="pr1280";
		document.getElementById("nmidle").className="mr1280";
		document.getElementById("c2").className="r1280_2";
		document.getElementById("c3").className="r1280_3";
		document.getElementById("nbottom").className="br1280";
	}
	else
	{
		document.getElementById("nbody").className="r1024";
		document.getElementById("ntop").className="tr1024";
		document.getElementById("npan").className="pr1024";
		document.getElementById("nmidle").className="mr1024";
		document.getElementById("c2").className="r1024_2";
		document.getElementById("c3").className="r1024_3";
		document.getElementById("nbottom").className="br1024";
	}
	document.getElementById("nbody").style.visibility="visible"
}

function show_panel()
{
	document.write(navbar(menuId))
}

function show_menu()
{
	document.write(menuStr(getmenusubList_parent(menuId)))
}

function show_menu_home()
{
	document.write(menuStr(getmenusubList(menuId)))
}

function getmenuId()
{
var i, beginStr, endStr, tmp, chr,data;
tmp=''
chr=''
data=document.location.pathname

	beginStr=document.location.pathname.lastIndexOf('manu')
	endStr=document.location.pathname.lastIndexOf('.html')

	for(i=beginStr+1;i<=endStr;i++)
	{
		chr=data.substring(i,i-1)
		tmp=tmp+chr
	}

return tmp
}

function menuStr_(menuArray)
{
temp='<ul>'

	for (i=0;i<menuArray.length;i++)
	{
		temp=temp+"<li><a href='"+cutString(menuArray[i],2)+".html'>"+cutString(menuArray[i],1)+"</a></li>"
	}

return temp+'</ul>'
}

function getmenusubList_(str)
{
var tmpArray = new Array()
j=0
	for(i=0;i<menuList.length;i++)
	{
		if (cutString(menuList[i],3)==str)
		{
			tmpArray[j++]=menuList[i]
		}
	}
	return tmpArray
}

function doc_load(doc_num)
{
	switch(doc_num)
	{
		case 1:
			document.location="m02_001.html"
			break
		case 2:
			document.location="m02_002.html"
			break
		case 3:
			document.location="m02_003.html"
			break
	}

}

function menuStr(menuArray)
{
temp=''

	for (i=0;i<menuArray.length;i++)
	{
		temp=temp+"<p><a href='"+cutString(menuArray[i],2)+".html' class='rmnu'>"+cutString(menuArray[i],1)+"</a></p>"
	}

return temp
}

function getmenusubList(Id)
{
var tmpArray = new Array()
j=0
	for(i=0;i<menuList.length;i++)
	{
		if (cutString(menuList[i],3)==Id)
		{
			tmpArray[j++]=menuList[i]
		}
	}
	return tmpArray
}

function getmenusubList_parent(Id)
{
var tmpArray = new Array()
j=0

var tmp = getnavbarItem(Id)

	for(i=0;i<menuList.length;i++)
	{
		if (cutString(menuList[i],3)==cutString(tmp,3))
		{
			tmpArray[j++]=menuList[i]
		}
	}
	return tmpArray
}

function navbar(tmp)
{
var tmpArray = new Array()

	for(j=0;j<10;j++)
	{
		tmpArray[j]=getnavbarItem(tmp)
		tmp=cutString(tmpArray[j],3)
		if (tmp=='0')
			break
	}
		return navbarStr(tmpArray)
}


function navbarStr(menuArray)
{
temp=''
delim=''

	for(j=0,z=menuArray.length-1;j<menuArray.length;j++,z--)	
	{
		if (j)
		{
			delim=' | '
		}

		/*if (cutString(menuArray[z],3)=='index')
		{
			delim=' '
		}*/


		temp=temp+"<a style='position:relative;margin-right:0%;' href='"+cutString(menuArray[z],2)+".html' class='m'>"+delim+cutString(menuArray[z],1)+ "</a>"
	}

return temp
}


function getnavbarItem(menucurrentId)
{
var tmpStr=''

	for(i=0;i<menuList.length;i++)
	{
		if (cutString(menuList[i],2)==menucurrentId)
		{
			tmpStr=menuList[i]
			break
		}
	}
	return tmpStr
}


function showCataloge(c_type)
{
document.write('<table width=95%>')

var flag=1

	for(var i=0;i<cataloge.length;i++)
	{
		if (cutString(cataloge[i],5)==c_type)
		{
			if (flag==1)
			{
				document.write('<tr>')
			}

			document.write('<td valign=top><div><img src="images/'+cutString(cataloge[i],2)+'m.jpg" width=120 style="border: 4px double #A4294C;cursor:pointer" onclick="showElement('+i+')"></div>')
			//document.write('<div style="font-size:15;color:#6C3D0E">'+cutString(cataloge[i],1)+'</div></td>')

			if (flag==0)
			{
				document.write('</tr><tr><td>&nbsp;</td></tr>')
				flag=1
			}
			else
			{
				flag=0

			}

		}

	}
	document.write('</table>')
}

function showElement(num)
{
var add_tmp=''

	if (!ws_flag)
	{
		z=window.location.search
		if (z!='')
		{
			num=z.slice(1)
			ws_flag=1
			add_tmp='<h3>Заказ отправлен!</h3>'
		}
	}

	tmp='<div><img src="images/'+cutString(cataloge[num],2)+'.jpg" width=325 style="border: 4px double #A4294C"></div>'
	tmp=tmp+'<p style="text-align:left;font-size:15;color:#6C3D0E"><b>Модель:</b> '+cutString(cataloge[num],2)+'. '+cutString(cataloge[num],1)+'</p>'
	tmp=tmp+'<p style="text-align:left;font-size:15;color:#6C3D0E"><b>Стоимость:</b> '+cutString(cataloge[num],3)+' руб.</p>'
	tmp=tmp+'<div style="text-align:left;font-size:15;color:#6C3D0E"><b>Описание:</b> '+cutString(cataloge[num],4)+'</div>'
	tmp=tmp+'<p id="order" style="text-align:left"<a name="curloc"></a><a class="txt" href="#curloc" onclick="post_order('+num+')">Предварительный заказ</a></p>'
	tmp=tmp+add_tmp
	//document.getElementById("sh_el").style.visibility='hidden'
	document.getElementById("sh_el").innerHTML=tmp
	//document.getElementById("sh_el").style.visibility='visible'

}

function post_order(num)
{
tmp='<form method="post" action="../cgi-bin/get_order.pl" name="f">'
tmp=tmp+'<P><TABLE>'+
'<TR VALIGN=MIDDLE>'+
'<TD ALIGN=left><p class="el">ФИО:</p></TD>'+
'<TD ALIGN=left>'+
'<INPUT name="realname" size=37 maxlength=80></TD>'+
'</TR>'+
'<TR VALIGN=MIDDLE>'+
'<TD ALIGN=left><p class="el">E-Mail:</p></TD>'+
'<TD ALIGN=left><INPUT name="email" size=37 maxlength=80></TD>'+
'</TR>'+
'<TR VALIGN=TOP>'+
'<TD ALIGN=left><p class="el">Оформление:</p></TD>'+
'<TD ALIGN=left><SELECT NAME="order"><OPTION SELECTED>в салоне</OPTION><OPTION>с выездом на дом</OPTION></SELECT>'+
'</TR>'+
'<TR VALIGN=TOP>'+
'<TD ALIGN=left><p class="el">Комментарий:</p></TD>'+
'<TD ALIGN=left><TEXTAREA name="comm" rows=3 cols=28></TEXTAREA></TD>'+
'</TR>'+
'</TABLE></P>'

tmp=tmp+'<P><input type="hidden" name="mod" value="'+cutString(cataloge[num],1)+'"></p>'
tmp=tmp+'<P><input type="hidden" name="sum" value="'+cutString(cataloge[num],3)+'"></p>'
tmp=tmp+'<P><input type="hidden" name="prop" value="'+cutString(cataloge[num],4)+'"></p>'
tmp=tmp+'<P><input type="hidden" name="mid" value="'+menuId+'"></p>'
tmp=tmp+'<P><input type="hidden" name="num" value='+num+'></p>'
tmp=tmp+'<P><table><tr><td><input type="submit" value="Отправить заказ"></td>'
tmp=tmp+'<td><input type="reset" value="Очистить форму"</td></tr></table>'
tmp=tmp+'</form>'

	document.getElementById("order").innerHTML=tmp
}


function shows()
{
	document.writeln('<img src="images/com002.gif" hspace=14><p></p>');
	document.writeln('<p><a style="font-size:13" href="http://www.fihockey.org" target=blank>Международная федерация хоккея - ФИХ (FIH)</a></p>');
	document.writeln('<p><a style="font-size:13" href="http://www.eurohockey.org" target=blank> Европейская федерация хоккея - ЕХФ (EHF)</a></p>');
	document.writeln('<p><a style="font-size:13" href="http://www.fieldhockey.ru" target=blank>Федерация хоккея на траве России - ФХТР</a></p>');
	document.writeln('<p><a style="font-size:13" href="m04_004.html">Чемпионат России среди мужских команд<br>Суперлига 2009</a></p>');
	document.writeln('<p><a style="font-size:13" href="m03_014.html">Чемпионат России среди женских команд<br>Суперлига 2009</a></p>');
	document.writeln('<p><a href="http://www.nic.ru/?ipartner=516&adv_id=pip001"><img src="http://www.nic.ru/images/banners/ru-center-6.gif" width="120" height="60" border="0" alt="RU-CENTER. Регистрация доменов. Хостинг"></a></p>');

}

function CopyR1()
{
	var str="<a href='http://www.liveinternet.ru/click' "+"target=_blank><img src='http://counter.yadro.ru/hit?t54.10;r"+escape(document.referrer)+((typeof(screen)=="undefined")?"":";s"+screen.width+"*"+screen.height+"*"+(screen.colorDepth?screen.colorDepth:screen.pixelDepth))+";u"+escape(document.URL)+";"+Math.random()+"' alt='' title='LiveInternet: показано число просмотров и"+" посетителей за 24 часа' "+"border=0 width=88 height=31><\/a>"
	document.writeln('<TABLE WIDTH="98%"><TR><td align=center><a href="http://u781.57.spylog.com/cnt?f=3&p=1" target=_blank><img src="http://u781.57.spylog.com/cnt?p=1" alt="SpyLOG" border=0 width=88 height=31></a></td><td align=center>'+str+'</td><TD align=right><a href="../main/infamed.html">© ИнфаМед, 1997-'+new Date().getFullYear()+'</a></TD></TR></TABLE>');
}


function cutString(data,num)
{
	return splitStr(data,num,"#")
}


function splitStr(data,num,delim)
{
	var tmp='';
	var chr='';
	var count=0;

	for(var i=0;i<data.length;i++)
	{
		chr=data.substring(i,i+1);
		if (chr==delim)
		{
			count++;
			if (count==num)
				return (tmp);
			else
				tmp='';
		}
		else
		{
			tmp=tmp+chr
		}
	}
	return (tmp);
}