function update_jump_models(mark_input, model_input, dig, sel){
	
	var mark=document.getElementById(mark_input);
	var tech_model=document.getElementById(model_input);
	if(mark.value!==''){
		tech_model.disabled = true;
		var request = createRequestObject();
		if(!request){
			alert('Простите. Кажется, Ваш браузер не поддерживает технология AJAX. Рекмоендуем Вам воспользовться Internet Explorer или MoZilla. Просим прощения за неудобства.');
			return false;
		} 
		request.onreadystatechange = function() {
			if (request.readyState == 4){
				var models=request.responseText;
				if(models!='0'){
					models=models.split('gggg');
					if(models.length>1){
						tech_model.length = 0;
						for (n in models){
								var this_model=models[n].split('qqqq');
								if(sel && this_model[0]==sel){
									var newoption = new Option(this_model[1],this_model[0], true, true);
								}else{
									var newoption = new Option(this_model[1],this_model[0], true, false);
								}
								tech_model.options[tech_model.length] = newoption;
						}
					}else{
						tech_model.length = 0;
						var newoption = new Option('','', true, false);
						tech_model.options[tech_model.length] = newoption;
					}
					tech_model.disabled = false;
				}else{
					alert('Простите. Кажется, Ваш браузер не поддерживает технология AJAX. Рекмоендуем Вам воспользовться Internet Explorer или MoZilla. Просим прощения за неудобства.');
					return false;
				}
			}
		}
		var url='/include/cat_models.php?cat='+mark.value;
		if(dig==1){
			url=url+'&dig=1';
		}
		request.open("GET",url,true);
		request.send(null);
	}else if(tech_model.length>0){
		tech_model.length = 0;
		var newoption = new Option('','', true, false);
		tech_model.options[tech_model.length] = newoption;
		alert('dsd');
	}
}
function jump(model_input, root){
	var tech_model=document.getElementById(model_input);
	if(tech_model && tech_model.value.length>3){
		window.location.href='/'+root+'/'+tech_model.value;
	}
}
function compair(){
	var model1=document.getElementById('compair_model1').value;
	var model2=document.getElementById('compair_model2').value;
	var model3=document.getElementById('compair_model3').value;
	var models = new Array();
	if(parseInt(model1)>0){
		models.push(parseInt(model1));
	}
	if(parseInt(model2)>0){
		models.push(parseInt(model2));
	}
	if(parseInt(model3)>0){
		models.push(parseInt(model3));
	}
	if(models.length<2){
		alert('Выберите модели для сравнения');
	}else{
		var url='http://www.infocar.com.ua/compare/'+models.join('-')+'.html';
		window.location.href=url;
	}
}
function choose_jump_models(mark_input, model_input, mark_input_value, model_input_value){
	var jump_mark=document.getElementById(mark_input);
	var jump_model=document.getElementById(model_input);
	var n=jump_mark.length;
	for(i=0;i<=n;i=i+1){
		if(jump_mark[i]){
			if(jump_mark[i].value==mark_input_value){
				jump_mark[i].selected=true;
			}
		}
	}
	update_jump_models(mark_input, model_input,1,model_input_value);
}