function ShowBlock(idblockShow,idblockHide)
{

if(idblockShow!=idblockHide){
	var blkShow=document.getElementById('zakladki'+idblockShow);
	var blkHide=document.getElementById('zakladki'+idblockHide);
	var frmShow=document.getElementById('forma'+idblockShow);
	var frmHide=document.getElementById('forma'+idblockHide);
	blkHide.style.display="none";
	blkShow.style.display="block";
	frmHide.style.display="none";
	frmShow.style.display="block";
}
}







/* insert_ajax_script_small_poisk */


/************************************************************************************************************
Ajax chained select
Copyright (C) 2006  DTHMLGoodies.com, Alf Magne Kalleland

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

Dhtmlgoodies.com., hereby disclaims all copyright interest in this script
written by Alf Magne Kalleland.

Alf Magne Kalleland, 2006
Owner of DHTMLgoodies.com


************************************************************************************************************/	
var ajax = new Array();
var ajaxBrand = new Array();
var ajaxModel = new Array();
function chTypeAutoSmallpoisk(sel)
{

	var autotypeCode = sel.options[sel.selectedIndex].value;
	document.getElementById('id_brand_smallpoisk').options.length = 0;	
	// выключаем
	var obj = document.getElementById('id_brand_smallpoisk');
	obj.disabled=true;
	var obj = document.getElementById('id_model_smallpoisk');
	obj.disabled=true;
	
	if(autotypeCode.length>0){
		var index = ajaxBrand.length;
		ajaxBrand[index] = new sack();
		ajaxBrand[index].requestFile = '/auto/scripts/getauto.html?autotype='+autotypeCode;	
		ajaxBrand[index].onLoading = function(){ showBox()};	
		ajaxBrand[index].onCompletion = function(){ hideBox();createBrandSmallpoisk(index) };	
		ajaxBrand[index].runAJAX();		
	}
}

function createBrandSmallpoisk(index)
{
	var obj = document.getElementById('id_brand_smallpoisk');
	obj.disabled=false;
	eval(ajaxBrand[index].response);
}


function chBrandSmallpoisk(sel)
{

	var brandcode = sel.options[sel.selectedIndex].value;
	document.getElementById('id_model_smallpoisk').options.length = 0;	
	if(brandcode.length>0){
		var index = ajaxModel.length;
		ajaxModel[index] = new sack();
		ajaxModel[index].requestFile = '/auto/scripts/getauto.html?brandcode='+brandcode;	
		ajaxModel[index].onLoading = function(){ showBox()};	
		ajaxModel[index].onCompletion = function(){ hideBox();createModelSmallpoisk(index) };	
		ajaxModel[index].runAJAX();
		

	}
}

function createModelSmallpoisk(index)
{
	var obj = document.getElementById('id_model_smallpoisk');
	obj.disabled=false;
	eval(ajaxModel[index].response);

}


function getCityListSmallpoisk(sel)
{
	var countryCode = sel.options[sel.selectedIndex].value;
	document.getElementById('id_gorod_smallpoisk').options.length = 0;	// Empty city select box
	if(countryCode.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		ajax[index].requestFile = '/auto/scripts/getCities.html?countryCode='+countryCode+'&null=yes';	// Specifying which file to get
		ajax[index].onLoading = function(){ showBox()};	
		ajax[index].onCompletion = function(){ hideBox();createCitiesSmallpoisk(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function createCitiesSmallpoisk(index)
{
	var obj = document.getElementById('id_gorod_smallpoisk');
	eval(ajax[index].response);

}


	
