function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}

addLoadEvent(function() {
	for (var z=0; z < document.getElementsByTagName("select").length; z++)				  
    document.getElementsByTagName("select")[z].selectedIndex = 0;
})


var myrules = {
	
      
      '.input_select' : function(el){
		el.onchange = function(){
		 
           go();
            


			return false;
		}

	}
  
  };

Behaviour.register(myrules);





var dooropen = true;
var fixprice;   

function go(){
	if(document.getElementById("id_prix")!= undefined ){     
             var printer;
         if (dooropen){dooropen = false;
         
         	
		
		
             var pricestr = document.getElementById("id_prix").firstChild.nodeValue;
             pricestr = pricestr.replace('.','');
             var pcb = pricestr.lastIndexOf("b");
             var pck = pricestr.lastIndexOf(",");
             var pce = pricestr.lastIndexOf("E");
           
             fixprice =( parseFloat(pricestr.substring((pcb+1),pck)) )  +  (( parseFloat(pricestr.substring((pck+1),pce)) )/100);   
                     
                              }
              var pnnz = fixprice;
			  for (var i=0; i < document.getElementsByTagName("select").length; i++){
              var wert=document.getElementsByTagName("select")[i].options;
              var x=document.getElementsByTagName("select")[i].options[wert.selectedIndex].firstChild.nodeValue;
              x = x.replace('.','');
              var pz = x.lastIndexOf("+");
       	if(pz!=(-1)){
             var kz = x.lastIndexOf(",");
             var ez = x.lastIndexOf("E");
             
             var nz =( parseFloat(x.substring((pz+1),kz)) )  +  (( parseFloat(x.substring((kz+1),ez)) )/100);     
         
             pnnz = pnnz + nz; 
	                }
			  }
            printer = 'ab ' + pnnz.toFixed(2) + ' EUR';
            printer = printer.replace('.',',');
            if(pnnz >=1000)printer = printer.slice(0,printer.length-10) + '.' + printer.slice(printer.length-10,printer.length);            

            document.getElementById("id_prix").firstChild.nodeValue = printer;
          }
                   
          
}


