function abrir_ventana(url, nombre, width, height, posicionamiento, x, y, scrolls){
	if(posicionamiento=="centrado"){
		x = (screen.width - width)/2;
		y = (screen.height - height)/2;
	}
	open(url, nombre, "width="+width+", height="+height+", screenLeft="+x+", screenTop="+y+", scrollbars="+scrolls);
        //open(url, nombre, "toolbar=yes, status=yes,menubar=yes, width="+width+", height="+height+", screenLeft="+x+", screenTop="+y+", scrollbars="+scrolls);
}
function abrir_ventana_contacte(){
  abrir_ventana('/genesis_auto/contactar.jsp','wincontacto',500,193,'centrado',0,0,0);
}
function abrir_ventana_contacte_hogar(){
  abrir_ventana('/hogar_directo/contactar.jsp','wincontacto',780,465,'centrado',-10,10,0);
}


function trim(inputString) {
   // Removes leading and trailing spaces from the passed string. Also
   // removes consecutive spaces and replaces it with one space.
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function


function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}


function takeFocusBack() {
    window.focus();
}

//Navegacion a web Génesis Auto
function ir_pantalla_homeAutos() {
	location.replace('/OficinaVirtual/homeAutos.do?activo=home');
}

function ir_pantalla_ahorro() {
	location.replace('/OficinaVirtual/ahorro.do?activo=ahorro');
}

function ir_pantalla_testBC() {
	location.replace('/OficinaVirtual/testBuenConductor.do?activo=testBuenConductor');
}

function ir_pantalla_testComparativo() {
	location.replace('/OficinaVirtual/testComparativo.do?activo=testComparativo');
}

function ir_pantalla_preguntasFrecuentes() {
	location.replace('/OficinaVirtual/preguntasFrecuentes.do?activo=preguntasFrecuentes');
}

function abrir_tarificador_autos() {
		document.autos.action=httpsURL + "/OficinaVirtual/capturaRiesgoAutos.do?reqCode=capturaDatos&deleteSession=true"
		document.autos.target="Autos"
		document.autos.submit();
}

function abrir_tarificador_motos() {
		document.motos.action=httpsURL + "/OficinaVirtual/capturaRiesgoMotos.do?reqCode=capturaDatos&deleteSession=true"
		document.motos.target="Motos"
		document.motos.submit();
}

function abrir_tarificador_hogar() {
		document.hogar.action=httpsURL + "/OficinaVirtual/capturaRiesgoHogar.do?reqCode=capturaDatos&deleteSession=true"
		document.hogar.target="Hogar"
		document.hogar.submit();
}

//Navegacion a web Hogar Directo
function ir_pantalla_homeHogar() {
	location.replace('/OficinaVirtual/homeHogar.do?activo=hd.home');
}

//Navegacion a Formulario de motos
function ir_pantalla_homeMotos() {
	location.replace('/OficinaVirtual/homeMotos.do?activo=home');
}

function ir_pantalla_20ahorro() {
	location.replace('/OficinaVirtual/20ahorro.do?activo=hd.ahorro');
}

function ir_pantalla_compare() {
	location.replace('/OficinaVirtual/compare.do?activo=hd.compare');
}

function ir_pantalla_coberturas() {
	location.replace('/OficinaVirtual/coberturas.do?activo=hd.coberturas');
}

function ir_pantalla_preguntasHogar() {
	location.replace('/OficinaVirtual/preguntasHogar.do?activo=hd.preguntas');
}

//Navegacion a web AREA CLIENTES
function ir_oficinavirtual() {
	location.replace(httpsURL + '/OficinaVirtual/startOV.do?reqCode=capturaDatos&deleteSession=true');
}

function ir_alta_cliente() {
	location.replace(httpsURL + '/OficinaVirtual/signon/tipoRegistro.do?reqCode=capturaDatos');
}

function ir_perdida_usuario() {
	location.replace(httpsURL + '/OficinaVirtual/signon/login.do?reqCode=recuerdaUsuario');
}

