// JavaScript Document
function pasarVariables(pagina, nombres) {
  pagina +="?";
  nomVec = nombres.split(",");
  for (i=0; i<nomVec.length; i++)
    pagina += nomVec[i] + "=" + escape(eval(nomVec[i]))+"&";
  pagina = pagina.substring(0,pagina.length-1);
  location.href=pagina;
}

function validar_email(campo,formulario) {

  valor=eval('document.'+formulario+'.'+campo+'.value');

  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){

    //alert("La dirección de email " + valor + " es correcta.");

    return (1);

  } else {

    alert("La dirección de email es incorrecta.");

    return (false);

  }

}

function redireccionES(){
	url=document.location.href;
	posicion=url.lastIndexOf('?') ;	
	condicion=url.substring(posicion+1,posicion+3);	
	if(condicion=='UK'){
		urlnew=url.replace('UK','ES');
		document.location.href=urlnew;
	}
	if(condicion=='DE'){
		urlnew=url.replace('DE','ES');
		document.location.href=urlnew;
	}
	if(posicion=='-1'){
		document.location.href=url+'?ES';
	}
}

function redireccionUK(){
	url=document.location.href;
	posicion=url.lastIndexOf('?') ;	
	condicion=url.substring(posicion+1,posicion+3);	
	if(condicion=='ES'){
		urlnew=url.replace('ES','UK');
		document.location.href=urlnew;
	}
	if(condicion=='DE'){
		urlnew=url.replace('DE','UK');
		document.location.href=urlnew;
	}
	if(posicion=='-1'){
		document.location.href=url+'?UK';
	}
}

function redireccionDE(){
	url=document.location.href;
	posicion=url.lastIndexOf('?') ;	
	condicion=url.substring(posicion+1,posicion+3);	
	if(condicion=='UK'){
		urlnew=url.replace('UK','DE');
		document.location.href=urlnew;
	}
	if(condicion=='ES'){
		urlnew=url.replace('ES','DE');
		document.location.href=urlnew;
	}
	if(posicion=='-1'){
		document.location.href=url+'?DE';
	}
}

function idioma(){
	urlIdioma=document.location.href;
	posicionIdioma=urlIdioma.lastIndexOf('?') ;	
	idioma=urlIdioma.substring(posicionIdioma+1,posicionIdioma+3);	
	if(posicionIdioma=='-1'){
		idioma='ES';
	}
	if(idioma=='ES'){
		texto1='Día';
		texto2='Días';
		texto3='Cuantos días la quiere alquilar';
		texto4='Reservar';
		texto5='Especificaciones';
		texto6='Modelo';
		texto7='Categoría';
		texto8='MOTOR';
		texto9='Tipo';
		texto10='Diametro x Carrera';
		texto11='Valvulas';
		texto12='Potencia';
		texto13='Par';
		texto14='TRANSMISIÓN';
		texto15='Caja de Cambios';
		texto16='Transmisión final';
		texto17='CHASIS';
		texto18='Suspensión delantera';
		texto19='Suspensión trasera';
		texto20='RUEDAS';
		texto21='Rueda delantera';
		texto22='Rueda trasera';
		texto23='Frenos delanteros';
		texto24='Frenos traseros';
		texto25='DIMENSIONES';
		texto26='Altura del asiento';
		texto27='Distancia entre ejes';
		texto28='Capacidad del deposito - Reserva';
		texto29='Peso en seco';
		texto30='';
		textoCasco='<div align="center" class="letra6"><strong>Nuestros precios incluyen el seguro, impuestos,<br>kilometros ilimitados y un casco obligatorio</strong></div>';
		}
	if(idioma=='UK'){
		texto1='Day';
		texto2='Days';
		texto3='How many days would you like to rent';
		texto4='Reserve';
		texto5='Specifications';
		texto6='Model';
		texto7='Category';
		texto8='ENGINE';
		texto9='Type';
		texto10='Bore x Stroke';
		texto11='Valves';
		texto12='Power';
		texto13='Torque';
		texto14='TRANSMISSION';
		texto15='Gearbox';
		texto16='Final drive';
		texto17='CHASSIS';
		texto18='Front suspension';
		texto19='Rear suspension';
		texto20='WHEELS';
		texto21='Front tyre';
		texto22='Back tyre';
		texto23='Front brakes';
		texto24='Rear brakes';
		texto25='DIMENSIONS';
		texto26='Seat height';
		texto27='Wheelbase';
		texto28='Fuel capacity - Reserve';
		texto29='Dry weight';
		texto30='';
		textoCasco='<div align="center" class="letra6"><strong>Our price include insurance, taxes, one prescibed<br>helmet as well and the kilometers free</strong></div>';
		}
	if(idioma=='DE'){
		texto1='Tag';
		texto2='Tage';
		texto3='WievieleTage moechten Sie reservieren';
		texto4='Reservieren';
		texto5='Beschreibung';
		texto6='Modell';
		texto7='Kategorie';
		texto8='MOTOR';
		texto9='Typ';
		texto10='Bore x Stroke';
		texto11='Ventile';
		texto12='Kraft';
		texto13='Drehmoment';
		texto14='ÜBERSENDUNG';
		texto15='Getriebe';
		texto16='Endantrieb';
		texto17='CHASSIS';
		texto18='Vorderaufhängung';
		texto19='Hinteraufhängung';
		texto20='RÄDER';
		texto21='Vorderreifen';
		texto22='Hinterreifen';
		texto23='Vorderbremsen';
		texto24='Hinterbremse';
		texto25='DIMENSIONEN';
		texto26='Platz-Höhe';
		texto27='Radstand';
		texto28='Kraftstoffkapazität - Reserve';
		texto29='Trockenes Gewicht';
		texto30='';
		textoCasco='<div align="center" class="letra6"><strong>Unsere preise schlieBen Versicherung, Steuern und einen<br>vorgeschriebenen Helm sowie alle gefahrenen Kilometer ein</strong></div>';
		}
}

function redireccion(urlFF,idioma){
	document.location.href=urlFF+'?'+idioma;
}

