function kind_setcode(v){
	this.data=this.value=v;
	for(var i=0;i<this.child.length;i++)
	{	this.child[i].value=pcode(v,i+1);
		if(i<this.child.length-1)kind_set(this,i);
	}
}
function kind_seek(v){
	for(var i=0;i<this.child.length;i++)
	{	this.child[i].value=pcode(v,i+1);
		if(i<this.child.length-1)kind_set(this,i);
	}
	this.value=K[this.kname][v]?void(0):v;
}
function kind_fill(n,o){
	var k=K[n],l=k[0];
	o.length=parseInt(o.getAttribute("min"));
	for(var i=0;i<l.length;i++)o.options[o.length]=new Option(l[i][1],l[i][0]);
}
function kind_init(n,o){
	var k=K[n],l=k[0];
	o.kname=n;
	o.child=o.getElementsByTagName("SELECT");
	o.seek=kind_seek;
	o.inbox=kind_setcode;
	o.child[0].length=parseInt(o.child[0].getAttribute("min"));
	for(var i=0;i<l.length;i++)o.child[0].options[o.child[0].length]=new Option(l[i][1],l[i][0]);
	for(var i=0;i<o.child.length;i++){
		o.child[i].index=i;
		o.child[i].onchange=function(){o.value=void(0);kind_set(o,this.index)};
	}
}
function kind_set(o,v){
	var l=K[o.kname][o.child[v].value];
	for(var i=v+1;i<o.child.length;i++)o.child[i].length=parseInt(o.child[i].getAttribute("min"));
	if(o.getAttribute("free"))o.value=o.child[v].value;
	if(v==o.child.length-1||!l) return o.value=o.child[v].value;
	for(var i=0;i<l.length;i++)o.child[v+1].options[o.child[v+1].length]=new Option(l[i][1],l[i][0]);
}
function maskup(v)
{	switch(v)
	{	case  1 : return 2139095040;
		case  2 : return 2147450880;
		case  3 : return 2147483520;
		case  4 : return 2147483647;
	}
	return 0;
}
function pcode(v,i){return (parseInt(v) & maskup(i))}