//funciones de llamada a ajax con para incluir un archivo mysql
function envia_correo(action){
//alert('Su email ha sido enviado correctamente');
  respuesta = document.getElementById('respuesta');
  envia('ajax/enviarcorreo.php',
  'accion='+action+ 
  '&nombre='+document.contactform.nombre.value+
  '&email='+document.contactform.email.value+
  '&telefono='+document.contactform.telefono.value+
  '&motivo='+document.contactform.motivo.value);
}

function envia_registro(){
  respuesta = document.getElementById('semaforo');
  fecha_nac= document.registroform.ano.options[document.registroform.ano.selectedIndex].value+"-"+document.registroform.mes.options[document.registroform.mes.selectedIndex].value+"-"+document.registroform.dia.options[document.registroform.dia.selectedIndex].value;
  envia('ajax/registrocompra.php',
  'usuario='+document.registroform.nombreusuario.value+
  '&email='+document.registroform.email.value+
  '&clave='+document.registroform.password.value+
  '&nombre='+document.registroform.nombre.value+
  '&tipodocumento='+document.registroform.tipodocumento.options[document.registroform.tipodocumento.selectedIndex].value+
  '&numerodocumento='+document.registroform.numerodocumento.value+
  '&fechanacimiento='+fecha_nac+
  '&tipovia='+document.registroform.tipovia.options[document.registroform.tipovia.selectedIndex].value+  
  '&direccion='+document.registroform.direccion.value+
  '&numero='+document.registroform.numero.value+ 
  '&escalera='+document.registroform.escalera.value+
  '&codigopostal='+document.registroform.codigopostal.value+  
  '&localidad='+document.registroform.localidad.value+
  '&provincia='+document.registroform.provincia.options[document.registroform.provincia.selectedIndex].value+
  '&telefonofijo='+document.registroform.TelefonoFijo.value+
  '&telefonomovil='+document.registroform.TelefonoMovil.value+
  '&fax='+document.registroform.Fax.value+
  '&nombreEnvio='+document.registroform.nombreEnvio.value+
  '&tipoviaEnvio='+document.registroform.tipoviaEnvio.options[document.registroform.tipoviaEnvio.selectedIndex].value+ 
  '&direccionEnvio='+document.registroform.direccionEnvio.value+
  '&numeroEnvio='+document.registroform.numeroEnvio.value+ 
  '&escaleraEnvio='+document.registroform.escaleraEnvio.value+
  '&codigopostalEnvio='+document.registroform.codigopostalEnvio.value+  
  '&localidadEnvio='+document.registroform.localidadEnvio.value+
  '&provinciaEnvio='+document.registroform.provinciaEnvio.options[document.registroform.provinciaEnvio.selectedIndex].value);  
 
  }
/*  
function facturacion2(action){

  respuesta = document.getElementById('respuestas');

  envia('ajax/guardar.php',

  'accion='+action+

  '&envio='+document.subscribe.envio.value+

  '&nombreFacturacion='+document.subscribe.nombreFacturacion.value+

  '&tipodocumentoFacturacion='+document.subscribe.tipodocumento.value+

  '&numerodocumentoFacturacion='+document.subscribe.numerodocumentoFacturacion.value+

  '&tipoviaFacturacion='+document.subscribe.tipoviaFacturacion.value+  

  '&direccionFacturacion='+document.subscribe.direccionFacturacion.value+

  '&numeroFacturacion='+document.subscribe.numeroFacturacion.value+ 

  '&escaleraFacturacion='+document.subscribe.escaleraFacturacion.value+

  '&codigopostalFacturacion='+document.subscribe.codigopostalFacturacion.value+  

  '&localidadFacturacion='+document.subscribe.localidadFacturacion.value+

  '&provinciaFacturacion='+document.subscribe.provinciaFacturacion.value+

  '&nombreEnvio='+document.subscribe.nombreEnvio.value+

  '&tipoviaEnvio='+document.subscribe.tipoviaEnvio.value+  

  '&direccionEnvio='+document.subscribe.direccionEnvio.value+

  '&numeroEnvio='+document.subscribe.numeroEnvio.value+ 

  '&escaleraEnvio='+document.subscribe.escaleraEnvio.value+

  '&codigopostalEnvio='+document.subscribe.codigopostalEnvio.value+  

  '&localidadEnvio='+document.subscribe.localidadEnvio.value+

  '&provinciaEnvio='+document.subscribe.provinciaEnvio.value+

  '&telefonofijo='+document.subscribe.TelefonoFijo.value+

  '&telefonomovil='+document.subscribe.TelefonoMovil.value);  

}
*/
function muestra_modelos(marca){
	respuesta = document.getElementById('modelo');
	envia('ajax/muestra_modelos.php',
	'marca='+marca);
}
function searchmovil(){
if(document.getElementById('model').value!='%')
{
location.href='index.php?dir=moviles/ver.php&movil='+document.getElementById('marka').options[document.getElementById('marka').selectedIndex].value+'_'+document.getElementById('model').value;
}
else if((document.getElementById('marka').value=='%')&&(document.getElementById('model').value=='%'))
{
location.href='index.php?dir=tienda/seleccion.php&grupo=inicio';	
}
else
{
location.href='index.php?dir=tienda/seleccion.php&marca='+document.getElementById('marka').options[document.getElementById('marka').selectedIndex].value;}
}