function wkl(ident){
    Wformat(ident);
    var t=arguments;
    for(var i=1; i<t.length; i++){
	var wyp=document.getElementById('wyp_'+t[i]);
	if(wyp!=null){ wyp.checked=false; Wformat(wyp) }
    }
    sprawdzajForm_spec();
    //_get('wynik').innerHTML=genWyp();
    //alert(genWyp());
}

function Wformat(ident){    
    if(ident==null) return '';
    var format=ident.getAttribute('format');
    var skrot =ident.getAttribute('skrot');
    var out=skrot;
    if(format!=undefined){
	var identp=_get(ident.id+'p');
	if(identp!=undefined){
	    identp.style.display=(ident.checked)? '':'none';
	    if(identp.value!=''){
		out=format.replace(/\[[^\]]+\]/g,identp.value);
		out=out.replace('(SK)',skrot);
	    }
	} 
    }
    return out;
}

function genWyp(){
    var wyp_opc='';
    for(var i=0; i<100;i++){
        var ident=_get('wyp_'+i);
	if(ident!=null){
	    if(ident.checked)
		wyp_opc+=Wformat(ident)+', ';        
	}else break;	    
    }
    return wyp_opc.replace(/(, )$/g,'');
}


function maska(ident,format){
    var value=ident.value;
    if(format.match(/H/g)) ident.value=value.toUpperCase();
    else
    if(format.match(/C/g)) ident.value=value.replace(/[^0-9]/g,'');
    wkl(ident);
}


function Mshow(id,Mmax){
    for(i=0;i<Mmax;i++){
	var ident=_get('elem_'+i);
	if(ident!=null)
	ident.style.display=(i==id)? '':'none';
    }

}

