// JavaScript Document
//generic AJAX initialisation
//***Author: JMAMMOUS***
//***Date: Feb 11 2009***
	var commonXHR;
	if (window.XMLHttpRequest)     // Object of the current windows
		{ 
    		commonXHR = new XMLHttpRequest();     // Firefox, Safari, ...
		} 
		else 
 			if (window.ActiveXObject)   // ActiveX version
 				{
    				commonXHR = new ActiveXObject("MSXML2.XMLHTTP");  // Internet Explorer 
 				} 
				
//****************************************************
//start your functions here

//this function cotnrols which actionFunction to call and which page to include
function commonActionMain(actionFunction, actionPage, targetDiv) {
	actionFunction(actionPage, targetDiv);
	return false;
}







function sendAjaxEnquiry(pPropertyID, specificProp, propInfo, devName, pDevID, title, firstname, lastname, email, email1, comments, targetDiv, contactNumber, mobileNumber, address, city, postcode, country, propertyType, bedrooms, budget, currency, notifyPage) {
	if(email.indexOf('@') < 1) {
	alert('Not a valid email address');
	return false;
	}
	
	//check the variables
	if(firstname == '' || lastname == '' || email == '') {
		alert('Please note the following fields are required: \nFirstname \nSurname \nEmail Address');
		return false;
	}
	
	if(email != email1) {
	alert('Please ensure the email addresses match');
	return false;
	}
	
	commonXHR.open("GET", "http://www.pafilia.com/contactMailObject_db.php?pPropertyID=" + pPropertyID + "&specificProp=" + specificProp + "&propInfo=" + propInfo + "&devName=" + devName + "&pDevID=" + pDevID + "&title=" + title + "&firstname=" + firstname + "&lastname=" + lastname + "&email=" + email + "&comments=" + comments + "&sendEnquiry=1&contactNumber="  +contactNumber + "&mobileNumber=" + mobileNumber + "&address=" + address + "&city=" + city + "&postcode=" + postcode + "&country=" + country + "&propertyType=" + propertyType + "&bedrooms=" + bedrooms + "&budget=" + budget + "&currency=" + currency + "&notifyPage=" + notifyPage, true);

		commonXHR.onreadystatechange  = function()
    	{ 
         	if(commonXHR.readyState  == 4)
         	{
			document.getElementById(targetDiv).innerHTML = (commonXHR.responseText);
			
			
			}
       }
	    commonXHR.send(null);
	
	//end function
}

//JMAMMOUS
