Changing sales stage I think this code is not optimized:

function changeSalesStage(value){

    var $form = $( getProductsForm() );

    if( typeof(value) == 'undefined' ) value = $("#sales_stage", $form).val();

    // Failure
    var cause = $("#causes_failure", $form);
    var notes = $("#failure_notes", $form);
    var seconder = $("#seconder", $form);

    if( cause.length == 0 || seconder.length == 0 ) return;

    var el1 = cause.parentsUntil('tr');
    var el2 = notes.parentsUntil('tr');
    var el3 = seconder.parentsUntil('tr');
    var display = 'none';
    if(value == 'Closed Lost'){
        el1.css('display', '');
        el2.css('display', '');
        el1.prev().css('display', '');
        el2.prev().css('display', '');
        el3.css('display', 'none');
        el3.prev().css('display', 'none');
        seconder.val('');
    }
    else if(value == 'IdentifyAnalysis') {
        el3.css('display', '');
        el3.prev().css('display', '');
        cause.val('');
        notes.val('');
        el1.css('display', 'none');
        el2.css('display', 'none');
        el1.prev().css('display', 'none');
        el2.prev().css('display', 'none');
    }
    else {
        display = 'none';
        el3.css('display', display);
        el3.prev().css('display', display);
        el1.css('display', display);
        el2.css('display', display);
        el1.prev().css('display', display);
        el2.prev().css('display', display);
    }
    // validate
    var formname = $form.attr('name');
    var formname1 = $form.attr('name1');
    if( typeof(validate[formname1]) == 'undefined' ) {return;}
    else if( typeof(validate[formname]) == 'undefined' ) return;

    var index = -1, label, name = "causes_failure", name1 = "seconder";
    for( i=0; i &lt; validate[formname].length ||  i &lt; validate[formname1].length; i++ ) {
        if( validate[formname][i][nameIndex] == name || validate[formname][i][nameIndex] == name1){
            index = i;
            label = validate[formname][i][msgIndex];
            label = validate[formname1][i][msgIndex];
            break;
        }
    }
    if( index == -1 ) return;

    if( display == 'none' ) {
        cause.val('');
        notes.val('');
        seconder.val('');
        validate[formname][index][requiredIndex] = false;
        validate[formname1][index][requiredIndex] = false;
    }
    else {
        validate[formname][index][requiredIndex] = true;
        validate[formname1][index][requiredIndex] = true;
    }
}
It's not "unoptimized". it's just bad.


your JS code shouldn't contain CSS manipulation (unless you are actually making complex animations) 
even when your if and for statements have a single line following it, that code should be wrapped in { .. }
use === when comparing values, unless you explicitly require behaviour, that is provided by == loose comparison
you should use meaningful variable names, instead of el1, el2, etc.
none of this required jQuery
don't define variables in the middle of a function