// JavaScript Document
function limpia(campo,texto)
	{
	if(campo.value=="")
		campo.value=texto
	}

function vacio(q) 
	{
	for (i=0;i<q.length;i++ ) 
		{
  	if (q.charAt(i)!=" ") 
		{
    	return true
		}
    }
    return false
	}

function indicadores()
{
		if(typeof(arrValores) != "undefined")
		if(typeof(arrValores[55])=="object")
			xajax_indicadores_economicos('1',formatear_numero(arrValores[55].valor2));

}
	
function Valida_Rut(Objeto){
var tmpstr = "";
var intlargo = document.getElementById(Objeto).value;
 if (intlargo.length > 0){ 	
    
    	crut = document.getElementById(Objeto).value 
    	largo = crut.length;
    
    if ( largo < 2 )
    {
        alert('rut inválido')
        Objeto.focus()
        return false;
    }
    for ( i=0; i < crut.length ; i++ ) 
                if ( crut.charAt(i) != ' ' && crut.charAt(i) != '.' && crut.charAt(i) != '-' )
                {
                tmpstr = tmpstr + crut.charAt(i);
                }
            rut = tmpstr;
    crut=tmpstr;
    largo = crut.length;

    if ( largo > 2 )
        rut = crut.substring(0, largo - 1);
    else
        rut = crut.charAt(0);

    dv = crut.charAt(largo-1);

    if ( rut == null || dv == null )
            return 0;

    var dvr = '0';
    suma = 0;
    mul  = 2;

    for (i= rut.length-1 ; i >= 0; i--)
    {
        suma = suma + rut.charAt(i) * mul;
        if (mul == 7)
            mul = 2;
        else
            mul++;
    }


    res = suma % 11;
    if (res==1)
        dvr = 'k';
    else if (res==0)
        dvr = '0';
    else
    {
        dvi = 11-res;
        dvr = dvi + "";
    }


    if ( dvr != dv.toLowerCase() )
    {
	alert('El Rut Ingreso es Invalido')
	document.getElementById(Objeto).focus()
    return false;
    }
//	xajax_formato_rut_xajax(document.getElementById(Objeto).value,document.getElementById(Objeto).id)	;
  }   
  }   

function validar_comparar()
	{

	if(document.getElementById('categoria_1').value=='0'){
		alert("Por favor selecceione la categoria.");
		document.getElementById('categoria_1').focus();
		return false;
	}
	else if(document.getElementById('categoria_2').value=='0'){
		alert("Por favor selecceione la categoria.");
		document.getElementById('categoria_2').focus();
		return false;
	}
	else if(document.getElementById('marca_1').value=='0'){
		alert("Por favor selecceione la marca.");
		document.getElementById('marca_1').focus();
		return false;
	}
	else if(document.getElementById('marca_2').value=='0'){
		alert("Por favor selecceione la marca.");
		document.getElementById('marca_2').focus();
		return false;
	}
	else if(document.getElementById('modelo_1').value=='0'){
		alert("Por favor selecceione el modelo.");
		document.getElementById('modelo_1').focus();
		return false;
	}
	else if(document.getElementById('modelo_2').value=='0'){
		alert("Por favor selecceione el modelo.");
		document.getElementById('modelo_2').focus();
		return false;
	}	
	else if(document.getElementById('version_1').value=='0'){
		alert("Por favor seleccione la versión.");
		document.getElementById('version_1').focus();
		return false;
	}
	else if(document.getElementById('version_2').value=='0'){
		alert("Por favor seleccione la versión.");
		document.getElementById('version_2').focus();
		return false;
	}
	else if( ((document.getElementById('version_1').value)==(document.getElementById('version_2').value)) && ((document.getElementById('modelo_1').value)==(document.getElementById('modelo_2').value)) )
		{
		alert("Seleccione una version distinta.");
		document.getElementById('version_1').focus();
		return false;
		}
	else{
		document.frm_comparar.submit();
		}
	}
	
function Valida_rent_car()
	{
//-------------------------------------------------------------------		
	if  (document.frm_cotizar.select_ciudad_retiro.value=="")
		{
		alert("Por favor seleccione Ciudad de retiro.");
		document.frm_cotizar.select_ciudad_retiro.focus();
		return false;
		}
	if  (document.frm_cotizar.am_hora_retiro.value=="" || document.frm_cotizar.am_hora_retiro.value=="")
		{
		alert("Por favor seleccione Tipo de hora.");
		document.frm_cotizar.am_hora_retiro.focus();
		return false;
		}
	if  (document.frm_cotizar.fecha_retiro.value=="")
		{
		alert("Por favor seleccione Fecha de retiro.");
		document.frm_cotizar.fecha_retiro.focus();
		return false;
		}
	if  (document.frm_cotizar.hora_retiro.value=="")
		{
		alert("Por favor seleccione Hora de retiro.");
		document.frm_cotizar.hora_retiro.focus();
		return false;
		}

//-------------------------------------------------------------------		
	if  (document.frm_cotizar.select_ciudad_devolucion.value=="")
		{
		alert("Por favor seleccione Ciudad de devolución.");
		document.frm_cotizar.select_ciudad_devolucion.focus();
		return false;
		}	
		if  (document.frm_cotizar.am_hora_devolucion.value=="" || document.frm_cotizar.am_hora_devolucion.value=="")
		{
		alert("Por favor seleccione Tipo de devolución.");
		document.frm_cotizar.am_hora_devolucion.focus();
		return false;
		}
	if  (document.frm_cotizar.fecha_devolucion.value=="")
		{
		alert("Por favor seleccione Fecha de devolución.");
		document.frm_cotizar.fecha_devolucion.focus();
		return false;
		}
	if  (document.frm_cotizar.hora_devolucion.value=="")
		{
		alert("Por favor seleccione Hora de devolución.");
		document.frm_cotizar.hora_devolucion.focus();
		return false;
		}
		
	if  (document.frm_cotizar.categoria.value=="")
		{
		alert("Por favor seleccione la Categoría de vehículo.");
		document.frm_cotizar.categoria.focus();
		return false;
		}		
//----------------------------------------------------------------------------------------------	
	if((vacio(document.frm_cotizar.nombres.value)==false)||(document.frm_cotizar.nombres.value=='Nombre'))
		{
		alert("Por favor ingrese su Nombre.");
		document.frm_cotizar.nombres.focus();
		return false;
		}
	if((vacio(document.frm_cotizar.apellidos.value)==false)||(document.frm_cotizar.apellidos.value=='Apellidos'))
		{
		alert("Por favor ingrese sus Apellidos.");
		document.frm_cotizar.apellidos.focus();
		return false;
		}
	if(((vacio(document.frm_cotizar.telefono.value)==false)||(document.frm_cotizar.telefono.value=='Teléfono') || (vacio(document.frm_cotizar.movil.value)==false)) && ((document.frm_cotizar.movil.value=='Móvil')) )
		{
		alert("Por favor ingrese algun Teléfono.");
		document.frm_cotizar.telefono.focus();
		return false;
		}	
	if((/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.frm_cotizar.email.value))==false)
		{
		alert("Por favor ingrese un E-mail válido.");
		document.frm_cotizar.email.focus();
		return false;
		}
	document.frm_cotizar.submit();
	//return true;
	}
function check(id)
	{	
	valor=document.getElementById(id);
	if  (valor.checked==false)
		valor.checked=true;
	else
		valor.checked=false;
valor.focus();		
	}	

function Valida_credito()
	{
	xajax_formato_sin_punto_xajax(document.getElementById('rut').value,document.getElementById('rut').id);
	
	if((vacio(document.frm_cotizar.rut.value)==false)||(document.frm_cotizar.rut.value=='Rut') || (Valida_Rut(document.frm_cotizar.rut.id)==false ) )
		{
		alert("Por favor ingrese su Rut.");
		document.frm_cotizar.rut.focus();
		return false;
		}
		
	if((document.frm_cotizar.categoria.value=='0') || (document.frm_cotizar.marca.value=='0') || (document.frm_cotizar.modelo.value=='0') )
		{
		alert("Por favor ingrese el Vehiculo a Cotizar.");
		document.frm_cotizar.categoria.focus();
		return false;
		}
		
	if((vacio(document.frm_cotizar.valor_total.value)==false) || (document.frm_cotizar.valor_total.value=='Valor del Cr&eacute;dito')||(document.frm_cotizar.valor_total.value=='Valor del Crédito'))
		{
		alert("Por favor ingrese el Valor del Credíto.");
		document.frm_cotizar.valor_total.focus();
		return false;
		}
//----------------------------------------------------------------------------------------------	
	if((vacio(document.frm_cotizar.nombres.value)==false)||(document.frm_cotizar.nombres.value=='Nombre'))
		{
		alert("Por favor ingrese su Nombre.");
		document.frm_cotizar.nombres.focus();
		return false;
		}
	if((vacio(document.frm_cotizar.apellidos.value)==false)||(document.frm_cotizar.apellidos.value=='Apellidos'))
		{
		alert("Por favor ingrese sus Apellidos.");
		document.frm_cotizar.apellidos.focus();
		return false;
		}
	if  (document.frm_cotizar.region.value=="")
		{
		alert("Por favor seleccione su Región.");
		document.frm_cotizar.region.focus();
		return false;
		}
	if  (document.frm_cotizar.comuna.value=="") 
		{
		alert("Por favor seleccione su Comuna.");
		document.frm_cotizar.comuna.focus();
		return false;
		}
	var existe_telefono=0;	
	var existe_movil=0;	
	if ((  ((vacio(document.frm_cotizar.telefono.value)==false) || (document.frm_cotizar.telefono.value=='Teléfono') ) ||  (vacio(document.frm_cotizar.codigo_area.value)==false)   ))
		existe_telefono=1;
	if ((  ((vacio(document.frm_cotizar.movil.value)==false) || (document.frm_cotizar.movil.value=='Móvil') ) ||  (vacio(document.frm_cotizar.codigo_movil.value)==false)  ))
		existe_movil=1;
if(existe_telefono>0 && existe_movil>0)
		{
		alert("Por favor ingrese algun Teléfono con su respectivo código.");
		document.frm_cotizar.codigo_area.focus();
		return false;
		}
		
	if((/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.frm_cotizar.email.value))==false)
		{
		alert("Por favor ingrese un E-mail válido.");
		document.frm_cotizar.email.focus();
		return false;
		}
		if  (document.frm_cotizar.n_cuota.value=="0")
			{
			alert("Por favor seleccione la cuota.");
			document.frm_cotizar.n_cuota.focus();
			return false;
			}
	if((vacio(document.frm_cotizar.pie.value)==false)||(document.frm_cotizar.pie.value=='Pie')  )
			{
			alert("Por favor ingrese el Pie.");
			document.frm_cotizar.pie.focus();
			return false;
			}
		if  (document.frm_cotizar.antiguedad.value=="")
			{
			alert("Por favor su Antigueda Laboral.");
			document.frm_cotizar.antiguedad.focus();
			return false;
			}
		if  (document.frm_cotizar.tipo_trabajador.value=="")
			{
			alert("Por favor el tipo de trabajador.");
			document.frm_cotizar.tipo_trabajador.focus();
			return false;
			}
		if  (document.frm_cotizar.tipo_sueldo.value=="")
			{
			alert("Por favor el tipo de sueldo.");
			document.frm_cotizar.tipo_sueldo.focus();
			return false;
			}
		if  (document.frm_cotizar.monto_sueldo.value=="")
			{
			alert("Por favor el monto de sueldo.");
			document.frm_cotizar.monto_sueldo.focus();
			return false;
			}	
		
	document.frm_cotizar.submit();
	//return true;
	}

function Valida()
	{
		
	if((document.frm_cotizar.categoria.value=='0') || (document.frm_cotizar.marca.value=='0') || (document.frm_cotizar.modelo.value=='0') )
		{
		alert("Por favor ingrese el Vehiculo a Cotizar.");
		document.frm_cotizar.categoria.focus();
		return false;
		}
		
	if((vacio(document.frm_cotizar.valor_total.value)==false) || (document.frm_cotizar.valor_total.value=='Valor del Cr&eacute;dito')||(document.frm_cotizar.valor_total.value=='Valor del Crédito'))
		{
		alert("Por favor ingrese el Valor del Credíto.");
		document.frm_cotizar.valor_total.focus();
		return false;
		}
//----------------------------------------------------------------------------------------------	
	if((vacio(document.frm_cotizar.nombres.value)==false)||(document.frm_cotizar.nombres.value=='Nombre'))
		{
		alert("Por favor ingrese su Nombre.");
		document.frm_cotizar.nombres.focus();
		return false;
		}
	if((vacio(document.frm_cotizar.apellidos.value)==false)||(document.frm_cotizar.apellidos.value=='Apellidos'))
		{
		alert("Por favor ingrese sus Apellidos.");
		document.frm_cotizar.apellidos.focus();
		return false;
		}
	if  (document.frm_cotizar.region.value=="")
		{
		alert("Por favor seleccione su Región.");
		document.frm_cotizar.region.focus();
		return false;
		}
	if  (document.frm_cotizar.comuna.value=="")
		{
		alert("Por favor seleccione su Comuna.");
		document.frm_cotizar.comuna.focus();
		return false;
		}
		
	if ( ((vacio(document.frm_cotizar.telefono.value)==false)||(document.frm_cotizar.telefono.value=='Teléfono') || (vacio(document.frm_cotizar.movil.value)==false)) && ((document.frm_cotizar.movil.value=='Móvil')) )
		{
		alert("Por favor ingrese algun Teléfono.");
		document.frm_cotizar.telefono.focus();
		return false;
		}
	if((/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.frm_cotizar.email.value))==false)
		{
		alert("Por favor ingrese un E-mail válido.");
		document.frm_cotizar.email.focus();
		return false;
		}
		
	document.frm_cotizar.submit();
	//return true;
	}
function check(id)
	{	
	valor=document.getElementById(id);
	if  (valor.checked==false)
		valor.checked=true;
	else
		valor.checked=false;
valor.focus();		
	}	


function formato_precio(precio,id)
{
	xajax_formato_precio_puntos(precio,id);
}

function monto_credito(id_resultado,id_monto,id_resta)
{
	xajax_monto_credito(id_resultado,id_monto,id_resta);
}

function cotizar_express()
{
	marca=document.form1.marca_up.value;
	auto=document.form1.tipo_up.value;
	document.form1.boton_cotizar.disabled=true;
	xajax_menus_desplegables2('marca',marca,auto);	
	
}
function activar_cambiar_ciudad()
	{
	region=document.frm_cambia_ciudad.region.value
	provincia=document.frm_cambia_ciudad.provincia.value;
	if(region!='' && provincia!='')
		document.frm_cambia_ciudad.btn_cambiar_ubicacion.disabled=false;
	else
			document.frm_cambia_ciudad.btn_cambiar_ubicacion.disabled=true;	
	}
function lista_provincia(nombre_select,estilo)
{
	region=document.frm_cambia_ciudad.region.value;
	if(region=='')
		document.frm_cambia_ciudad.btn_cambiar_ubicacion.disabled=false;
	else
		document.frm_cambia_ciudad.btn_cambiar_ubicacion.disabled="true";
	xajax_listar_provincia(region, nombre_select,estilo)	
}

function destacar(valor)
{
	var total_especificacion=document.getElementById('total_especificaciones');
	var total_version=document.getElementById('total_versiones');
	var i=1;
	var x=0;
	var detener_version=total_version.value;
	var detener_especificacion=total_especificacion.value;
	var btn_destacar=document.getElementById('destacar_diferencias');
	
	if(btn_destacar.value=='Destacar diferencias en gris')
		{
		while(i<=detener_especificacion)
			{				
			total=x+detener_version;
			if(x<1)
				x=1;
			var j=1;
			while(j<=detener_version)
				{			
				var destacado=document.getElementById('txt_'+i+'_'+j+'_destacado');		
				
				if(destacado.value=='1')
					{
					var td_destacar_principal=document.getElementById('td_'+i+'_nombre_destacado');		
						td_destacar_principal.className='destacado-td';	
					x=1;
					//alert(x+'-'+detener_version);
					while(x<=detener_version)
						{	
						//alert(x);
						var td_destacar=document.getElementById('td_'+i+'_'+x+'_destacado');		
						td_destacar.className='destacado-td';	
						
						x++;
						j=detener_version;
						}					
					}
				j++;	
				}
			i++;	
			}
		btn_destacar.value="Ocultar diferencias";
		}
		
		
	else	
		{
		while(i<=detener_especificacion)
		{				
		total=x+detener_version;
		if(x<1)
			x=1;
		var j=1;
		while(j<=detener_version)
			{			
			var destacado=document.getElementById('txt_'+i+'_'+j+'_destacado');		
			
			if(destacado.value=='1')
				{
				var td_destacar_principal=document.getElementById('td_'+i+'_nombre_destacado');		
					td_destacar_principal.className='borde-inf';	
				x=1;
				//alert(x+'-'+detener_version);
				while(x<=detener_version)
					{	
					//alert(x);
					var td_destacar=document.getElementById('td_'+i+'_'+x+'_destacado');		
					td_destacar.className='borde-inf';	
					
					x++;
					j=detener_version;
					}					
				}
			j++;	
			}
		i++;	
		}
		btn_destacar.value='Destacar diferencias en gris'
		}
}


function imagen(url)
{
	var imagen=document.getElementById('numero_imagen');
	//var y=document.getElementById('mostrar_foto');
	if(imagen.value!="")
		location.href=url+imagen.value+'/';
	else
		location.href=url;
//	xajax_imagen(imagen,y.className);
	
	
}


function listar_comuna(nombre_select)
{
	region=document.frm_cotizar.region.value;
	var y=document.getElementById(nombre_select);
	var tabindex='';
	if(y.tabIndex!='undefined')		
		xajax_listar_comuna(region,nombre_select,y.className,y.tabIndex);
	else	
		xajax_listar_comuna(region,nombre_select,y.className);
	
}




//*****************VEHICULOS USADOS******************//

//*****************VEHICULOS USADOS******************//

function categoria_usado(){

	categ_usado = document.form_vehiculo_usado.categ_usado.value;
	//marca=document.form_vehiculo_nuevos.txt_marca.value;
	marca_usado = document.form_vehiculo_usado.marca_usado.value;
	estilo = document.form_vehiculo_usado.categ_usado.className;
	provincia = document.form_vehiculo_usado.buscar_provincia.value;

	if(marca_usado!="")
		{
		xajax_menus_desplegables_usado('modelo',categ_usado,marca_usado,'',estilo,provincia);
		xajax_menus_desplegables_usado('marca',categ_usado,marca_usado,'',estilo,provincia);
		}
	else
		xajax_menus_desplegables_usado('marca',categ_usado,marca_usado,'',estilo,provincia);


}


function menu_actu_usado(tipo){
	
	categ_usado=document.form_vehiculo_usado.categ_usado.value;
	marca_usado=document.form_vehiculo_usado.marca_usado.value;	
	estilo=document.form_vehiculo_usado.categ_usado.className;
	provincia = document.form_vehiculo_usado.buscar_provincia.value;	
	if(estilo=='for-todos')
		texto='Todos los Modelos';
	if(estilo=='for-todos4-b')
		texto='Todos';		
	
	if(tipo=="marca")
		{	
		if(marca_usado=="")
			{
			xajax_asignar_combo('modelo_usado',estilo,texto,'mod_usado');
			xajax_menus_desplegables_usado('categoria',categ_usado,marca_usado,'',estilo,provincia);	
			xajax_menus_desplegables_usado('marca',categ_usado,marca_usado,'',estilo,provincia);
			}
		else
			{
			//xajax_asignar_combo('modelo_usado',estilo,texto,'mod_usado');
			xajax_menus_desplegables_usado('categoria',categ_usado,marca_usado,'',estilo,provincia);	
			xajax_menus_desplegables_usado('marca',categ_usado,marca_usado,'',estilo,provincia);
			xajax_menus_desplegables_usado('modelo',categ_usado,marca_usado,'',estilo,provincia);
			}
			

		}

}

function mostrar_auto_destacado(categ,marca,modelo,pag,total,ant,sig,inicio,fin,url,ultima,mostrar_inicio,mostrar_fin)
{
	
	document.form_vehiculo_nuevos.boton_cotizar.focus();
	xajax_loading('http://desarrollo.autocenter.cl/imagenes/loading.gif','loading_imagen');
	xajax_listar_autos_nuevos_destacados(categ,marca,modelo,pag,total,ant,sig,inicio,fin,url,ultima,mostrar_inicio,mostrar_fin);
		//document.form_vehiculo_nuevos.boton_cotizar.blur();
	xajax_limpiar('loading_imagen','innerHTML');	

}

//************************************************************************
function cambiar_foto_principal(nombre_span,id_foto,url,alto,ancho,numero)
{
	//xajax_loading('http://desarrollo.autocenter.cl/imagenes/loading.gif','foto');
	//sleep(10)
	//alert(url);
	var y=document.getElementById(id_foto);
	var x=document.getElementById('numero_imagen');
	
	y.src=url;
	x.value=numero;	
	//y.blur();
	//xajax_loading('http://desarrollo.autocenter.cl/imagenes/loading.gif',nombre_span);
	
	//window.setTimeout('xajax_loading(\'http://desarrollo.autocenter.cl/imagenes/loading.gif\',\'nombre_span\')',1000);
	//xajax_limpiar(nombre_span,'innerHTML');	
	
	//xajax_cambia_foto(nombre_span,id_foto,y.alt,url,alto,ancho,y.className);	

	
}

function cambiar_foto(nombre_span,id_foto,url,ancho,alto)
{
	//xajax_loading('http://desarrollo.autocenter.cl/imagenes/loading.gif','foto');
	//sleep(10)
	//alert(url);
	var y=document.getElementById(id_foto);
	//var x=document.getElementById('numero_imagen');
	//numero=url.substring(0,1);
	//url=url.substring(1);
	//alert(numero);
	y.src=url;
	y.width=ancho;
	y.height=alto;

	//x.value=numero;
	
	//y.blur();
	//xajax_loading('http://desarrollo.autocenter.cl/imagenes/loading.gif',nombre_span);
	
	//window.setTimeout('xajax_loading(\'http://desarrollo.autocenter.cl/imagenes/loading.gif\',\'nombre_span\')',1000);
	//xajax_limpiar(nombre_span,'innerHTML');	
	
	//xajax_cambia_foto(nombre_span,id_foto,y.alt,url,alto,ancho,y.className);	

	
}
function asignar(tipo,orden,categ,marca,modelo,pag,total,ant,sig,inicio,fin,url,ultima,mostrar_inicio,mostrar_fin)
{
	
	document.form_vehiculo_nuevos.boton_cotizar.focus();
	xajax_loading('http://desarrollo.autocenter.cl/imagenes/loading.gif','loading_imagen');
	
	xajax_listar_vehiculos_nuevos(tipo,orden,categ,marca,modelo,pag,total,ant,sig,inicio,fin,url,ultima,mostrar_inicio,mostrar_fin);
	xajax_limpiar('loading_imagen','innerHTML');
		//document.form_vehiculo_nuevos.boton_cotizar.blur();

}

function enviar()
{
marca=document.form1.marca_up.value;
auto=document.form1.tipo_up.value;
modelo=document.form1.modelo_up.value;
	//alert(auto);
	if(auto==1)
		document.form1.url_enlace.value='cotizar_nuevo_express';
	if(auto==2)
		document.form1.url_enlace.value='cotizar_usado_express';
	document.form1.submit();
}

function activar_boton()
	{
	modelo=document.form1.modelo_up.value;	
	document.form1.boton_cotizar.disabled=false;
	xajax_asignar('txt_modelo_express',modelo);
	}

function marcas(tipo,auto)
	{
	marca=document.form1.txt_marca_express.value
	auto=document.form1.tipo_up.value;
	//marca=document.form1.marca_up.value
	
	/*xajax_asignar_combo('marca_up','marca','Marcas','marca_express');
	
	xajax_asignar('txt_modelo_express','');
	xajax_asignar('txt_marca_express','');*/
	//if(marca_verifica!='' || !='' )
		//xajax_menus_desplegables2('modelo',marca,auto);
	if(auto=='1')
		{ 	
		if(tipo=='marca')
			{
			xajax_menus_desplegables2('marca',marca,auto);
			}
		}
		xajax_asignar_combo('modelo_up','modelo','Modelos','modelo_express');
//	if(auto=='2')
//		{ 
//		if(tipo=='marca')
//			{
//			xajax_menus_desplegables2('marca',modelo,estilo);
//			
//			}
//		}	
		
	}
	
function menu_actu2(tipo){
	
	marca=document.form1.marca_up.value;
	auto=document.form1.tipo_up.value;
	document.form1.boton_cotizar.disabled=true;

	if(tipo=="marca" && marca!="" )
		{	
		xajax_menus_desplegables2('modelo',marca,auto);
		xajax_asignar('txt_marca_express',marca);
		xajax_asignar('txt_modelo_express','');		

		}
	else
		{		
		xajax_asignar('txt_modelo_express',document.form1.modelo_up.value);
		document.form1.modelo.value=0;
		document.form1.modelo.disabled=true; 
		}
		

	
}
//////////////////////////////////////////////////////////////////////////////////////

function menu_actu(tipo){
	
	categ=document.form_vehiculo_nuevos.categ.value;
	marca=document.form_vehiculo_nuevos.marca_nuevo.value;
	estilo=document.form_vehiculo_nuevos.estilo.value;
	estilo2=document.form_vehiculo_nuevos.estilo2.value;
	//alert(categ);
	if(tipo=="marca")
		{	
		if(marca=="")
			{
			//document.form_vehiculo_nuevos.categ.value='';
			//xajax_asignar('txt_categoria','');			
			xajax_menus_desplegables('marca',categ,marca,'',estilo);
			xajax_menus_desplegables('categoria',categ,marca,'',estilo);	
			xajax_asignar_combo('modelo_nuevo',estilo2,'Todos los Modelos','mod');
			xajax_asignar('txt_modelo','');
			}
		else
			{
//			xajax_asignar_combo('modelo_nuevo',estilo2,'Todos los Modelos','mod');
			xajax_menus_desplegables('categoria',categ,marca,'',estilo);	
			xajax_menus_desplegables('marca',categ,marca,'',estilo);			
			xajax_menus_desplegables('modelo',categ,marca,'',estilo2);
			}
			

		//xajax_asignar('txt_marca',marca);
		
		
		//
//		if(marca!='')
//			{
//			xajax_menus_desplegables('modelo',categ,marca,'',estilo);
//			}
//		else
//			{
//			xajax_asignar_combo('modelo_nuevo',estilo,'Todos los Modelos','mod');
//			}

		}
	else{
		xajax_asignar('txt_modelo',document.form_vehiculo_nuevos.modelo_nuevo.value);
		
	}

//xajax_asignar('txt_categoria',document.form_vehiculo_nuevos.categ.value);
}
function categoria()
{
	categ=document.form_vehiculo_nuevos.categ.value;
	//marca=document.form_vehiculo_nuevos.txt_marca.value;
	marca=document.form_vehiculo_nuevos.marca_nuevo.value;
	estilo=document.form_vehiculo_nuevos.estilo.value;
	estilo2=document.form_vehiculo_nuevos.estilo2.value;
	if(marca!="")
		{
//		xajax_asignar_combo('modelo_nuevo',estilo2,'Todos los Modelos','mod');	
		xajax_menus_desplegables('marca',categ,marca,'',estilo);
		xajax_menus_desplegables('modelo',categ,marca,'',estilo2);

		}
	else
		{		
		xajax_menus_desplegables('marca',categ,marca,'',estilo);
		xajax_menus_desplegables('categoria',categ,marca,'',estilo);				
		}
	
	
	//xajax_menus_desplegables('modelo',categ,marca,'',estilo);
			
	xajax_asignar('txt_categoria',categ);	
	//xajax_asignar('txt_marca','');	
	//xajax_asignar('txt_modelo','');	
}


//actualizar menu de marcas

function marca_ofertas()
{
	categ=document.form_vehiculo_nuevos.categ.value;
	estilo=document.form_vehiculo_nuevos.estilo.value;
	xajax_menus_desplegables('modelo',categ,'','',estilo);
}

//actualizar destacado showroom
function actualizar(showroom)
{
	if (confirm('¿Esta seguro de enviar este boletin a todos los contactos registrados?'))
		xajax_actualizar_showroom(showroom);
}

