<!--
//=================================================================================================
//=================================================================================================
//                                                                                               ==
//                    jjjjjjjjjj     aaaaaaaaaa     vv      vv     aaaaaaaaaa                    ==
//                    jjjjjjjjjj     aaaaaaaaaa     vv      vv     aaaaaaaaaa                    ==
//                        jj         aa      aa     vv      vv     aa      aa                    ==
//                        jj         aa      aa     vv      vv     aa      aa                    ==
//                        jj         aaaaaaaaaa      vv    vv      aaaaaaaaaa                    ==
//                        jj         aaaaaaaaaa      vv    vv      aaaaaaaaaa                    ==
//                    jj  jj         aa      aa       vv  vv       aa      aa                    ==
//                    jj  jj         aa      aa       vv  vv       aa      aa                    ==
//                    jjjjjj         aa      aa        vvvv        aa      aa                    ==
//                    jjjjjj         aa      aa         vv         aa      aa                    ==
//                                                                                               ==
//                                                                                               ==
//                                                                                               ==
//     ssssssssss     cccccccccc     rrrrrrrrrr     iiiiiiiiii     pppppppppp     tttttttttt     ==
//     ssssssssss     cccccccccc     rrrrrrrrrr     iiiiiiiiii     pppppppppp     tttttttttt     ==
//     ss             cc             rr      rr         ii         pp      pp         tt         ==
//     ss             cc             rr      rr         ii         pp      pp         tt         ==
//     ssssssssss     cc             rrrrrrrrrr         ii         pppppppppp         tt         ==
//     ssssssssss     cc             rrrrrrrrrr         ii         pppppppppp         tt         ==
//             ss     cc             rr   rr            ii         pp                 tt         ==
//             ss     cc             rr    rr           ii         pp                 tt         ==
//     ssssssssss     cccccccccc     rr     rr      iiiiiiiiii     pp                 tt         ==
//     ssssssssss     cccccccccc     rr      rr     iiiiiiiiii     pp                 tt         ==
//                                                                                               ==
//=================================================================================================
//=================================================================================================
//     target:  http://thecharityguild.org                                                       ==
//     author:  brite ventures                                                                   ==
//     hello :  thanks for looking!                                                              ==
//=================================================================================================
//=================================================================================================

//--------------------
// show/hide elements 
//--------------------

function idShow(divid) {
	document.getElementById(divid).style.display="block";
}
function idHide(divid) {
	document.getElementById(divid).style.display="none";
}
function btnShow(divid,btnid) {
	document.getElementById(divid).style.display="block";
	document.getElementById(btnid).href = "javascript:btnHide('" + divid + "','" + btnid + "');";
	document.getElementById(btnid).innerHTML = "Hide&nbsp;&Lambda;";
}
function btnHide(divid,btnid) {
	document.getElementById(divid).style.display="none";
	document.getElementById(btnid).href = "javascript:btnShow('" + divid + "','" + btnid + "');";
	document.getElementById(btnid).innerHTML = "Show&nbsp;&#8744;";
}

//--------------------
// sidebar navigation 
//--------------------

function sbNav(menu,divid) {

//-- newsletter

	var sb_news = new Array();

	n = 0;
	sb_news[n] = "v02n02";

	n++;
	sb_news[n] = "v02n01";

	n++;
	sb_news[n] = "v01n03";

	n++;
	sb_news[n] = "v01n02";

	n++;
	sb_news[n] = "v01n01";

	if (menu == 'news') {
		for (i = 0; i < sb_news.length; i++) {
			document.getElementById(sb_news[i]).style.display = "none";
		}
	}

	document.getElementById(divid).style.display = "block";
}

//------------------------
// body onload functions
//------------------------

function loadContact() {
	document.getElementById('mq').innerHTML = '<iframe style="height: 525px; width: 650px;" src="http://www.mapquest.com/embed#b/maps/m:map:12:42.075303:-71.019314::::::1:1:::::::::/l:Charity+Guild+Inc:501+Main+St:Brockton:MA:02301:US:42.07531:-71.01931:address::1:::264256587/e" marginwidth="0" marginheight="0" scrolling="no" frameborder="0"></iframe>';
}
function selOne(sel_id) {
	document.getElementById(sel_id).selectedIndex = 1;
}

//--------------------------
// photo gallery functions
//--------------------------

function galShow(gal_photo,max_nbr) {

	gal_id = gal_photo.substr(0,12);

	photo_nbr = (gal_photo.substr(13,2) * 1);

	photodd_id = gal_id + "-photodd";

	prev_id = gal_id + "-prev";
	next_id = gal_id + "-next";

	prev_nbr = photo_nbr == 1       ? gal_id + "-" + max_nbr : gal_id + "-" + ((photo_nbr * 1) - 1);
	next_nbr = photo_nbr == max_nbr ? gal_id + "-" + "1"     : gal_id + "-" + ((photo_nbr * 1) + 1);

	document.getElementById(prev_id).href = "javascript:galShow('" + prev_nbr + "'," + max_nbr + ");";
	document.getElementById(next_id).href = "javascript:galShow('" + next_nbr + "'," + max_nbr + ");";

	document.getElementById(photodd_id).selectedIndex = ((photo_nbr * 1) - 1);

	document.getElementById(gal_photo).style.display = "block";

	for (i = 1; i <= max_nbr; i++) {

		gal_photo_id = gal_id + "-" + i;
		gal_photo_th = gal_id + "-" + i + "-th";
		capt_id = gal_id + "-" + i + "-capt";

		if (i == photo_nbr) {
			document.getElementById(capt_id).style.display = "block";
			document.getElementById(gal_photo_th).setAttribute("class","selected");
		} else {
			document.getElementById(gal_photo_id).style.display = "none";
			document.getElementById(capt_id).style.display = "none";
			document.getElementById(gal_photo_th).setAttribute("class","unselect");
		}
	}
}

//----------------
// form functions 
//----------------

//*-- clear form input field --*

function clearValue(id) {
	document.getElementById(id).value = "";
	return false;
}

//*-- donation form --*

function amtChg() {

	var i     = document.getElementById('amt').selectedIndex;
	var amt   = document.getElementById('amt').options[i].value;
	var dtype = document.getElementById('dtype').value;

	var freq_sel = '<select id="freq" name="freq">';
	var freq_sel = freq_sel + '<option value="One Time"<?php if ($freq == "One Time") {echo " selected=\"selected\"";} ?>One Time</option>';
	var freq_sel = freq_sel + '<option value="Monthly"<?php if ($freq == "Monthly") {echo " selected=\"selected\"";} ?>Monthly</option>';
	var freq_sel = freq_sel + '<option value="Quarterly"<?php if ($freq == "Quarterly") {echo " selected=\"selected\"";} ?>Quarterly</option>';
	var freq_sel = freq_sel + '<option value="Semi-Annually"<?php if ($freq == "Semi-Annually") {echo " selected=\"selected\"";} ?>Semi-Annually</option>';
	var freq_sel = freq_sel + '<option value="Annually"<?php if ($freq == "Annually") {echo " selected=\"selected\"";} ?>Annually</option>';
	var freq_sel = freq_sel + '</select>';

	var freq_one ='<select id="freq" name="freq">';
	var freq_one = freq_one + '<option value="One Time" selected="selected">One Time</option>';
	var freq_one = freq_one + '</select>';

	if (dtype == "PayPal") {
		if (amt == 'Other') {
			document.getElementById('freqsel').innerHTML = freq_one;
		} else {
			document.getElementById('freqsel').innerHTML = freq_sel;
		}
	}
}

//*-- membership application --*

function memAmtChg() {

	var i = document.getElementById('memlen').selectedIndex;

	var lifetime_corporate  = "$2,000";
	var lifetime_family     = "$350";
	var lifetime_individual = "$200";

	var annual_corporate    = "$200";
	var annual_family       = "$35";
	var annual_individual   = "$20";

	if (i == 0) {
		document.getElementById('memtype-corporate').innerHTML  = annual_corporate;
		document.getElementById('memtype-family').innerHTML     = annual_family;
		document.getElementById('memtype-individual').innerHTML = annual_individual;
	} else {
		document.getElementById('memtype-corporate').innerHTML  = lifetime_corporate;
		document.getElementById('memtype-family').innerHTML     = lifetime_family;
		document.getElementById('memtype-individual').innerHTML = lifetime_individual;
	}
}

function payOptChg() {

	var i = document.getElementById('payopt').selectedIndex;

	var paypal_text  = "You will be<br />transferred to PayPal<br />after submitting<br />this form.";
	var mailin_text  = "Mail your check to<br />The Charity Guild<br />with your printed<br />application.";

	if (i == 0) {
		document.getElementById('payoptxt').innerHTML  = paypal_text;
	} else {
		document.getElementById('payoptxt').innerHTML  = mailin_text;
	}
}

//*-- holiday concert ticket reservations --*

function qtyChg() {

	var qty25 = document.getElementById('qty25').value > 0 ? document.getElementById('qty25').value : 0;
	var qty55 = document.getElementById('qty55').value > 0 ? document.getElementById('qty55').value : 0;

	var subtot25 = document.getElementById('subtot25').value > 0 ? document.getElementById('subtot25').value : 0;
	var subtot55 = document.getElementById('subtot55').value > 0 ? document.getElementById('subtot55').value : 0;

	qty25 = document.getElementById('qty25').selectedIndex;
	qty25 = qty25 * 1;
	subtot25 = qty25 * 25;
	document.getElementById('subtot25').value = subtot25;

	qty55 = document.getElementById('qty55').selectedIndex;
	qty55 = qty55 * 1;
	subtot55 = qty55 * 55;
	document.getElementById('subtot55').value = subtot55;

	var totamt = subtot25 + subtot55;
	document.getElementById('totamt').value = totamt;
	document.getElementById('balancedue').innerHTML = "$" + totamt;
}

//*-- confirm form button --*

function confirmThis(msg,formid) {

	var d = confirm(msg);

	if (d==true) {
		document.forms[formid].submit();
	}
}


//-->

