function Copy_Address(){
	thefrm = document.frm;
	el = thefrm.Billing_Address_Copy_Donor_Address;
	if ( el.checked ) {
		thefrm.Billing_Address.value = thefrm.Donor_Address.value;
		thefrm.Billing_Address2.value = thefrm.Donor_Address2.value;
		thefrm.Billing_City.value = thefrm.Donor_City.value;
		thefrm.Billing_State.selectedIndex = thefrm.Donor_State.selectedIndex;
		thefrm.Billing_Zip.value = thefrm.Donor_Zip.value;
		thefrm.Billing_Country.value = thefrm.Donor_Country.value;
	} else {
		thefrm.Billing_Address.value = '';
		thefrm.Billing_Address2.value = '';
		thefrm.Billing_City.value = '';
		thefrm.Billing_State.value = '';
		thefrm.Billing_Zip.value = '';
		thefrm.Billing_Country.value = '';
	}
}
function hide_show(){
	frm = document.frm;
	if ( frm.Gift_Amount[5].checked ) {
		
		document.getElementById('Div_Gift_Amount_Other').style.display = 'block';
	} else {
		
		document.getElementById('Div_Gift_Amount_Other').style.display = 'none';
	}
}
function hide_show2(){
	frm = document.frm;
	if ( frm.Preferred_Contact_Method[0].checked ) {
		
		document.getElementById('Div_Preferred_Phone_Time').style.display = 'block';
	} else {
		
		document.getElementById('Div_Preferred_Phone_Time').style.display = 'none';
	}
}

function hide_show3(){
	numchildren = document.frm.Number_Children.value;
	for ( i=1; i<=10; i++ ) {
		if ( numchildren != '--Select--' && numchildren >= i ) {
			document.getElementById('Child'+i).style.display = 'block';
		} else {
			document.getElementById('Child'+i).style.display = 'none';
		}
	}
}

function loadEvents(){
	if ( document.frm.Billing_Address_Copy_Donor_Address ) {
		document.frm.Billing_Address_Copy_Donor_Address.onclick = Copy_Address;
	}
	if ( document.getElementById('Div_Gift_Amount_Other') ) {
		document.frm.Gift_Amount[5].onclick = hide_show;
		document.frm.Gift_Amount[0].onclick = hide_show;
		document.frm.Gift_Amount[1].onclick = hide_show;
		document.frm.Gift_Amount[2].onclick = hide_show;
		document.frm.Gift_Amount[3].onclick = hide_show;
		document.frm.Gift_Amount[4].onclick = hide_show;
	}
	if ( document.getElementById('Div_Preferred_Phone_Time') ) {
		document.frm.Preferred_Contact_Method[0].onclick = hide_show2;
		document.frm.Preferred_Contact_Method[1].onclick = hide_show2;
		document.frm.Preferred_Contact_Method[2].onclick = hide_show2;
	}
	if ( document.getElementById('Number_Children') ) {
		document.frm.Number_Children.onchange = hide_show3;
	}
}
function setActiveStyleSheet(title) {
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1
        && a.getAttribute("title")) {
       a.disabled = true;
       if(a.getAttribute("title") == title) a.disabled = false;
     }
   }
}

window.onload=loadEvents;
