function open_map() {
		window.open('', 'map', 'scrollbars=1,width=720,height=650,top=0,left=0');
}

function show_write_us() {
	document.getElementById("write_us").style.display="block";
}
function hide_write_us() {
	document.getElementById("write_us").style.display="none";
}

function validate() {
		if (document.message.first_name.value=="") {
			document.message.first_name.focus();
			alert("Name must be filled in");
			return false;
		}
		if (document.message.surname.value=="") {
			document.message.surname.focus();
			alert("Surname must be filled in");
			return false;
		}
		if (document.message.mail.value=="") {
			document.message.mail.focus();
			alert("E-mail must be filled in");
			return false;
		}
		if (document.message.phone.value=="") {
			document.message.phone.focus();
			alert("Phone must be filled in");
			return false;
		}
		if (document.message.message.value=="") {
			document.message.message.focus();
			alert("Message must be filled in");
			return false;
		}
		return true;
	}
	
	function sendMessage() {
		if (! validate()) return;
		
		if (window.ActiveXObject) {
        	httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
        } else {
          	httpRequest = new XMLHttpRequest();
        }
        httpRequest.open("POST", "send_message.php", true);
        httpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        httpRequest.onreadystatechange=function() {processRequest(); } ;
        httpRequest.send("mail="+document.message.mail.value+"&subject="+document.message.subject.value+"&surname="+document.message.surname.value+"&first_name="+document.message.first_name.value+"&phone="+document.message.phone.value+"&message="+document.message.message.value);
	}
	
	function processRequest() {
		if (httpRequest.readyState==4) {
    		if(httpRequest.status==200) {
      			alert("Thank you. Your e-mail was sent successfully.");
			hide_write_us();
    		} else {
        		alert("Error sending message. ");
    		}
  		}
	}
	
	