// ajaxhandler.js


// Perform the search
function NewContent(p) {
//alert (p);
	filename = "/Modules/Content.php?query=" + p; 
	
	ajaxCallback = GetResponse;	// handle the Ajax response
	ajaxRequest(filename);			// Send the Ajax request
}

// Process Ajax response
function GetResponse() {
	$("#Content").html(ajaxreq.responseText);  // ****** try to delete Content and replace it by new one
}

function Mailer() {
//	alert ('function: Mailer started');

//Get the data from all the fields
	var name = document.getElementById("idname").value;
	var email = document.getElementById("idemail").value;
	var subject = document.getElementById("idsubject").value;
	var comment = document.getElementById("idcomments").value;
	var ctrl = document.getElementById("idctrl").value;        
        
//organize the data properly
	var data = 'name=' + name + '&email=' + email + '&subject='
	+ subject + '&comment='  + encodeURIComponent(comment) + '&code=' + ctrl;
//	alert (data);

	document.getElementById('Content').innerHTML = '<p>your email has been submitted</p>';
	
	ajaxCallback = GetResponse;	// handle the Ajax response
	ajaxRequestPost(data);			// Send the Ajax request
}
