function showmenu(id)
{
		document.getElementById(id).style.visibility  = 'visible';

}

function hidemenu(id)
{
		document.getElementById(id).style.visibility  = 'hidden';
}

var win = null;
function CenterWindow(mypage,myname,w,h,scroll){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
	win = window.open(mypage,myname,settings)
	win.focus()
}

function buy(id) {
	CenterWindow('region-'+id+'.html', 'sertificate',525,640,'yes','resizable');
	return false;
}

function close_wnd ()
{
// предка - перегрузить
window.opener.location.reload();
// себя закрыть
self.close();
return false;
}

var myWinR;
function openIMG(URL,w,h,WName)
{
	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('<html><head><title>Rekam</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 free_catalog_submit()
{
	CenterWindow('/free_catalog.php','free_catalog',300,150,'no');
	document.free_catalog.target='free_catalog';
	document.free_catalog.submit();
}

function resume_submit()
{
	with (document.resume)
	{
		if (resume_file.value == '')
		{
        	alert('Пожалуйста, выберите файл!');
	        return false;
        }
	}
	CenterWindow('/sendmail.php','resume',300,150,'no');
	document.resume.target='resume';
	document.resume.submit();
}

function faq_submit()
{
	with (document.faq)
	{
		if (question.value == '')
		{
        	alert('Пожалуйста, введите Вопрос!');
	        return false;
        }
		if (email.value == '')
		{
        	alert('Пожалуйста, введите E-mail!');
	        return false;
        }
	}
	CenterWindow('/sendmail.php','faq',300,150,'no');
	document.faq.target='faq';
	document.faq.submit();
}

function resume_anketa_submit()
{
	with (document.resume_anketa)
	{
		if (CON_INFO.value == '')
		{
        	alert('Пожалуйста, введите Контактную информацию!');
	        return false;
        }
		if (FAMILIA.value == '')
		{
        	alert('Пожалуйста, введите Фамилию!');
	        return false;
        }
		if (IMA.value == '')
		{
        	alert('Пожалуйста, введите Имя!');
	        return false;
        }
		if (OTCH.value == '')
		{
        	alert('Пожалуйста, введите Отчество!');
	        return false;
        }
		if (DATA_ROJDEN.value == '')
		{
        	alert('Пожалуйста, введите Дату рождения!');
	        return false;
        }
		if (MR_NASEL_PUNKT.value == '')
		{
        	alert('Пожалуйста, введите Место рождения!');
	        return false;
        }
		if (FM_ADRES.value == '')
		{
        	alert('Пожалуйста, введите Место жительства!');
	        return false;
        }
	}
	CenterWindow('/sendmail.php','resume_anketa',300,150,'no');
	document.resume_anketa.target='resume_anketa';
	document.resume_anketa.submit();
}

function popup(href,w,h,name,scrollbars){
  var width=screen.availWidth;
  var height=screen.availHeight;
  var props='';
  
  var left=width<w?0:(width-w)/2;
  var top=height<h?0:(height-h)/2;
  props='scrollbars='+(scrollbars ? '1' : '0')+',directories=0,menubar=0,status=0,toolbar=0,resizable=0,location=0,left='+left+',top='+top+',height='+h+',width='+w;
  var win=window.open(href,name,props);
  win.focus();
  return false;
}
