//==========================================================================================
// Controla la extension de los ficheros q intentamos subir mediante un formulario. Se ha de pasar como primer parametro  el nombre del formulario, a continuación el nombre de los controles INPUT FILE y despues todas las extensiones de archivo.
// valores[0] es el nombre del formulario
// valores[1] es el nombre del control file
//==========================================================================================
function controlarExtension(parametros){
	var valores=controlarExtension.arguments;
	var j=1;
	var i;
	var subir=0, totales=0;
	var individual=false;
	var msgError="";
	var extensiones="";
	for(i=2;i<=valores.length-1;i++){
		extensiones+=valores[i]+", ";
	}
	extensiones=extensiones.substring(0,(extensiones.length-2));
	//recorro todos los controles
	while(document[valores[0]][valores[1].toString()+j.toString()]=="[object]"){
		controlImg=document[valores[0]][valores[1].toString()+j.toString()].value;
		if(Trim(controlImg)!=''){
			posicion=controlImg.substring((controlImg.length-4),controlImg.length);
			posicion=posicion.toLowerCase();
			//compruebo q es alguno de los formatos especificados
			individual=false;
			for(i=2; i<=valores.length-1;i++){
				if(posicion==valores[i]){ //si coincide aumento el valor de las imagenes a subir e indico q esta no provoca error
					subir+=1;
					individual=true;
				}
			}
			if(individual==false){ //si la imagen provoca error, guardamos en el mensaje su referencia
				msgError=msgError + "La imagen Nº "+j+" no tiene un formato válido.\nSólo se permiten imágenes con extension: "+extensiones+"\n\n";
			}
			totales+=1;
		}
		j++;
	}
	//si las imágenes a subir no corresponden con el numero de controles, nos arroja el mensaje de error y no sube nada
	if(subir!=totales){
		alert(msgError);
		return false;
	}else{
		return true;
	}
}

function vaciarCaja(control,valor){
	var texto=control.value;
	texto=Trim(texto);
	if(texto==valor){
		control.value="";
	}
}

function valorDefecto(control,valor){
	var texto=control.value;
	texto=Trim(texto);
	if(texto==""){
		control.value=valor;
	}
}

function irA(atras,nueva){
	if(atras=="true"){
		history.back();
	}else if(atras=="false" && nueva!=""){
		document.location=nueva;
	}
}

function pasarElemento(origen,destino,indice){
	if(!existeElemento(destino,origen.options[indice].value)){
		var numero=destino.length;
		var nuevaOpcion=new Option();
		nuevaOpcion.text=origen.options[indice].text;
		nuevaOpcion.value=origen.options[indice].value;
		destino.options.add(nuevaOpcion,numero);
	}
}

function eliminarElemento(lista,indice){
	if(lista.length>0){
		lista.options.remove(indice);
	}
}

function existeElemento(lista,valor){
	for(i=0;i<lista.length;i++){
		if(lista.options[i].value==valor){
			return true;
		}
	}
	return false;
}

function seleccionarTodos(lista){
	if(lista.length>0){
		for(j=0;j<lista.length;j++){
			lista.options[j].selected=true;
		}
	}
}

function validaMail(formulario,control){
	if (document[formulario][control].value.indexOf('@', 0) == -1 || document[formulario][control].value.indexOf('.', 0) == -1){
		alert("La dirección e-mail introducida parece no ser válida.");
		document[formulario][control].focus();
		return;
	}
	document[formulario].submit();
}

function verImg(dire,ancho,alto,scrollB,centrar,titulo){ 
	if(ancho==0 && alto!=0){
		ancho=screen.width-20;
	}else if(alto==0 && ancho!=0){
		alto=screen.height-60;
	}else if(ancho==0 && alto==0){
		ancho=screen.width-20;
		alto=screen.height-60;
	} 
	altura=0;
	if(centrar=="si"){
		altura=(screen.height-alto)/2;
	}
	anchura=(screen.width-ancho)/2;
	var opt="height="+alto+",width="+ancho+",location=no,status=no,menu=no,scrollbars="+scrollB+",top="+altura+",left="+anchura+"";
	window.open(dire,"_new",opt);
}

function LimitAttach(form, file){
	var extArray = new Array(".jpg");
	allowSubmit = false;
	if (!file){ 
		return true;
	}
	while (file.indexOf("\\") != -1){
		file = file.slice(file.indexOf("\\") + 1);
		ext = file.slice(file.indexOf(".")).toLowerCase();
		for(k = 0; k < extArray.length; k++){
			if(extArray[k] == ext){
				allowSubmit = true;	
				break;
			}
		}
	}
	if(allowSubmit){
		return true;
	}else{
		alert("Se permiten únicamente archivos con la extensión: " + (extArray.join("  ")) + "\nPor favor, seleccione otro archivo e intente de nuevo.");
		return false;
	}
}

function ocultaDiv(){
	if(document.all.modificando){
		document.all.modificando.style.display="none";
	}
	if(document.all.eliminando){
		document.all.eliminando.style.display="none";
	}
	if(document.all.insertando){
		document.all.insertando.style.display="none";
	}
}

function tratar(formulario,fotos,seccion){
	correcto=true;
	if(fotos=="no" && seccion=="zona"){
		//tratar fecha del proyecto
		control=document[formulario].nombre.value;
		control=Trim(control);
		if(control.length==0){
			correcto=false;
			alert("No ha introducido ningún nombre para la zona.");
			ocultaDiv()
			return false;
		}
	}
	if(fotos=="no" && seccion=="inmueble"){
		//tratar fecha del proyecto
		control=document[formulario].zona.value;
		if(control=="0"){
			correcto=false;
			alert("No ha introducido ninguna zona para el inmueble.");
			ocultaDiv()
			return false;
		}
		control=document[formulario].tipo.value;
		if(control=="-"){
			correcto=false;
			alert("No ha introducido ningún tipo para el inmueble.");
			ocultaDiv()
			return false;
		}
		control=document[formulario].regimen.value;
		if(control=="nada"){
			correcto=false;
			alert("No ha introducido ningún tipo de régimen para el inmueble.");
			ocultaDiv()
			return false;
		}
		ascensor=document[formulario].ascensor[0].checked;
		ascensor2=document[formulario].ascensor[1].checked;
		if(ascensor==false && ascensor2==false){
			correcto=false;
			alert("No ha especificado si el inmueble está dotado de ascensor.");
			ocultaDiv()
			return false;
		}
		garaje=document[formulario].garaje[0].checked;
		garaje2=document[formulario].garaje[1].checked;
		if(garaje==false && garaje2==false){
			correcto=false;
			alert("No ha especificado si el inmueble está dotado de garaje.");
			ocultaDiv()
			return false;
		}
		control=document[formulario].habitaciones.value;
		control=Trim(control);
		if(control.length==0){
			correcto=false;
			alert("No ha introducido el Nº de habitaciones del inmueble.");
			ocultaDiv()
			return false;
		}
		control=document[formulario].superficie.value;
		control=Trim(control);
		if(control.length==0){
			correcto=false;
			alert("No ha introducido la superficie del inmueble.");
			ocultaDiv()
			return false;
		}
		control=document[formulario].precio.value;
		control=Trim(control);
		if(control.length==0){
			respuesta=confirm("No ha introducido el precio para el inmueble.\nEn el detalle del inmueble aparecerá la opción Consultar.\n\n¿Desea continuar?");
			if(respuesta==false){
				correcto=false;
				ocultaDiv()
				return false;
			}
		}
		control=document[formulario].descripcion.value;
		if(control.length==0){
			respuesta=confirm("No ha introducido la descripción para el inmueble.\n\n¿Desea continuar?");
			if(respuesta==false){
				correcto=false;
				ocultaDiv()
				return false;
			}
		}
	}
	if(fotos=="no" && seccion=="promocion"){
		//tratar fecha del proyecto
		control=document[formulario].presentacion.value;
		control=Trim(control);
		if(control.length==0){
			correcto=false;
			alert("No introdujo el texto de presentación para la promoción.");
			ocultaDiv()
			return false;
		}
		control=document[formulario].descripcion.value;
		control=Trim(control);
		if(control.length==0){
			correcto=false;
			alert("No introdujo la descripción para la promoción.");
			ocultaDiv()
			return false;
		}
	}
	if(fotos=="no" && seccion=="prensa"){
		//tratar fecha del proyecto
		control=document[formulario].fecha.value;
		if(control.substr(2,1)!="/" || control.substr(5,1)!="/"){
			correcto=false;
			alert("La fecha del documento no tiene un formato válido.\n\nRecuerde: dd/mm/aaa (02/08/2005)");
			return false;
		}
		if(control.length!=10){
				correcto=false;
				alert("La fecha del documento no tiene una longitud permitida.\n\nRecuerde: dd/mm/aaa (02/08/2005)");
				return false;
		}
	}
	if(fotos=="si"){
		//tratar fechas de las imagenes
		j=1
		if(seccion=="prensa"){
			j=0;
		}
		while(document[formulario]["archivo"+j]=="[object]"){
			controlImg=document[formulario]["archivo"+j].value;
			//compruebo que las imagenes sean jpg.
			posicion=controlImg.substring((controlImg.length-4),controlImg.length);
			posicion=posicion.toLowerCase();
			if(posicion!=".jpg"){
				correcto=false;
				alert("La imagen Nº "+j+" no tiene un formato válido.\nSólo se permiten imágenes con extension: jpg");
				ocultaDiv()
				return false;
			}
			j++;
		}
	}
	if(correcto==true){
		return true;
	}else{
		ocultaDiv()
		return false;
	}
}

function comprobarFormulario(formulario){
	//comprobar q exista contenido en las cajas de texto
	correcto=true;
	control=document.getElementById("@nombre").value;
	control=Trim(control);
	if(control.length==0 || control==""){
		alert("Debe introducir su nombre.");
		correcto=false;
		return false;
	}
	control=document.getElementById("@telefono").value;
	control=Trim(control);
	if(control.length==0 || control==""){
		alert("Debe introducir un telefono de contacto.");
		correcto=false;
		return false;
	}
	if(correcto==true){
		return true;
	}else{
		return false;
	}
}

function tipoDatos(tipo){
	if(tipo=="numero"){
		if(event.keyCode==44){
			event.keyCode=46;
		}
		if((event.keyCode<48 || event.keyCode>57) && (event.keyCode!=46)){
			event.keyCode=0;
		}
	}else if(tipo=="familia"){
		correcto=true;
		if(document.frmProductos.familia.value=="0"){
			correcto=false;
			alert("Debe elegir la familia de productos que desea listar.");
			return false;
		}
		if(correcto){
			document.frmProductos.submit();
		}
	}
}

function Trim(sString){
	while (sString.substring(0,1)==" "){
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length)==" "){
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}

/*
function Abrir_Ventana(pagina,ancho,alto){
	var adj=10
	var w = screen.width;
	var h = screen.height;
	var byFactor=1;
	if(w<740){
	  var lift=0.90;
	}
	if(w>=740 & w<835){
	  var lift=0.91;
	}
	if(w>=835){
	  var lift=0.93;
	}
	if (ancho>w){	
	  byFactor = w / ancho;			
	  ancho = w;
	  alto = ancho * byFactor;
	}
	if (alto>h-adj){
	  byFactor = h / alto;
	  ancho = (ancho * byFactor);
	  alto = h; 
	}
	   
	var scrWidth = w-adj;
	var scrHeight = (h*lift)-adj;

	if (alto>scrHeight){
  	  alto=alto*lift;
	  ancho=ancho*lift;
	}

	var posLeft=0;
	var posTop=0;


	var scrHeightTemp = alto - 0;
	if (scrHeightTemp < scrHeight) {
	scrHeight = scrHeightTemp;
	} 
	var scrWidthTemp = ancho - 0;
	if (scrWidthTemp < scrWidth) {
	scrWidth = scrWidthTemp;
	}
	
	if (scrHeight<100){scrHeight=100;}
	if (scrWidth<100){scrWidth=100;}
	
	
	posTop =  ((h-(scrHeight/lift)-adj)/2);
	posLeft = ((w-(scrWidth)-adj)/2);

	if (alto > (h*lift)-adj || ancho > w-adj){
		alto=alto-adj;
		ancho=ancho-adj;
	}
	posTop = parseInt(posTop);
	posLeft = parseInt(posLeft);			
	window.open(pagina,'_new',"HEIGHT='" +alto+ "',WIDTH='" +ancho+ "',TOOLBAR=no,MENUBAR=no,SCROLLBARS=no,RESIZABLE=no,LOCATION=no,DIRECTORIES=no,STATUS=no,left='"+posLeft+"',top='"+posTop);
}
*/

function borrarImagen(direccion,identificador,nombreFoto,seccion){
	var opt="";
	var newDireccion="";
	newDireccion=direccion;
	newDireccion=newDireccion.replace("&","!");
	newDireccion=newDireccion.replace("?","@");
	respuesta=confirm("La acción borrará la foto asociada. ¿Desea continuar?");
	if(respuesta==true){
		window.open("delFoto.asp?idf="+identificador+"&nomf="+nombreFoto+"&volver="+newDireccion+"&seccion="+seccion,"_self",opt);
	}
}

function borrarDoc(direccion,identificador,nombreFoto,seccion){
	var opt="";
	var newDireccion="";
	newDireccion=direccion;
	newDireccion=newDireccion.replace("&","!");
	newDireccion=newDireccion.replace("?","@");
	respuesta=confirm("La acción borrará el archivo asociado. ¿Desea continuar?");
	if(respuesta==true){
		window.open("delDoc.asp?idf="+identificador+"&nomf="+nombreFoto+"&volver="+newDireccion+"&seccion="+seccion,"_self",opt);
	}
}

function borrarDoc2(direccion,identificador,nombreFoto,seccion){
	var opt="";
	var newDireccion="";
	newDireccion=direccion;
	newDireccion=newDireccion.replace("&","!");
	newDireccion=newDireccion.replace("?","@");
	respuesta=confirm("La acción borrará el archivo asociado. ¿Desea continuar?");
	if(respuesta==true){
		window.open("delDoc2.asp?idf="+identificador+"&nomf="+nombreFoto+"&volver="+newDireccion+"&seccion="+seccion,"_self",opt);
	}
}

function MostrarImagenPie(imageName,imageWidth,imageHeight,alt,bgcolor,hugger,hugMargin,bajoFoto) {
	if (bgcolor=="") {
		bgcolor="#FFFFFF";
	}
	var adj=10
	var w = screen.width;
	var h = screen.height;
	var byFactor=1;

	if(w<740){
	  var lift=0.90;
	}
	if(w>=740 & w<835){
	  var lift=0.91;
	}
	if(w>=835){
	  var lift=0.93;
	}
	if (imageWidth>w){	
	  byFactor = w / imageWidth;			
	  imageWidth = w;
	  imageHeight = imageHeight * byFactor;
	}
	if (imageHeight>h-adj){
	  byFactor = h / imageHeight;
	  imageWidth = (imageWidth * byFactor);
	  imageHeight = h; 
	}
	   
	var scrWidth = w-adj;
	var scrHeight = (h*lift)-adj;

	if (imageHeight>scrHeight){
  	  imageHeight=imageHeight*lift;
	  imageWidth=imageWidth*lift;
	}

	var posLeft=0;
	var posTop=0;

	if (hugger == "hug image"){
	  if (hugMargin == ""){
	    hugMargin = 0;
	  }
	  var scrHeightTemp = imageHeight - 0 + 2*hugMargin;
	  if (scrHeightTemp < scrHeight) {
		scrHeight = scrHeightTemp;
	  } 
	  var scrWidthTemp = imageWidth - 0 + 2*hugMargin;
	  if (scrWidthTemp < scrWidth) {
		scrWidth = scrWidthTemp;
	  }
	  
	  if (scrHeight<100){scrHeight=100;}
	  if (scrWidth<100){scrWidth=100;}

	  posTop =  ((h-(scrHeight/lift)-adj)/2);
	  posLeft = ((w-(scrWidth)-adj)/2);
 	}

	if (imageHeight > (h*lift)-adj || imageWidth > w-adj){
		imageHeight=imageHeight-adj;
		imageWidth=imageWidth-adj;
	}
	posTop = parseInt(posTop);
	posLeft = parseInt(posLeft);		
	scrWidth = parseInt(scrWidth); 
	scrHeight = parseInt(scrHeight);
	
	var agt=navigator.userAgent.toLowerCase();
	if (agt.indexOf("opera") != -1){
	  var args= new Array();
	  args[0]='parent';
	  args[1]=imageName;
	  var i ; document.MM_returnValue = false;
	  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	} else {
	newWindow = window.open("imagen.htm","newWindow","width="+scrWidth+",height="+(scrHeight+100)+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><link rel="stylesheet" type="text/css" href="css/estilos.css"><title>'+alt+'</title><body leftmargin="0" topmargin="'+hugMargin+'" marginheight="0" marginwidth="0" bgcolor='+bgcolor+' onBlur="self.close()" onClick="self.close()">');  
	newWindow.document.write('<table width='+imageWidth+' border="0" cellspacing="0" cellpadding="0" align="center" height="'+scrHeight+'"><tr><td>');
	newWindow.document.write('<img src="'+imageName+'" width="'+imageWidth+'" height="'+imageHeight+'" alt="haz click aquí para cerrar" >'); 
	newWindow.document.write('<tr><td class="fuenteVerdana fuente_Blanca"><br>' + bajoFoto + '</td></tr>');
	newWindow.document.write('</td></tr></table></body></html>');
	newWindow.document.close();
	newWindow.focus();
	}
}

function MostrarImagen(imageName,imageWidth,imageHeight,alt,bgcolor,hugger,hugMargin) {
	if (bgcolor=="") {
		bgcolor="#FFFFFF";
	}
	var adj=10
	var w = screen.width;
	var h = screen.height;
	var byFactor=1;

	if(w<740){
	  var lift=0.90;
	}
	if(w>=740 & w<835){
	  var lift=0.91;
	}
	if(w>=835){
	  var lift=0.93;
	}
	if (imageWidth>w){	
	  byFactor = w / imageWidth;			
	  imageWidth = w;
	  imageHeight = imageHeight * byFactor;
	}
	if (imageHeight>h-adj){
	  byFactor = h / imageHeight;
	  imageWidth = (imageWidth * byFactor);
	  imageHeight = h; 
	}
	   
	var scrWidth = w-adj;
	var scrHeight = (h*lift)-adj;

	if (imageHeight>scrHeight){
  	  imageHeight=imageHeight*lift;
	  imageWidth=imageWidth*lift;
	}

	var posLeft=0;
	var posTop=0;

	if (hugger == "hug image"){
	  if (hugMargin == ""){
	    hugMargin = 0;
	  }
	  var scrHeightTemp = imageHeight - 0 + 2*hugMargin;
	  if (scrHeightTemp < scrHeight) {
		scrHeight = scrHeightTemp;
	  } 
	  var scrWidthTemp = imageWidth - 0 + 2*hugMargin;
	  if (scrWidthTemp < scrWidth) {
		scrWidth = scrWidthTemp;
	  }
	  
	  if (scrHeight<100){scrHeight=100;}
	  if (scrWidth<100){scrWidth=100;}

	  posTop =  ((h-(scrHeight/lift)-adj)/2);
	  posLeft = ((w-(scrWidth)-adj)/2);
 	}

	if (imageHeight > (h*lift)-adj || imageWidth > w-adj){
		imageHeight=imageHeight-adj;
		imageWidth=imageWidth-adj;
	}
	posTop = parseInt(posTop);
	posLeft = parseInt(posLeft);		
	scrWidth = parseInt(scrWidth); 
	scrHeight = parseInt(scrHeight);
	
	var agt=navigator.userAgent.toLowerCase();
	if (agt.indexOf("opera") != -1){
	  var args= new Array();
	  args[0]='parent';
	  args[1]=imageName;
	  var i ; document.MM_returnValue = false;
	  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	} else {
	newWindow = window.open("imagen.htm","newWindow","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+bgcolor+' onBlur="self.close()" onClick="self.close()">');  
	newWindow.document.write('<table width='+imageWidth+' border="0" cellspacing="0" cellpadding="0" align="center" height='+scrHeight+' ><tr><td>');
	newWindow.document.write('<img src="'+imageName+'" width='+imageWidth+' height='+imageHeight+' alt="haz click aquí para cerrar" >'); 
	newWindow.document.write("</td></tr></table></body></html>");
	newWindow.document.close();
	newWindow.focus();
	}
}
/*
function validar_fecha(caja){ 
   if (caja){  
      borrar = caja;
      if ((caja.substr(2,1) == "/") && (caja.substr(5,1) == "/")){      
         for (i=0; i<10; i++){	
            if (((caja.substr(i,1)<"0") || (caja.substr(i,1)>"9")) && (i != 2) && (i != 5)){
               borrar = '';
               break;  
			}  
         }
	     if (borrar){ 
	        a = caja.substr(6,4);
		    m = caja.substr(3,2);
		    d = caja.substr(0,2);
		    if((a < 1900) || (a > 2050) || (m < 1) || (m > 12) || (d < 1) || (d > 31))
		       borrar = '';
		    else{
		       if((a%4 != 0) && (m == 2) && (d > 28))	   
		          borrar = '';
			   else{
		          if ((((m == 4) || (m == 6) || (m == 9) || (m==11)) && (d>30)) || ((m==2) && (d>29)))
			         borrar = '';	      				  	 
			   }
		    }
         }
      }
	  else
	     borrar = '';
	  if (borrar == '')
	     alert('Debe Introducir una fecha con este formato "dd/mm/yyyy"');
   }
}
function ReplaceCaracter(inputString, fromString, toString) {
   // Goes through the inputString and replaces every occurrence of fromString with toString
   var temp = inputString;
   if (fromString == "") {
      return inputString;
   }
   if (toString.indexOf(fromString) == -1) { // If the string being replaced is not a part of the replacement string (normal situation)
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } else { // String being replaced is part of replacement string (like "+" being replaced with "++") - prevent an infinite loop
      var midStrings = new Array("~", "`", "_", "^", "#");
      var midStringLen = 1;
      var midString = "";
      // Find a string that doesn't exist in the inputString to be used
      // as an "inbetween" string
      while (midString == "") {
         for (var i=0; i < midStrings.length; i++) {
            var tempMidString = "";
            for (var j=0; j < midStringLen; j++) { tempMidString += midStrings[i]; }
            if (fromString.indexOf(tempMidString) == -1) {
               midString = tempMidString;
               i = midStrings.length + 1;
            }
         }
      } // Keep on going until we build an "inbetween" string that doesn't exist
      // Now go through and do two replaces - first, replace the "fromString" with the "inbetween" string
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + midString + toTheRight;
      }
      // Next, replace the "inbetween" string with the "toString"
      while (temp.indexOf(midString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(midString));
         var toTheRight = temp.substring(temp.indexOf(midString)+midString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } // Ends the check to see if the string being replaced is part of the replacement string or not
   return temp; // Send the updated string back to the user
} // Ends the "replaceSubstring" function*/

function Aleatorio(limite,inicio){
	return Math.floor(Math.random()*limite)+ inicio;
}

function randomImage(minimo,maximo,destino,ruta){
	var imgSrc, r;
	r = Aleatorio(maximo,minimo);
	i=r;
	iteraciones=0;
		//Si al imagen ya se muestra, busca la siguiente foto q no se esta mostrando.
		while(mostrando[i-1]==1){
		iteraciones++;
		i++;
		r = i;
		if(i>maximo){
			i=1;
			r=i;
		}
		if(iteraciones>200){break;}
	}
	numero=r.toString();
	//if(numero.length==1){numero="0" + numero;}
	imgSrc = numero+".jpg";	
	document.all[destino].src = ruta + imgSrc;
	mostrando[r-1]=1;
}
function temporizador(first,minimoT,maximoT,destinoT,cuantasT,rutaT){
	//for(j=1;j<=cuantasT;j++){
		randomImage(minimoT,maximoT,destinoT + first,rutaT);		
	//}
	for(k=0;k<mostrando.length;k++){
		mostrando[k]="0";
	}
}
