function get_html_request()
{
	try
	{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
		return ajaxRequest;
	}
		catch (e)
		{
			// Internet Explorer Browsers
			try
			{
				ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
				return ajaxRequest;
			} 
				catch (e) 
				{
					try
					{
						ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
						return ajaxRequest;
					} 
						catch (e)
						{
							// Something went wrong
							alert("Your browser broke!");
							return false;
						}
				}
		}
}

function button_hover(button_obj)
{
alert("here");
	var element = document.getElementById(button_obj);
	if(button_obj == "button1")
	{
		element.style.backgroundImage = "url(http://www.christianapp.org/wp-content/uploads/2010/07/dark_green_button11.jpg)";
	}
	else if(button_obj == "button2")
	{
		element.style.backgroundImage = "url(http://www.christianapp.org/wp-content/uploads/2010/07/dark_green_button21.jpg)";
	}
	else if(button_obj == "button3")
	{
		element.style.backgroundImage = "url(http://www.christianapp.org/wp-content/uploads/2010/07/dark_green_button3.jpg)";
	}
	else if(button_obj == "button4")
	{
		element.style.backgroundImage = "url(http://www.christianapp.org/wp-content/uploads/2010/07/dark_green_button4.jpg)";
	}
	else if(button_obj == "button5")
	{
		element.style.backgroundImage = "url(http://www.christianapp.org/wp-content/uploads/2010/07/dark_green_button5.jpg)";
	}
	else if(button_obj == "button6")
	{
		element.style.backgroundImage = "url(http://www.christianapp.org/wp-content/uploads/2010/07/dark_green_button6.jpg)";
	}
	else
	{
		element.style.backgroundImage = "url(http://www.kctechnologee.com/dark_green_button.jpg)";
	}

	element.style.cursor = 'pointer';
}


function button_leave(button_obj)
{
	var element = document.getElementById(button_obj);
	if(button_obj == "button1")
	{
		element.style.backgroundImage = "url(http://www.christianapp.org/wp-content/uploads/2010/07/light_green_button11.jpg)";
	}
	else if(button_obj == "button2")
	{
		element.style.backgroundImage = "url(http://www.christianapp.org/wp-content/uploads/2010/07/light_green_button21.jpg)";
	}
	else if(button_obj == "button3")
	{
		element.style.backgroundImage = "url(http://www.christianapp.org/wp-content/uploads/2010/07/light_green_button3.jpg)";
	}
	else if(button_obj == "button4")
	{
	element.style.backgroundImage = "url(http://www.christianapp.org/wp-content/uploads/2010/07/light_green_button4.jpg)";
	}
	else if(button_obj == "button5")
	{
		element.style.backgroundImage = "url(http://www.christianapp.org/wp-content/uploads/2010/07/light_green_button5.jpg)";
	}
	else if(button_obj == "button6")
	{
		element.style.backgroundImage = "url(http://www.christianapp.org/wp-content/uploads/2010/07/light_green_button6.jpg)";
	}
	else
	{
		element.style.backgroundImage = "url(http://www.kctechnologee.com/light_green_button.jpg)";
	}
}

function gotopage(button_id)
{
	alert(button_id);
	if(button_id == "button1")
	{
		document.location = "https://npo.networkforgood.org/Donate/Donate.aspx?npoSubscriptionId=1001307&code=Website";
	}
	else if(button_id == "button2")
	{
		document.location = "https://npo.networkforgood.org/Donate/Donate.aspx?npoSubscriptionId=1001307&code=Monthly%20Giving-Get%20Involved%20Box";
	}
	else if(button_id == "button3")
	{
		document.location = "http://christianapp.org/vol/";
	}
	else if(button_id == "button4")
	{
		document.location = "mailto:capinfo@chrisapp.org?subject=Prayer Request";
	}
	else if(button_id == "button5")
	{
		document.location = "https://app.e2ma.net/app/view:Join/signupId:57375";
	}
	else if(button_id == "button6")
	{
		document.location = "http://www.christianapp.org/about/corporate-caring-partners/";
	}
	else
	{
		document.location = "http://www.christianapp.org";
	}
}

function submit_mail()
{
alert("New Construction");
var first = document.getElementById('first_name').value;
var middle = document.getElementById('middle_name').value;
var last = document.getElementById('last_name').value;
var company = document.getElementById('company').value;
var add1 = document.getElementById('address1').value;
var add2 = document.getElementById('address2').value;
var city = document.getElementById('city').value;
var state = document.getElementById('state').value;
var zip = document.getElementById('zip').value;
var phone = document.getElementById('phone').value;
if(first == "")
{
alert("Please enter your first name");
document.getElementById('first_name').focus();
}
else if(last == "")
{
alert("Please enter your last name");
document.getElementById('last_name').focus();
}
else if(add1 == "")
{
alert("Please enter your primary address");
document.getElementById('address1').focus();
}
else if(city == "")
{
alert("Please enter your city");
document.getElementById('city').focus();
}
else if(state == "select")
{
alert("Please select your state");
document.getElementById('state').focus();
}
else if(zip == "")
{
alert("Please enter your zip code");
document.getElementById('zip').focus();
}
else
{
	var ajaxRequest = get_html_request();
	var urlstr = "http://www.christianapp.org/write_new_donor.php";
	var date = new Date();
	var timestamp = date.getTime();
	var params = "time="+timestamp+"&first="+first+"&middle="+middle+"&last="+last+"&company="+company+"&add1="+add1+"&add2="+add2+"&city="+city+"&state="+state+"&zip="+zip+"&phone="+phone;

	ajaxRequest.onreadystatechange = function()
	{
		if(ajaxRequest.readyState == 4)
		{			    
			var str = ajaxRequest.responseText;
			alert(str);
		}
	}
	ajaxRequest.open("POST", urlstr, true);
	ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	ajaxRequest.setRequestHeader("Content-length", params.length);
	ajaxRequest.setRequestHeader("Connection", "close");
	ajaxRequest.send(params);
	}

}

function go_home()
{
document.location = "http://www.christianapp.org";
}
