function init(){
    var x = document.getElementById('add_form');
}
function FormSelect(a,form){
        sel = document.getElementById('type['+form+']');
        for(var i = sel.options.length-1; i>=0; i--){
            sel.remove(i);
        }
    if(a==1){
        alert("Вы нажали первую кнопку");
        option1 = document.createElement("option");
        option2 = document.createElement("option");
        option1.text = 'шерховистая';
        option1.value = 'шерховистая';
        sel.appendChild(option1);
        option2.text = 'гладкая';
        option2.value = 'гладкая';
        sel.appendChild(option1);
        sel.appendChild(option2);
    }
    if(a==2){
        alert("Вы нажали вторую кнопку");
        option1 = document.createElement("option");
        option2 = document.createElement("option");
        option1.text = 'шерховистая 2';
        option1.value = 'шерховистая 2';
        sel.appendChild(option1);
        option2.text = 'гладкая 2';
        option2.value = 'гладкая 2';
        sel.appendChild(option1);
        sel.appendChild(option2);
    }
    
    
}
function addForm(){
    var x = document.getElementById('main_form');
    index = Math.floor(x.elements.length/3);
    var y = document.getElementById('form');
    var z = document.getElementById('for_forms');
    var br1 = document.createElement("br");
    var br2 = document.createElement("br");
    
    var fDiv = document.createElement("div");
    fDiv.setAttribute('id','form');
    
    var fInput1 = document.createElement("input");
    fInput1.setAttribute('type','radio');
    fInput1.setAttribute('value','1');
    fInput1.setAttribute('checked','true');
    fInput1.setAttribute('onClick','FormSelect(1,'+(index+1)+')');
    fInput1.setAttribute('name','cl['+(index+1)+']');
    fDiv.appendChild(fInput1);
    var text = document.createTextNode("Отечественная");
    fDiv.appendChild(text);
    
    var fInput2 = document.createElement("input");
    fInput2.setAttribute('type','radio');
    fInput2.setAttribute('value','2');
    fInput2.setAttribute('onClick','FormSelect(2,'+(index+1)+')');
    fInput2.setAttribute('name','cl['+(index+1)+']');
    fDiv.appendChild(fInput2);
    var text = document.createTextNode("Импортная");
    fDiv.appendChild(text);
    fDiv.appendChild(br2);
    
    var table = document.createElement("table");
    var tr = document.createElement("tr");
    var td1 = document.createElement("td");
    td1.textContent = "Тип ленты";
    var select1 = document.createElement("select");
    var option1 = document.createElement("option");
    var option2 = document.createElement("option");
    option1.text = 'шерховистая';
    option1.value = 'шерховистая';
    select1.setAttribute('name', 'type['+(index+1)+']');
    select1.setAttribute('id', 'type['+(index+1)+']');
    option2.text = 'гладкая';
    option2.value = 'гладкая';
    select1.appendChild(option1);
    select1.appendChild(option2);
    var td2 = document.createElement("td");
    td2.appendChild(select1);
    tr.appendChild(td1);
    tr.appendChild(td2);
    table.appendChild(tr);
    fDiv.appendChild(table);
    
    z.appendChild(fDiv);
    
    a =2;
    return false;
}
