



function changeval()
{
  document.getElementById('op').style.display = 'none';
  var val1 = document.myForm.sel1.value;

//---------------------------------------------------------------

document.myForm.pret_mat.value=pret_mat[val1];

document.myForm.pret_op.value=0;

//---------------------------------------------------------------



 var optionArray_txt = eval("sub" + val1);
 var optionArray_val = eval("id_sub" + val1);

  var ss = document.myForm.sel2;
  ss.options.length = 0;

  
if(optionArray_txt.length>1)
 document.getElementById('op').style.display = 'inline';

  for(var ff=0; ff<optionArray_txt.length; ff++)
  {
   var txt = optionArray_txt[ff];
   var val = optionArray_val[ff];
   ss.options[ff] = new Option(txt,val);

  }

change_price();

}


function changeval_op()
{
var val2 = document.myForm.sel2.value;
document.myForm.pret_op.value=pret_op[val2];
change_price();
}


function change_tot()
{
if(!document.myForm.cant.value=='')
change_price('f');
}






function change_price(comut)
{


var per=1;
var total=0;
var pret=parseFloat(document.myForm.pret.value);
var mat=document.myForm.sel1.value;
var op;

var op_final='';
var lung;
var lat;

var stringus;
var bc;



lung=document.myForm.lung.value.replace(',','.');
lung=parseFloat(lung);


lat=document.myForm.lat.value.replace(',','.');
lat=parseFloat(lat);




if(isNaN(lat)==true || isNaN(lung)==true)
{
lat=1;
lung=1;
per=0;
}

//total=((lat*lung/10000)*(pret+parseFloat(pret_mat[mat])));




total=pret+parseFloat(pret_mat[mat]);



for(i=0;i<document.myForm.c.length;i++){
if(document.myForm.c[i].checked==true && comut=='f'){
op=document.myForm.c[i].value;	
total=total+parseFloat(pret_op[op]);
op_final=op_final+'#'+document.myForm.c[i].value ;
}
}





document.myForm.op_final.value=op_final;

total=(lat*lung/10000)*total;


total=(parseInt(total*100))/100;
total=total*per;


var x = new Number(total);
//document.getElementById('total').innerHTML = x.toFixed(2);


stringus=x.toFixed(2);
bc=parseFloat(document.myForm.cant.value);
bc=stringus*parseFloat(document.myForm.cant.value);

var x = new Number(bc);
bc=x.toFixed(2);

document.getElementById('total').innerHTML=stringus.replace( '.',',' );
document.getElementById('total1').innerHTML=bc.replace( '.',',' );


}



