// JavaScript Document



function checkInput(form, field, text) {
	if(document[form][field].value=="") {
	document[form][field].style.backgroundColor='#B5E6F2';
	alert(text);
	return false;
	}
	else {
	document[form][field].style.backgroundColor='#ffec68';
	return true;
	}
}

function OpenFile(url) {
	shown='';
if( shown=='' || shown.closed) {
	shown=window.open(url,'OpenFile','scrollbars=yes,status=no, high,width=550,height=300');
}
else{ 
	shown.close();
	shown=window.open(url,'OpenFile','scrollbars=no,status=no, high,width=300,height=300');
	}
}


function sendEmail(form) {
	if(!checkInput(form, 'name', 'Введите имя'))
	return false;
	
	if(!checkInput(form, 'surname', 'Введите фамилию'))
	return false;
	
	if(!checkInput(form, 'email', 'Введите e-mail'))
	return false;
	
	if(!checkInput(form, 'message', 'Введите текст сообщения'))
	return false;
		
	return true;
}

function moveObject(id){
		document.getElementById(id).runtimeStyle.posLeft = event.x + 50;
		document.getElementById(id).runtimeStyle.posTop = event.y - 100;
		document.getElementById(id).style.display = 'block';
}

function hideObject(id) {
	document.getElementById(id).style.display = 'none';
}
