function ImgShw(ID, width, height, alt)
{
      var scroll = "no";
      var top=0, left=0;
      if(width > screen.width-10 || height > screen.height-28) scroll = "yes";
      if(height < screen.height-28) top = Math.floor((screen.height - height)/2-14);
      if(width < screen.width-10) left = Math.floor((screen.width - width)/2-5);
      width = Math.min(width, screen.width-10);
      height = Math.min(height, screen.height-28);
      var wnd = window.open("","","scrollbars="+scroll+",resizable=yes,width="+width+",height="+height+",left="+left+",top="+top);
      wnd.document.write("<html><head>\n");
      wnd.document.write("<"+"script language='JavaScript'>\n");
      wnd.document.write("<!--\n");
      wnd.document.write("function KeyPress()\n");
      wnd.document.write("{\n");
      wnd.document.write("        if(window.event.keyCode == 27)\n");
      wnd.document.write("                window.close();\n");
      wnd.document.write("}\n");
      wnd.document.write("//-->\n");
      wnd.document.write("</"+"script>\n");
      wnd.document.write("<title>\""+alt+"\"</title></head>\n");
      wnd.document.write("<body topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" onKeyPress=\"KeyPress()\">\n");
      wnd.document.write("<a href=# title=Закрыть onclick='window.close()'><img src=\""+ID+"\" border=\"0\" alt=\""+alt+"\"></a>");
      wnd.document.write("</body>");
      wnd.document.write("</html>");
      wnd.document.close();
}

function show_FullPhoto(ID, width, height, alt, title)
{
      if(title == "") title = "Увеличенное изображение";
      var scroll = "no";
      var top=0, left=0;
      if(width > screen.width-10 || height > screen.height-28) scroll = "yes";
      if(height < screen.height-28) top = Math.floor((screen.height - height)/2-14);
      if(width < screen.width-10) left = Math.floor((screen.width - width)/2-5);
      width = Math.min(width, screen.width-10);
      height = Math.min(height, screen.height-28);
      var wnd = window.open("","","scrollbars="+scroll+",resizable=yes,width="+width+",height="+height+",left="+left+",top="+top);
      wnd.document.write("<html><head>\n");
      wnd.document.write("<"+"script language='JavaScript'>\n");
      wnd.document.write("<!--\n");
      wnd.document.write("function KeyPress()\n");
      wnd.document.write("{\n");
      wnd.document.write("        if(window.event.keyCode == 27)\n");
      wnd.document.write("                window.close();\n");
      wnd.document.write("}\n");
      wnd.document.write("//-->\n");
      wnd.document.write("</"+"script>\n");
      wnd.document.write("<title>"+title+"</title></head>\n");
      wnd.document.write("<body topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" onKeyPress=\"KeyPress()\">\n");
      wnd.document.write("<a href=# title=Закрыть onclick='window.close()'><img src=\""+ID+"\" border=\"0\" alt=\""+alt+"\"></a>");
      wnd.document.write("</body>");
      wnd.document.write("</html>");
      wnd.document.close();
      return false;
}


function do_FormValid(sFormName)
{
	var error = new Array();
	error[0] = 'Пожалуйста, заполните все обязательные поля';
	error[1] = 'Пожалуйста, правильно укажите E-mail';
	error[2] = 'Пожалуйста, правильно укажите URL сайта';

	var form = document.forms[sFormName];

	for(var i=0; i<form.elements.length; i++)
	{
		elem = form.elements[i];

	    if(elem.type == 'hidden') continue;

	    if(elem.getAttribute('set') != null)
	    {
	    	if(elem.getAttribute('set').indexOf('*') != -1)
	        {
	        	if(elem.value == '')
	            {
	            	alert(error[0]);
	            	elem.focus();
	                return false;
	            }
	        }

	        if(elem.getAttribute('set').indexOf('mail') != -1 && elem.value != '')
	        {
	        	var reg = /^[A-Za-z0-9_\-\.=+~]+@[A-Za-z0-9_\-\.]+\.[A-Za-z]{2,4}\s*$/;

	            if (elem.value.match(reg) == null)
	            {
	            	alert(error[1]);
	            	elem.focus();
	                return false;
	            }
	        }

	        if(elem.getAttribute('set').indexOf('url') != -1 && (elem.value != ''))
	        {
	        	var reg = /^(http[s]?:\/\/)?[A-Za-z0-9_\-\.]+\.[A-Za-z]{2,4}\s*$/;

	            if (elem.value.match(reg) == null)
	            {
	            	alert(error[2]);
	            	elem.focus();
	                return false;
	            }
	        }
	    }
	}
	return true;
}

var is_city_show = 0, timehide = '';

function tt_city(id)
{
	$('#'+id).toggle();
	return false;
}
function hide_city(id)
{
	clearInterval(timehide);
	timehide = setInterval('hide_city_(\''+id+'\')', 1000);
	return false;
}
function hide_city_(id)
{
	$('#'+id).hide();
	return false;
}
function not_hide_city(id)
{
	clearInterval(timehide);
	return false;
}
