var _650bbdropdefault;
var _700bbdropdefault;
var _650forkoffsetdefault;
var _700forkoffsetdefault;
var _headangledefault;

function set700Defaults(){
    document.calcForm.fork_length.value = '372';
    document.calcForm.bb_drop.value = _700bbdropdefault;
    document.calcForm.fork_offset.value = _700forkoffsetdefault;
    document.calcForm.chain_stay.value = '395';
    document.calcForm.rear_wheel.value = '334';
}

function set650Defaults(){
    document.calcForm.fork_length.value = '322';
    document.calcForm.bb_drop.value = _650bbdropdefault;
    document.calcForm.fork_offset.value = _650forkoffsetdefault;
    document.calcForm.chain_stay.value = '385';
    document.calcForm.rear_wheel.value = '284';
}

function setAllDefaults(){
    document.calcForm.stack.value = '0';
    document.calcForm.reach.value = '0';
    document.calcForm.seat_angle.value = '78';
    document.calcForm.hs_lower_stack.value = '1.5';
    document.calcForm.head_angle.value = _headangledefault;
    setStandardLeggedDefaultValues();
    set700Defaults();
    document.calcForm.wheel_size[0].checked = true;
    document.calcForm.morphology[0].checked = true;
    if (document.calcForm.coordinates.value == 'serotta_xy') {
    	document.calcForm.serottaX.value = '0';
    	document.calcForm.serottaY.value = '0';
    	document.calcForm.stem_angle.value = '6';
    	document.calcForm.clamp.value = '0';
    	document.calcForm.spacer.value = '0';
    	document.calcForm.headset.value = '0';
    }
}

function setLongLeggedDefaultValues(){
    _650bbdropdefault = '55';
    _700bbdropdefault = '80';
    _650forkoffsetdefault = '43';
    _700forkoffsetdefault = '48';
    _headangledefault = '71.5';
    document.calcForm.head_angle.value = _headangledefault;
    
    if(document.calcForm.wheel_size[0].checked == true){
        document.calcForm.bb_drop.value = _700bbdropdefault;
        document.calcForm.fork_offset.value = _700forkoffsetdefault;
    }else{
        document.calcForm.bb_drop.value = _650bbdropdefault;
        document.calcForm.fork_offset.value = _650forkoffsetdefault;
    }
}

function setStandardLeggedDefaultValues(){
    _650bbdropdefault = '45';
    _700bbdropdefault = '70';
    _650forkoffsetdefault = '40';
    _700forkoffsetdefault = '45';
    _headangledefault = '72';
    document.calcForm.head_angle.value = _headangledefault;

    if(document.calcForm.wheel_size[0].checked == true){
        document.calcForm.bb_drop.value = _700bbdropdefault;
        document.calcForm.fork_offset.value = _700forkoffsetdefault;
    }else{
        document.calcForm.bb_drop.value = _650bbdropdefault;
        document.calcForm.fork_offset.value = _650forkoffsetdefault;
    }
}

function initDefaults(){
    setStandardLeggedDefaultValues();
    setAllDefaults();
}

function checkAgreeToTerms(){
    if(document.calcForm.terms.checked == true)
        document.calcForm.submit();
    else
        alert('You must accept our terms first.');
}

//window.onload = initDefaults;
