function ShowHide(table_id)
{
if (!document.getElementById) 
	{
	alert("Ваш браузер очень устарел и не поддерживает данный сервис!");
	return false;
	}

obj=document.getElementById(table_id);	

if (!obj) return false;

if (obj.style.display=="none") obj.style.display="block";
else obj.style.display="none";

return false;
}


function add_row(n,name)
{
table = document.getElementById('table_prices');
num = table.rows.length;
row = table.insertRow(num);

if (mest==1) 
	{
	mst1=1;
	mst2=2;
	}
else 
	{
	mst1=3;
	mst2=4;
	}

table.rows[num].insertCell(0);
table.rows[num].cells[0].innerHTML="<a href=./nomera"+id+"_"+n+".html>"+name+"</a>";
table.rows[num].cells[0].style.fontWeight = 'bold';
table.rows[num].cells[0].style.borderbottom = 'dotted 1px #EAE3DF';
table.rows[num].insertCell(1);
table.rows[num].cells[1].innerHTML=prices[n][sezon][mst1];
table.rows[num].cells[1].style.textAlign = 'center';
table.rows[num].cells[1].style.padding = '2px';
table.rows[num].cells[1].style.backgroundColor = '#F4EDDF';
table.rows[num].insertCell(2);
table.rows[num].cells[2].innerHTML=prices[n][sezon][mst2];
table.rows[num].cells[2].style.textAlign = 'center';
table.rows[num].cells[2].style.borderbottom = 'dotted 1px #EAE3DF';
table.rows[num].insertCell(3);
table.rows[num].cells[3].innerHTML="<a href=./zakaz"+id+"_"+n+".html>Забронировать</a>";
table.rows[num].cells[3].style.textAlign = 'center';
table.rows[num].cells[3].style.padding = '2px';
table.rows[num].cells[3].style.backgroundColor = '#F4EDDF';
}

		
function clear_table()
{
table=document.getElementById('table_prices');
count=table.rows.length;
for (i=1;i<count;i++) table.deleteRow(1);
}


function show_prices()
{
if (sezon!=-1)
{
clear_table();
count=nomera.length;
for (i=0;i<count;i++)
	{
	nom=nomera[i].split('|');
	add_row(nom[0],nom[1]);
	}
}
}


function checkform(theForm)
{
digits="0123456789";
var num_value=theForm.num.value;
rg=/^\w*([-+.]\w+)*\w@([0-9a-z]+(-[0-9a-z]+)*[.])+[a-z]{2,3}$/;

if (theForm.gorod.value=="")
	{
	alert("Укажите пожалуйста Ваш город.");
	theForm.gorod.focus();
	return (false);
	}
if (theForm.tel.value=="")
	{
	alert("Укажите пожалуйста Ваш телефон.");
	theForm.tel.focus();
	return (false);
	}
if (theForm.email.value=="" || !rg.test(theForm.email.value))
	{
	alert("Проверьте пожалуйста правильность введенного адреса E-mail.");
	theForm.email.focus();
	return (false);
	}
if (theForm.num.value=="")
	{
	alert("Укажите пожалуйста количество номеров.");
	theForm.num.focus();
	return (false);
	}
for(i=0;i<num_value.length;i++)
	{
	if (digits.indexOf(num_value.charAt(i))<0)
		{
		alert("Количество номеров может быть указано только цифрами.")
		theForm.num.focus();
		return (false);
		}
	}
if (theForm.day_in.value+theForm.month_in.value+theForm.year_in.value==theForm.day_out.value+theForm.month_out.value+theForm.year_out.value)
	{
	alert("Уточните пожалуйста даты Вашего пребывания в гостинице.");
	theForm.day_in.focus();
	return (false);
	}
return (true);
}


function check_registration(theForm)
{
rg=/^\w*([-+.]\w+)*\w@([0-9a-z]+(-[0-9a-z]+)*[.])+[a-z]{2,3}$/;

if (theForm.hotel_id.value==-1)
	{
	alert("Выберите пожалуйста гостиницу.");
	theForm.hotel_id.focus();
	return (false);
	}
if (theForm.login.value=="" || !rg.test(theForm.login.value))
	{
	alert("Проверьте пожалуйста правильность введенного адреса E-mail.");
	theForm.login.focus();
	return (false);
	}
return (true);
}


function check_otzyv(theForm)
{
if (theForm.name.value=="")
	{
	alert("Представьтесь пожалуйста.");
	theForm.name.focus();
	return (false);
	}
if (theForm.text.value=="")
	{
	alert("Добавьте пожалуйста Ваш отзыв о гостинице.");
	theForm.text.focus();
	return (false);
	}
return (true);
}


function search_pages(tab,num)
{
for (var i = 1; i <= num; i++) 
	document.getElementById('page_'+i).style.display = "none";   

for (var i = 1; i <= num; i++) 
	document.getElementById('tab_'+i).className = "upTab";   

var active_tab=document.getElementById(tab);

active_tab.className = "upTabActive";
document.getElementById(active_tab.getAttribute('page_id')).style.display = "block";
}

