/* для проверки формы отправки заявки*/
function trim(s) {
	while (s.substring(0,1) == ' ') {
		s = s.substring(1,s.length);
	}
	while (s.substring(s.length-1,s.length) == ' ') {
		s = s.substring(0,s.length-1);
	}
return s;
}


function check_send_form(){
	var err = 0;

	if (trim(document.postmessage.code_sent.value) == ""){
		document.getElementById('code_sent').style.backgroundColor="#e9a4a4";
		err=1;
	} else {
		document.getElementById('code_sent').style.backgroundColor="";
	}
	
	if (trim(document.postmessage.from.value) == ""){
		document.getElementById('from').style.backgroundColor="#e9a4a4";
		err=1;
	} else {
		document.getElementById('from').style.backgroundColor="";
	}	

	if (trim(document.postmessage.to.value) == ""){
		document.getElementById('to').style.backgroundColor="#e9a4a4";
		err=1;
	} else {
		document.getElementById('to').style.backgroundColor="";
	}
	
	if (trim(document.postmessage.when.value) == ""){
		document.getElementById('when').style.backgroundColor="#e9a4a4";
		err=1;
	} else {
		document.getElementById('when').style.backgroundColor="";
	}
	
	if (trim(document.postmessage.phone.value) == ""){
		document.getElementById('phone').style.backgroundColor="#e9a4a4";
		err=1;
	} else {
		document.getElementById('phone').style.backgroundColor="";
	}

	
	if (err == 0)
	return true; else return false;
}
