var myWinR;
function openIMG(URL,WName,w,h)
{
	if (myWinR != null && !myWinR.closed) myWinR.close();  
	sw = screen.width-100;
	sh = screen.availHeight-100;
	if (w > sw || h > sh)
	{
		if (w > sw) {w1 = sw;} else {w1 = w+17;}
		if (h > sh) {h1 = sh;} else {h1 = h+17;}
		mtw1 = (screen.width-w1)/2;
		mth1 = (screen.availHeight-h1)/2;
		myWinR = window.open('', WName, "width="+w1+",height="+h1+",top="+mth1+",left="+mtw1+",status=no,toolbar=no,scrollbars=yes,resizable=no,menubar=no");
		myWinR.focus();
	}
	else
	{
		mtw = (screen.width-w)/2;
		mth = (screen.availHeight-h)/2;
    	myWinR = window.open('', WName, "width="+w+",height="+h+",top="+mth+",left="+mtw+",status=no,toolbar=no,scrollbars=no,resizable=no,menubar=no");
		myWinR.focus();
	}
  	myWinR.document.writeln('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title>Егоров и Ко.</title></head><body style="margin: 0px;"><a href="javascript:window.close();"><img src='+URL+' border=0 width='+w+' height='+h+' alt="Закрыть окно"></a></body></html>');
}

function check_board()
{
	if (document.getElementById('name').value == '')
	{
       	alert('Пожалуйста, введите Имя!');
        return false;
	}
	if (document.getElementById('email').value == '')
	{
       	alert('Пожалуйста, введите E-mail!');
        return false;
	}
    else
	{
		if (document.getElementById('email').value.match(/[^a-zA-Z0-9@_.-]/i) || !document.getElementById('email').value.match(/[a-zA-Z0-9+._]+@([a-zA-Z0-9-.]+)+(\.[a-zA-Z]{2,})/i))
		{
			alert('Пожалуйста, введите правильный E-mail!'); 
			return false;
		}
	}
	if (document.getElementById('phone').value == '')
	{
       	alert('Пожалуйста, введите Телефон!');
        return false;
	}
	if (document.getElementById('city').value == '')
	{
       	alert('Пожалуйста, введите Город!');
        return false;
	}
	if (document.getElementById('topic').value == '')
	{
       	alert('Пожалуйста, введите Тему!');
        return false;
	}
	if (document.getElementById('message').value == '')
	{
       	alert('Пожалуйста, введите Сообщение!');
        return false;
	}
}
