//<![CDATA[
function showhide(whichSection) {
	
	var currCheckbox = whichSection;
	var currSection = whichSection + 'Info';

	if (document.getElementById(currCheckbox).checked == true) {
		document.getElementById(currSection).style.display = "block";
	}

	if (document.getElementById(currCheckbox).checked != true) {
		document.getElementById(currSection).style.display = "none";
	}

}

//CUSTOM HIDE/SHOW SCRIPTS FOR PROFILE UPDATE YOUR FAMILY PAGE
function showhideCustom(whichSelect, showValue, showBlock) {

	var currSelectMenu = whichSelect;

	if(showValue == null) {
	    showValue = 'NotListed';
	}

	var currSection = showBlock;
	if(showBlock == null) {
	    currSection = whichSelect + 'NotListed';
	}

	//var testVar = document.getElementById(currSelectMenu);
	//alert('Selection by you = ' + document.getElementById(currSelectMenu).value);

	if (document.getElementById(currSelectMenu).value == showValue) {
		//alert('Displaying ' + currSection);
		document.getElementById(currSection).style.display = "block";
	} else {
		//alert('Hiding ' + currSection);
		document.getElementById(currSection).style.display = "none";
	}

}


//CUSTOM HIDE/SHOW SCRIPTS FOR PROFILE UPDATE YOUR SHOPPING PAGE
function showhideAddNewShipping(whichSection, allShippingDivs) {

        // First hide all;
        hideAllShippingDivs(allShippingDivs);
        
        var currCheckbox = whichSection;

	if (document.getElementById(currCheckbox).checked == true) {
		document.getElementById('shipChooseNickname').selectedIndex = 0;
		document.getElementById('newShipNickname').style.display = "block";
		document.getElementById('newShippingFields').style.display = "block";
	} else {
		document.getElementById('existingShipNickname').style.display = "block";
	}

}

function showhideExistingShipping(whichSection, allShippingDivs) {

        // First hide all;
        hideAllShippingDivs(allShippingDivs);
        
        // Now display the appropriate div
        var currSelectMenu = whichSection;
        
	if (document.getElementById(currSelectMenu).value != "") {
		document.getElementById('existingShipNickname').style.display = "block";
		document.getElementById(document.getElementById(currSelectMenu).value).style.display = "block";
	} else {
		document.getElementById('existingShipNickname').style.display = "block";
	}

}

function hideAllShippingDivs(allShippingDivs) {
        document.getElementById('existingShipNickname').style.display = "none";
        for(var i=0; i<allShippingDivs.length; i++) {
                document.getElementById(allShippingDivs[i]).style.display = "none";
        }
        document.getElementById('newShipNickname').style.display = "none";
        document.getElementById('newShippingFields').style.display = "none";
}

function hideAllBillingDivs(allBillingDivs) {
        document.getElementById('existingBillNickname').style.display = "none";
        for(var i=0; i<allBillingDivs.length; i++) {
                document.getElementById(allBillingDivs[i]).style.display = "none";
        }
        document.getElementById('newBillNickname').style.display = "none";
        document.getElementById('newBillingFields').style.display = "none";
}

function showhideAddNewBilling(whichSection, allBillingDivs) {
        hideAllBillingDivs(allBillingDivs);
	var currCheckbox = whichSection;

	if (document.getElementById(currCheckbox).checked == true) {
		document.getElementById('ccChooseCreditCardNickName').selectedIndex = 0;
		document.getElementById('newBillNickname').style.display = "block";
		document.getElementById('newBillingFields').style.display = "block";
	} else {
		document.getElementById('existingBillNickname').style.display = "block";
	}

}

function showhideExistingBilling(whichSection, allBillingDivs) {
        hideAllBillingDivs(allBillingDivs);
	var currSelectMenu = whichSection;

	if (document.getElementById(currSelectMenu).value != "") {
		document.getElementById('existingBillNickname').style.display = "block";
		document.getElementById(document.getElementById(currSelectMenu).value).style.display = "block";
	} else {
		document.getElementById('existingBillNickname').style.display = "block";
	}

}
//]]>

