

function toggle_state_visibility(country_field_name, state_field_name){
    country_ref = document.getElementById(country_field_name);
    state_ref = document.getElementById(state_field_name);
    
    if((country_ref) && (state_ref)){
        if((country_ref.value == 'US') || (country_ref.value == 'CA')){
            state_ref.style.visibility = "visible";
        }
        else{
            state_ref.value = '';
            state_ref.style.visibility = "hidden";
        }
    }
}


function highlightSelectedBrands(){
    var selectedList = document.getElementById("brands_selected");

    for(i=0; i<selectedList.length; i++){
        selectedList[i].selected=true;
    }

}

function check_add_to_cart_fields(){
    form_ref = document.getElementById('cart');
    
    size_ref = document.getElementById('size');
    quantity_ref = document.getElementById('quantity');

    if(size_ref.value == ''){
        alert('Please select a size');
    }
    else if(quantity_ref.value == ''){
        alert('Please select a quantity');
    }
    else{
        form_ref.submit();
    }
}


function buttonHoverout(){
    var file = this.src.split("1.gif");
    
    if(file[0].indexOf(".gif", 0) == -1){
        this.src = file[0] + ".gif";   
    }
    else{
        this.src = file[0];
    }
}

function initBrandNav(){
    var bn = document.getElementById("brandnav");
    bn.innerHTML = "<div class=\"top\"></div>" + bn.innerHTML + "<div class=\"bot\"></div>";
}

/*left over from old product highlights */
function fillup(){
    
}
