function choosesearch(where) {
	if (navigator.appName!='Netscape Navigator') {
		document.all['searchsource'].value = where;
	}
	else {
		document.input['searchsource'].value = where;
	}
}

function checksubmit(what) {
	if (navigator.appName!='Netscape Navigator') {
		string = document.all['searchstring'].value;
	}
	else {
		string = document.input['searchstring'].value;
	}
	
	if (string=='' & what=='search') {
		alert ('Поле поиска не заполнено!');
		return false;
	}
	else {
		return true;
	}
	
	
}


function check_form(checkform)
{
var er_string="";
var er_flag=true;

// ticket
if 	(checkform.id=='order') 
	{
	var messages = [
	"Не указан город/аэропорт вылета \n", 
	"Не указан город/аэропорт назначения \n", 
	"Не указана или указана неверно дата вылета \n", 
	"Проверьте указанное Вами количество билетов \n", 
	"Не указано контактное лицо \n", 
	"Не указан контактный телефон \n",];
	
		if (checkform["depcity"].value=='') 
		{
			er_string = er_string + messages[0]; 
			er_flag=false;
		}
		
		if (checkform["arrcity"].value=='') 
		{
			er_string = er_string + messages[1]; 
			er_flag=false;
		}
		
		if (checkform["dateday"].value==0 || checkform["datemonth"].value==0) 
		{
			er_string = er_string + messages[2]; 
			er_flag=false;
		}
		
		if (checkform["tcount1"].value<=0 && checkform["tcount2"].value<=0 && checkform["tcount3"].value<=0) 
		{
			er_string = er_string + messages[3]; 
			er_flag=false;
		}
		
		if (checkform["tcount1"].value<=0 && checkform["tcount2"].value<=0 && checkform["tcount3"].value>0) 
		{
			er_string = er_string + messages[3]; 
			er_flag=false;
		}
		
		if (checkform["contact"].value=='') 
		{
			er_string = er_string + messages[4]; 
			er_flag=false;
		}
		
		if (checkform["phone"].value=='') 
		{
			er_string = er_string + messages[5]; 
			er_flag=false;
		}
	}

// plain
if 	(checkform.id=='plainform') 
	{
	var messages = [
	"Не указан ни один город/аэропорт вылета \n", 
	"Не указан ни один город/аэропорт назначения \n",
	"Не указана или указана неверно дата вылета \n", 
	"Не выбран самолет \n", ];	
		if (checkform["depcity1"].value=='' && checkform["depcity2"].value=='' && checkform["depcity3"].value=='' && checkform["depcity4"].value=='') 
		{
			er_string = er_string + messages[0]; 
			er_flag=false;
		}
		
		if (checkform["arrcity1"].value=='' && checkform["arrcity2"].value=='' && checkform["arrcity3"].value=='' && checkform["arrcity4"].value=='') 
		{
			er_string = er_string + messages[1]; 
			er_flag=false;
		}
		if (checkform["depdate1"].value=='' && checkform["depdate2"].value=='' && checkform["depdate3"].value=='' && checkform["depdate4"].value=='') 
		{
			er_string = er_string + messages[2]; 
			er_flag=false;
		}
		if (checkform["plain"].value=='0' || checkform["plain"].value=='1' || checkform["plain"].value=='2' || checkform["plain"].value=='3') 
		{
			er_string = er_string + messages[3]; 
			er_flag=false;
		}
	}
// plain
if 	(checkform.id=='form') 
	{
	var messages = [
	"Не указано ФИО \n",
	"Не указан email адрес \n",
	"Не указана тема сообщения \n",
	"Сообщение пусто. Введите какой-нибудь текст.", ];	
		if (checkform["fio"].value=='') 
		{
			er_string = er_string + messages[0]; 
			er_flag=false;
		}
		if (checkform["email"].value=='') 
		{
			er_string = er_string + messages[1]; 
			er_flag=false;
		}
		if (checkform["theme"].value=='') 
		{
			er_string = er_string + messages[2]; 
			er_flag=false;
		}
		if (checkform["message"].value=='') 
		{
			er_string = er_string + messages[3]; 
			er_flag=false;
		}
		
	}
	
if (!er_flag) 
	{
		alert (er_string);
	}
//er_flag=false;	
return er_flag;	

}

function fillRetForm(form) {
	if (form.checked) { 
		document.all["retform"].innerHTML="<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"95%\" align=\"center\"><tr><td class=\"formtable\" width=\"50%\"><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"t11_b_n\"><tr><td><input type=\"radio\" name=\"rettimetype\" value=\"out\"></td><td>Время вылета</td></tr><tr><td><input type=\"radio\" name=\"rettimetype\" value=\"in\"></td><td>Время прилета</td></tr></table></td><td width=\"50%\" class=\"formtable\"><select name=\"rettimerange\" class=\"t10_b_n\"><option value=\"1\">любое</option><option value=\"2\">ночь</option><option value=\"3\">утро</option><option value=\"4\">день</option><option value=\"5\">вечер</option></select></td></tr><tr><td class=\"formtable\">Дата</td><td class=\"formtable\"><select name=\"retdateday\" class=\"t10_b_n\"><option>--</option><option value=\"1\">01</option><option value=\"2\">02</option><option value=\"3\">03</option><option value=\"4\">04</option><option value=\"5\">05</option><option value=\"6\">06</option><option value=\"7\">07</option><option value=\"8\">08</option><option value=\"9\">09</option><option value=\"10\">10</option><option value=\"11\">11</option><option value=\"12\">12</option><option value=\"13\">13</option><option value=\"14\">14</option><option value=\"15\">15</option><option value=\"16\">16</option><option value=\"17\">17</option><option value=\"18\">18</option><option value=\"19\">19</option><option value=\"20\">20</option><option value=\"21\">21</option><option value=\"22\">22</option><option value=\"23\">23</option><option value=\"24\">24</option><option value=\"25\">25</option><option value=\"26\">26</option><option value=\"27\">27</option><option value=\"28\">28</option><option value=\"29\">29</option><option value=\"30\">30</option><option value=\"31\">31</option></select><select name=\"retdatemonth\" class=\"t10_b_n\"><option>------</option><option value=\"1\">января</option><option value=\"2\">февраля</option><option value=\"3\">марта</option><option value=\"4\">апреля</option><option value=\"5\">мая</option><option value=\"6\">июня</option><option value=\"7\">июля</option><option value=\"8\">августа</option><option value=\"9\">сентября</option><option value=\"10\">октября</option><option value=\"11\">ноября</option><option value=\"12\">декабря</option></select></td></tr><tr><td class=\"formtable\">Авиакомпания, выполняющая обратный рейс</td><td class=\"formtable\"><input maxlength=\"200\" size=\"35\" class=\"t10_b_n\" type=\"text\" name=\"retcomp\"></td></tr><tr><td class=\"formtable\">Номер рейса</td><td class=\"formtable\"><input maxlength=\"200\" size=\"35\" class=\"t10_b_n\" type=\"text\" name=\"retflightn\"></td></tr></table>";
	 /* */
	}
	else
	{
		document.all["retform"].innerHTML="";
	}
}
 
function clearFormConfirm(formtype) {
	if (confirm ("Вы уверены что хотите удалить все данные из формы?"))
		{
			eval("self.location.replace('/index.php?id="+formtype+"&action=clear')");
		}
		
}