function ClientWidth() {
	return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
}

function ClientHeight() {
	return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
}	

function ScrollLeft() {
	return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.scrollLeft:document.body.scrollLeft;
}

function ScrollTop() {
	return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.scrollTop:document.body.scrollTop;
}	



function openMessage(id) 
{
	if (id && id>0)
	{
		var win=document.getElementById('form_window_answer');
		document.getElementById('answer_id').value=id;
	}
	else 
	{
		var win=document.getElementById('form_window');
	}
		
		
	win.style.display='block';

	resLeft=((ClientWidth()-win.clientWidth)/2)+ScrollLeft();
	resTop=150+ScrollTop();
	win.style.left=resLeft+'px';
	win.style.top=resTop+'px';
}

function closeMessage() 
{
	document.getElementById('form_window_answer').style.display='none';
	document.getElementById('form_window').style.display='none';
}

function checkSend(form) {
	
	if ((form.name && form.name.value=='') || (form.email && form.email.value=='') || (form.text && form.text.value=='') || (form.text2 && form.text2.value==''))
	{
		alert('Некоторые поля остались пустыми');
		return false;
	}
	
	return true;
}
