// JavaScript Document

function sendEmail() {
	
    var xmlHttpReq = false;
	
    try {	// Mozilla/Safari
		
        xmlHttpReq = new XMLHttpRequest();
    }
	catch (e1) {	// IE
		
		try {
			
	  		xmlHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e2) {
			
			try {
				
				xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e3) {
				
				xmlHttpReq = false;
			}
		}
	}
	
	var contact_name = document.getElementById('contact_name').value;
	var contact_email = document.getElementById('contact_email').value;
	var contact_phone = document.getElementById('contact_phone').value;
	var message = document.getElementById('message').value;	
	
	var strURL = "media_union.php?contact_name="+contact_name+"&contact_email="+contact_email+"&contact_phone="+contact_phone+"&message="+message;
	
    xmlHttpReq.open('GET', strURL, false);
  
    xmlHttpReq.onreadystatechange = function() {
		
        if ( xmlHttpReq.readyState == 4 ) {
						
			if ( xmlHttpReq.status  == 200 ) {
			
				updatepage("Your enquiry has been sent successfully!");
				document.getElementById('contact_form').style.display = 'none';
			}
        }
    }
	
    xmlHttpReq.send( null );
}

function updatepage(str){
	
   document.getElementById("footer").innerHTML = str;
}

