function maak_select_aan(quantity){
     if (quantity>30){ //minimum
         alert('Geef een lager getal dan 30');
         return false;
     }
	 else if (quantity==0)
	 {
	 alert('Het aantal moet hoger dan 0');
         return false;
	 }
     else{
         var current_number=$('select.select_class[name="teams[]"]').length; //huidig aantal select
         while (current_number>quantity){
         $('select#select_'+current_number).remove(); //delete last select
         current_number--;
         }         
         while (current_number<quantity){
         
            $('select#select_1').clone().attr("id",'select_'+(current_number+1)).appendTo( $('select#select_1').parent()); //make new select and put in container of other selects
             current_number++;       

   
         }
     }
 }
    

$("input#txt_quantity").live('keyup',function(){

    maak_select_aan($(this).val());
});
                                                              

 $('select.select_class[name="teams[]"]').live('change',function(){ //als de waarde verandert voer de functie uit
   var numberID =$(this).attr("id").substr($(this).attr("id").indexOf("_")+1); //zoek idnummer (na select_) van deze selectbox    
   
 });
