/* unhides the tell a friend form */
function showTellFriend(){
    show("email_to_friend");
    return false;
}

/* Hides all Elements in array A */
function hideAll(A){
    for (var i = 0; i < A.length; i++){
        document.getElementById(A[i]).style.display="none";
    }
}

/* Shows all Elements in array A */
function showAll(A){
    for (var i = 0; i < A.length; i++){
        document.getElementById(A[i]).style.display="block";
    }
}

/* Show just one element */
function show(E){
    document.getElementById(E).style.display="block";
}

/* hide just one element */
function hide(E){
    document.getElementById(E).style.display="none";
}

/* shows hides the correct affiliate forms fields */
function showAffFields(selectOption){
    /* payment_check is also there but not implemented in our HTML */
    if (selectOption.value == "paypal"){
        hideAll(Array("payment_check", "payment_bank"));
        show("payment_paypal");
    } else if (selectOption.value == "check"){
        hideAll(Array("payment_bank", "payment_paypal"));
        show("payment_check");
    } else if (selectOption.value == "bank"){
        hideAll(Array("payment_check", "payment_paypal"));
        show("payment_bank");
    } else {
        //throw error, should never happen
        alert("You Must Select one of PayPal, Check, or Direct Deposite");
        showAll(array("payment_bank", "payment_paypal"));
    }
}

function selectTextInID(id){
    var element = document.getElementById(id);
    element.focus();
    element.select();
}