Please instead of:
if (type == 'curve-hc") { .. }
if (type == 'curve-hc" && invest == "mixed") { .. }
if (type == 'curve-hc" && invest != "mixed") { .. }
use:
if (type == 'curve-hc") { 
   ...
   if (invest == "mixed") 
       { .. }
   else
       { .. }
}