<!--
function removeD(name) {
var boxLength = document.form[name].length;
for (r = boxLength; r >= 1; r--) {document.form[name].options[r] = null;}
}


function ReadCookie(cookieName) {
	var theCookie=""+document.cookie;
	var ind=theCookie.indexOf(cookieName);
	if (ind==-1 || cookieName=="") return ""; 

var indx=theCookie.indexOf(';',ind);
if (indx==-1) indx=theCookie.length; 
return unescape(theCookie.substring(ind+cookieName.length+1,indx));
}


function fillmanu() {
var xtype=document.form.xtype.value;
	if(xtype =="") {xtype=ReadCookie('type');
	document.form.xtype.value=xtype;}	

	for (a = 1; a <= ctmax; a++) {ctx=getNum(a);
	thisval = eval("t"+ctx+"c");
	thistxt = thisval.substring(6,thisval.length);
	document.form.type.options[a] = new Option(thistxt, thisval, false, false);
	if(xtype == thisval) {document.form.type.options[a].selected=true;}
	}
}


function fillmodel() {
var type=document.form.type.value;
	document.cookie="type="+type;

var ctx=type.substring(0,5);

var xmodel=document.form.xmodel.value;
xmodel=xmodel.substring(6,xmodel.length);

	if(xmodel =="") {xmodel=ReadCookie('model');
	document.form.xmodel.value=xmodel;}


document.getElementById("carm").innerHTML="";
removeD('model');
document.getElementById("pcat").innerHTML="";
removeD('vehic');

var typeLength=0;

if (type != "") {typeLength=eval("t"+ctx+"max");	
	for (b = 1; b <= typeLength; b++) {btx=getNum(b);

	thisval = eval("m"+ctx+"_"+btx);
	thistxt = thisval.substring(6,thisval.length);
	document.form.model.options[b] = new Option(thistxt, thisval, false, false);
	if(xmodel == thisval) {document.form.model.options[b].selected=true; fillpartit()}
	}}

//var tname=type.substring(6,type.length);
//document.getElementById("cartyp").innerHTML=tname;

if(xmodel.indexOf(ctx+"_") == -1) {fillCateg();}
}


function fillpartit() {
var model=document.form.model.value;
	document.cookie="model="+model;

var xmodel="";
	if(model =="") {var xmodel=document.form.xmodel.value;
	model=xmodel.substring(6,xmodel.length);}

var mtx=model.substring(0,5);
//var mname=model.substring(6,model.length);
//document.getElementById("carm").innerHTML=mname;

fillCateg();
}


function fillCateg() {
var type=document.form.type.value;
var ctx=type.substring(0,5);
var model=document.form.model.value;
var mtx=model.substring(0,5);

var modeLength=0;
var xvehic=document.form.xvehic.value;
	if(xvehic =="") {xvehic=ReadCookie('vehic');
	document.form.xvehic.value=xvehic;}

removeD('vehic');
document.getElementById("pcat").innerHTML="";

if (model != "") {modeLength=eval("mv"+ctx+"_"+mtx+"max");
var x=0;
	for (c = 1; c <= modeLength; c++) {vtx=getNum(c);
	thisval = eval("v"+ctx+"_"+mtx+"_"+vtx);
	thistxt = thisval.substring(6,thisval.length);
	document.form.vehic.options[c] = new Option(thistxt, thisval, false, false);
	if(xvehic == thisval) {document.form.vehic.options[c].selected=true; 

	//document.getElementById("pcat").innerHTML=thistxt;
	}
	}}
}


function fillPcat() {
var vehic=document.form.vehic.value;
	document.cookie="vehic="+vehic;

//var txt=vehic.substring(6,vehic.length);
//document.getElementById("pcat").innerHTML=txt;
}


function getNum(num) {num=num*1;
if (num<10) {num="0000"+num;} else {
if (num<100) {num="000"+num;} else {
if (num<1000) {num="00"+num;} else {
if (num<10000) {num="0"+num;} else {num=num;}}}}
return num;
}



// -->
