function cambiaimg(img_name,img_src)
{
document[img_name].src=img_src;
}
function Carga_modelos()
{
	var indice = document.busqueda.marca.selectedIndex;
	var marcasel = document.busqueda.marca.options[indice].value;
	if(document.busqueda.marca.options[indice].value=='0' || Bdvehiculos[marcasel] == null)
		{
			document.busqueda.modelo.length=1;
			document.busqueda.modelo.options[0].text='...Todos';
			document.busqueda.modelo.options[0].value='0';
		}
		else
		{
			document.busqueda.modelo.length=Bdvehiculos[marcasel].length+1;
			for (i=0;i<Bdvehiculos[marcasel].length;i++)
				{
					valores = Bdvehiculos[marcasel][i].split('##');
					document.busqueda.modelo.options[i+1].value=valores[0];
					document.busqueda.modelo.options[i+1].text=valores[1];
					
				}
			
		}
document.busqueda.modelo.selectedIndex=0;
	
}
function Carga_modelos1()
{
	var indice = document.insert.marca.selectedIndex;
	var marcasel = document.insert.marca.options[indice].value;
	if(document.insert.marca.options[indice].value=='0' || Bdvehiculos[marcasel] == null)
		{
			document.insert.modelo.length=1;
			document.insert.modelo.options[0].text='Modelo';
			document.insert.modelo.options[0].value='0';
		}
		else
		{
			document.insert.modelo.length=Bdvehiculos[marcasel].length+1;
			for (i=0;i<Bdvehiculos[marcasel].length;i++)
				{
					valores = Bdvehiculos[marcasel][i].split('##');
					document.insert.modelo.options[i+1].value=valores[0];
					document.insert.modelo.options[i+1].text=valores[1];
					
				}
			
		}
document.insert.modelo.selectedIndex=0;
	
}


function ChangePage( to_hide, to_show )

{

   var tbl_hide = document.getElementById( aIds[to_hide] );

   var tbl_show = document.getElementById( aIds[to_show] );



   if ( typeof(tbl_hide)=='object' && tbl_hide!=null )

    if ( typeof(tbl_show)=='object' && tbl_show!=null )

    {

       tbl_hide.style.display = 'none';

       tbl_show.style.display = '';

    }

}

function NotEmpty( old_res, id, field_title )

{
   
   if ( old_res==0 )

   {

      var el = document.getElementById( id );

      if ( typeof(el)=='object' && el!=null )

        if ( el.value=='' )

        {

           alert( 'Debe rellenar el campo "' + field_title + '"' );

           return 1;

        }

   }

   return 0;

}

function Email( old_res, id, field_title )

{ 

   if ( old_res==0 )

   {

      var el = document.getElementById( id );

      if ( typeof(el)=='object' && el!=null )

      {

         var re = /^[a-zA-Z0-9_\.\-]+@([a-zA-Z0-9][a-zA-Z0-9-]+\.)+[a-zA-Z]{2,4}$/;



         if (el.value.search(re) != -1 )  return 0;

         else

         {

            alert( '"'+field_title+'" debe ser una dirección de correo válida.' );

            return 1;

         }

      }

   }

   return 0;

}

function NumbersOnly( old_res, id, field_title )

{

   if ( old_res==0 )

   {

      var el = document.getElementById( id );

      if ( typeof(el)=='object' && el!=null )

      {

         var re = /^[0-9]+$/;

         if (el.value.search(re) == -1 )

         {

            alert( '"' + field_title + '" debe contener solo números sin puntos ni comas.' );

            return 1;

         }

      }

   }

   return 0;

}

function Combovacio( old_res, id, field_title )

{
   
   if ( old_res==0 )

   {

      var el = document.getElementById( id );

      if ( typeof(el)=='object' && el!=null )

        if ( el.value=='0' )

        {

           alert( 'Debe elegir alguna opción en el campo "' + field_title + '"' );

           return 1;

        }

   }

   return 0;

}

function LimitAttach(tField,iType) { 
file=tField.value; 
if (iType==1) { 
extArray = new Array(".jpg"); 
} 
if (iType==2) { 
extArray = new Array(".swf"); 
} 
if (iType==3) { 
extArray = new Array(".exe",".sit",".zip",".tar",".swf",".mov",".hqx",".ra",".wmf",".mp3",".qt",".med",".et"); 
} 
if (iType==4) { 
extArray = new Array(".mov",".ra",".wmf",".mp3",".qt",".med",".et",".wav"); 
} 
if (iType==5) { 
extArray = new Array(".html",".htm",".shtml"); 
} 
if (iType==6) { 
extArray = new Array(".doc",".xls",".ppt"); 
} 
allowSubmit = false; 
if (!file) return; 
while (file.indexOf("\\") != -1) file = file.slice(file.indexOf("\\") + 1); 
ext = file.slice(file.indexOf(".")).toLowerCase(); 
for (var i = 0; i < extArray.length; i++) { 
if (extArray[i] == ext) { 
allowSubmit = true; 
break; 
} 
} 
if (allowSubmit) { 
} else { 
tField.value=""; 
alert("Usted sólo puede subir archivos con extensiones " + (extArray.join(" ")) + "\nPor favor seleccione un nuevo archivo"); 
} 
} 