<!--

function get_type(form) {

	for (var i=0; i < form.contact_prefer.length; i++) {
	
		if (form.contact_prefer[i].checked) {
	
			var rad_val = form.contact_prefer[i].value;
	
		}
	}
	
	return rad_val;
}


/* * *
-- function --
-- ajaxBrowser --
*
This function will determine the XMLHttpRequest or ActiveXObject according to the browser
to allow the AJAX to function properly
* * */
function ajaxBrowser() {

	var ajaxRequest;
	
	// establish the correct request method according to the browser
	try{
		// opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e) {
		// ie
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				// didn't work
				alert("Browser sucks");
				return false;
			}
		}
	}
	
	// return the information back to the calling function
	return ajaxRequest;

} // function

function ajaxFunction(form) {
	
	// show the appropriate loader.gif
	document.getElementById('divjax').innerHTML = "<center><img src='/img/loading.gif'></center>";
	
	// use the ajaxBrowser function to gather Request Methods according to the browser
	var ajaxRequest = ajaxBrowser();
	
	// create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			
			// use: returnResults to place the received information in the correct DIV tag
			var ajaxDisplay = document.getElementById('divjax');
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
											
		} // if
	} // internal function
	
	var full_name =form.full_name.value;
	var email_address = form.email_address.value;
	var street_address = form.street_address.value;
	var city = form.city.value;
	var state = form.state.value;
	var zip_code = form.zip_code.value;
	var mort_sit = form.mort_sit.value;
	var phone_number = form.phone_number.value;
	var contact_prefer = get_type(form);
	var queryString = "?full_name=" + full_name + "&email_address=" + email_address + "&street_address=" + street_address + "&city=" + city + "&state=" + state + "&zip_code=" + zip_code + "&phone_number=" + phone_number + "&contact_prefer=" + contact_prefer;
	queryString += "&mort_sit=" + mort_sit;
	
	// the queryString has been created according to the query type (ajaxQuery)
	// send the GET info to the appropriate php script
	ajaxRequest.open("GET", '/friends/friends-ajax.php' + queryString, true);
	ajaxRequest.send(null);
	
} // function

function toggle(id) {

	if (document.getElementById(id).style.display == '') {
		new Effect.Fade(id, {duration:.5});
	} else {
		new Effect.Appear(id, {duration:.8});
	}

}
		
//-->