 function TestWebFirm(form)
 {
   if ((form.web.value == "") && (form.firm.value == ""))
      {
        alert("Пожалуйста, введите строку поиска в поля 'Товар' или 'Фирма'!")
        return false
      }
   else
		{
		var s = new String(form.web.value)
		var l = s.length
		var s2 = new String(form.firm.value)
		var l2 = s2.length
		if ((l > 0) && (l <= 2) || (l2 > 0) && (l2 <= 2) )
        {
          alert("Длина строки поиска в полях 'Товар' или 'Фирма' должна быть больше 2 символов!")
          return false
        }
        else return true
		}
 }

 function mSubmit()
 {
    document.forms.F_count_pos.submit();
 }
 function f_inweb(value)
 {
   if (F_count_pos.inweb.checked)
      {form_main.inweb.value = value;
       rus.rus.value = value;
      }
      else
      {form_main.inweb.value = ""
       rus.rus.value = "";
      }
 }
 function month()
 {
 	var date = new Date()
	return date.getCalendarMonth
 }

 function f_boxclick(CurrentObject)
 {
	if (CurrentObject.checked)
		{
         CurrentObject.value = "True";
		}
	else
		{
         CurrentObject.value = "False";
		}
 }
 function f_find_in_group(CurrentObject, id_group, id_subgroup)
 {
	if (CurrentObject.checked)
		{
         CurrentObject.value = "True";
         form_main.id_group.value = id_group
         form_main.id_subgroup.value = id_subgroup
		}
	else
		{
         CurrentObject.value = "False";
         form_main.id_group.value = ''
         form_main.id_subgroup.value = ''
		}
 }

// var image_win
 function open_image(id_service, id_hist_image, extended, name, firm, phone, email)
 {
    image_win = window.open("", "Photo", "alwaysRaised=yes, width=660, height=660, screenX=380, screenY=50, top=50, left=400, scrollbars=yes, resizable=yes, location=no, toolbar=no, menubar=no");
 	image_win.document.write('<html>');
	image_win.document.write('<head>');
    image_win.document.write('<title>'+name+'</title>');
	image_win.document.write('<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">');
	image_win.document.write('</head>');
    image_win.document.write('<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">');
    image_win.document.write('<div align="center">');
    image_win.document.write('<img src="'+'/find/images/'+id_service+'/'+id_service+'_'+id_hist_image+extended+'" border="0">');
    image_win.document.write('</div>');
    image_win.document.write('<div align="center">');
    image_win.document.write(name+'<br>');
    image_win.document.write(firm+"<br>тел.&nbsp;"+phone+';&nbsp;email:&nbsp;<a href="mailto:'+email+'">'+email+'</a>');
    image_win.document.write('<hr>');
    image_win.document.write('<form>');
    image_win.document.write('<input type="button" value="Закрыть окно" onclick="self.close()">&nbsp;');
    image_win.document.write('<input type="button" value="Печать" onclick="self.print()">');
    image_win.document.write('</form>');
    image_win.document.write('</div>');
    image_win.document.write('</body>');
    image_win.document.write('</html>');
	image_win.focus();
	image_win.document.close();
 }

 function f_price_gr(id_service, id_city, id_firm, id_group, id_subgroup, firm, web, keyword)
 {
    form_price_gr.id_service.value = id_service;
    form_price_gr.id_city.value = id_city;
    form_price_gr.id_firm.value = id_firm;
    form_price_gr.id_group.value = id_group;
    form_price_gr.id_subgroup.value = id_subgroup;
    form_price_gr.firm.value = firm;
    form_price_gr.web.value = web;
	 form_price_gr.keyword.value = keyword;
    form_price_gr.submit();
 }
 function f_price(id_service, id_city, id_firm, firm, web, keyword)
 {
    form_price.id_service.value = id_service;
    form_price.id_city.value = id_city;
    form_price.id_firm.value = id_firm;
    form_price.firm.value = firm;
    form_price.web.value = web;
    form_price.keyword.value = keyword;
    form_price.submit();
 }
