// JavaScript Document
function clearSearchAll(){
	document.advancedSearch.srch_all.value = 0;
}
// Script and Functions for Donation Form
var section2Time = 0;
var section2RebelutionStatus = false;
var section2GoodnewsStatus = false;
var section3Status = false;

var donationMinistry = '';
var donationAmount = '';
var tempVar

function donationSection3(input){
	if (section3Status == false){
		new Effect.SlideDown('donation_3', {duration:1});
		setTimeout('new Effect.ScrollTo(\'donation_3\');', 1000);
		section3Status = true;
		donationAmount = input.options[input.selectedIndex].value;
	}
	else if (input.selectedIndex == 0){
		new Effect.SlideUp('donation_3', {duration:1});
		section3Status = false;
		donationAmount = 0;
	}
}

function donationShowMinistry(theElement){
	if ((section2RebelutionStatus == true) && (theElement != 'donation_2_rebelution')){
		new Effect.SlideUp('donation_2_rebelution', {duration:1});
		section2RebelutionStatus = false;
		$('rebelutionSelect').selectedIndex = 0;
		if (section3Status){
			donationSection3($('rebelutionSelect'));
		}
		donationAmount = 0;
	}
	if ((section2GoodnewsStatus == true) && (theElement != 'donation_2_goodnews')){
		new Effect.SlideUp('donation_2_goodnews', {duration:1});
		section2GoodnewsStatus = false;
		$('goodnewsSelect').selectedIndex = 0;
		if (section3Status){
			donationSection3($('goodnewsSelect'));
		}
		donationAmount = 0;
	}
	if ((theElement == 'donation_2_rebelution') && (section2RebelutionStatus == false)){
		setTimeout('new Effect.SlideDown(\''+theElement+'\', {duration:1});',section2Time);
		setTimeout('new Effect.ScrollTo(\''+theElement+'\');',section2Time + 1000);
		donationMinistry = 'rebelution';
		section2RebelutionStatus = true;
		section2Time = 1000;
	}
	else if((theElement == 'donation_2_goodnews') && (section2GoodnewsStatus == false)){
		setTimeout('new Effect.SlideDown(\''+theElement+'\', {duration:1});',section2Time);
		setTimeout('new Effect.ScrollTo(\''+theElement+'\');',section2Time + 1000);
		donationMinistry = 'good_news_project';
		section2GoodnewsStatus = true;
		section2Time = 1000;
	}
}

function submitDonationForm(){
	document.donationForm.elements[6].value = donationMinistry;
	document.donationForm.elements[8].value = donationAmount;
	document.donationForm.submit();
}

// Script and Functions for Rebelution Registration Form
function rebregValidate(){
	var problems = "";
	if (document.regForm.elements[8].value == ''){
		problems = problems + "First Name, ";
	}
	if (document.regForm.elements[10].value == ''){
		problems = problems + "Last Name, ";
	}
	if (document.regForm.elements[12].value == ''){
		problems = problems + "Address, ";
	}
	if (document.regForm.elements[14].value == ''){
		problems = problems + "City, ";
	}
	if (document.regForm.elements[16].value == ''){
		problems = problems + "State, ";
	}
	if (document.regForm.elements[18].value == ''){
		problems = problems + "Postal Code, ";
	}
	if (document.regForm.elements[20].value == ''){
		problems = problems + "Country, ";
	}
	if (document.regForm.elements[22].value == ''){
		problems = problems + "Phone, ";
	}
	if (document.regForm.elements[24].value == ''){
		problems = problems + "Email, ";
	}
	if (document.regForm.elements[26].value == ''){
		problems = problems + "Church, ";
	}
	if (document.regForm.elements[28].value == ''){
		problems = problems + "Schooling, ";
	}
	if (document.regForm.elements[30].value == ''){
		problems = problems + "How di you hear?, ";
	}
	if (problems != ""){
		return problems;
	}
	else{
		return true;
	}
}


var confCharlotteStatus = 1;
var confPortlandStatus = 0;
var confDallasStatus = 0;
var confMinneapolisStatus = 0;
var confDenverStatus = 0;
var confDesMoinesStatus = 0;
var confGaithersburgStatus = 0;

var priceCharlotteStatus = 1;
var pricePortlandStatus = 0;
var priceDallasStatus = 0;
var priceMinneapolisStatus = 0;
var priceDenverStatus = 0;
var priceDesMoinesStatus = 0;
var priceGaithersburgStatus = 0;

function updatePricingHideAll(){
	Element.hide('rebregPricingCharlotte');
	priceCharlotteStatus = 0;
	Element.hide('rebregPricingPortland');
	pricePortlandStatus = 0;
	Element.hide('rebregPricingDallas');
	priceDallasStatus = 0;
	Element.hide('rebregPricingMinneapolis');
	priceMinneapolisStatus = 0;
	Element.hide('rebregPricingDenver');
	priceDenverStatus = 0;
	Element.hide('rebregPricingDesMoines');
	priceDesMoinesStatus = 0;
	Element.hide('rebregPricingGaithersburg');
	priceGaithersburgStatus = 0;
	
}
function updatePricingShow(theValue){
	if(theValue == 'charlotte'){
		Element.show('rebregPricingCharlotte');
		priceCharlotteStatus = 1;
	}
	if(theValue == 'portland'){
		Element.show('rebregPricingPortland');
		pricePortlandStatus = 1;
	}
	if(theValue == 'dallas'){
		Element.show('rebregPricingDallas');
		priceDallasStatus = 1;
	}
	if(theValue == 'minneapolis'){
		Element.show('rebregPricingMinneapolis');
		priceMinneapolisStatus = 1;			
	}
	if(theValue == 'denver'){
		Element.show('rebregPricingDenver');
		priceDenverStatus = 1;			
	}
	if(theValue == 'desmoines'){
		Element.show('rebregPricingDesMoines');
		priceDesMoinesStatus = 1;			
	}
	if(theValue == 'gaithersburg'){
		Element.show('rebregPricingGaithersburg');
		priceGaithersburgStatus = 1;			
	}
}

function updateRebregHideAll(){
		Element.hide('rebregConfirmCharlotte');
		confCharlotteStatus = 0;
		Element.hide('rebregConfirmPortland');
		confPortlandStatus = 0;
		Element.hide('rebregConfirmDallas');
		confDallasStatus = 0;
		Element.hide('rebregConfirmMinneapolis');
		confMinneapolisStatus = 0;
		Element.hide('rebregConfirmDenver');
		confDenverStatus = 0;
		Element.hide('rebregConfirmDesMoines');
		confDesMoinesStatus = 0;
		Element.hide('rebregConfirmGaithersburg');
		confGaithersburgtatus = 0;
}

function updateRebregShow(theValue){
	if(theValue == 'charlotte'){
		Element.show('rebregConfirmCharlotte');
		confSacramentoStatus = 1;
	}
	if(theValue == 'portland'){
		Element.show('rebregConfirmPortland');
		confPortlandStatus = 1;
	}
	if(theValue == 'dallas'){
		Element.show('rebregConfirmDallas');
		confDallasStatus = 1;
	}
	if(theValue == 'minneapolis'){
		Element.show('rebregConfirmMinneapolis');
		confMinneapolisStatus = 1;
	}
	if(theValue == 'denver'){
		Element.show('rebregConfirmDenver');
		confDenverStatus = 1;
	}
	if(theValue == 'desmoines'){
		Element.show('rebregConfirmDesMoines');
		confDesMoinesStatus = 1;
	}
	if(theValue == 'gaithersburg'){
		Element.show('rebregConfirmGaithersburg');
		confGaithersburgStatus = 1;
	}

}

function updateRebregConfirm(theValue){
	updateRebregHideAll()
	updateRebregShow(theValue);	
	updatePricingHideAll();
	updatePricingShow(theValue);
}

function rebregSubmit(){
	var rebregValidateValue = rebregValidate();
	if (rebregValidateValue == true){
		document.regForm.submit();
	}
	else{
		alert('Please complete the following fields: ' + rebregValidateValue);
	}
}
